I wrote an Operator which contain multiple properties. One Property is a CollectionProperty. I want to add items to the CollectionProperty via a button. As all buttons are Operators, I have to write an Operator to handle this. My problem is, how can the second operator access the data of the other one? Probably I’m missing some key understanding.
Something like this I want to achieve:
class OperatorB(bpy.types.Operator): def execute(self, context): # call add on collection of OperatorA class OperatorA(bpy.types.Operator): collection = CollectionProperty(type=Foobar) def draw(self, context): layout = self.layout layout.operator("operator_a.add")
I’m also not sure if I really have to write an operator or if there are other ways to achieve that. I have also seen scripts which add properties to bpy.types.WindowManager or bpy.types.Scene which can then be accessed from different Operators. Is that the correct approach? In that case, is there a preferred type to add such properties?
At the end I want something (from the UI perspective) like the Modifiers tab, instead the drop down menu a button. Do I have to write Operator for closing, expand/collapse, etc.? I’ve looked at properties_data_modifiers.py, but it was not of much help, because the file mainly handles the drawing.
Any ideas or suggestions?