0
$\begingroup$

Is it possible to assign a conditional property group to scene elements?

My intent is to not have the group exist until I manually create or assign it, then be capable of removing or deleting it.

$\endgroup$

1 Answer 1

0
$\begingroup$

I came up with a very simple (and somewhat obvious) solution to my problem - Use a property collection list to contain the single "conditional" property group. It has all of the qualities of a dynamically allocated object (property group) which only exists when you need it to:

class XYZ: # your object properties group or whatever

    list : bpy.props.CollectionProperty( type = ConditionalPropGroup )

    def IsNull(self):
        return len( self.list ) == 0

    def Create(self):
        if self.IsNull():
            self.list.add()
        return self.list[0]

    def Destroy(self):
        if not self.IsNull():
            self.list.remove(0)

So I just have to add the collection property to all scene element classes, then I can assign the property group itself to specific elements, leaving the rest empty.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .