On 06/05/2013 at 11:12, xxxxxxxx wrote:
You can use Cinema's messaging interface. You can pass almost any python object via the
message system and react on that in your ObjectData.
MSG_RETRIEVE_OBJECTDATA_INSTANCE = # Your UNIQUE ID from the plugincafe.
class MyObjectPlugin(c4d.plugins.ObjectData) :
def __init__(self) :
super(MyObjectPlugin, self).__init__()
self.internal_data = ['super', 'internal', 42, 'data']
def Message(self, op, id, data) :
if id == MSG_RETRIEVE_OBJECTDATA_INSTANCE:
data['obj'] = self
return True
# ... other message handling
def in_some_arbitrary_context(op) :
if op.CheckType(Omyobjectplugin) :
data = {'obj': None}
op.Message(MSG_RETRIEVE_OBJECTDATA_INSTANCE, data)
if data['obj']:
print obj.internal_data
But be aware of the fact that only "non-native" types can be passed to the second argument of
Message(). If you pass an integer instead of the dictionary (just for instance), you will get the
message in the ObjectData plugin, but the "data" parameter will have a None value instead of
the integer.
Best,
-Niklas