Hello,
I'm creating an object plugin that not need to be opened more then one time. I'm searching how to limit the open of an object plugin to only one time. I had tried via GetState() but it doesn't work.
def get_all_objects(op, filter, output):
while op:
if filter(op):
output.append(op)
get_all_objects(op.GetDown(), filter, output)
op = op.GetNext()
return output
class MyObject(c4d.plugins.ObjectData):
def GetVirtualObjects(self, op, hierarchyhelp):
doc = documents.GetActiveDocument()
search = get_all_objects(doc.GetFirstObject(), lambda x: x.CheckType(MY_OBJECT_ID), [])
if len(search) :
...
return op.GetCache(hierarchyhelp)
Thank you.