Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
On 26/09/2017 at 15:08, xxxxxxxx wrote:
Is it possible to send a message to a object data plugin?
I am using this little script to trigger an object data plugin.
def main() : plugin_2_obj = c4d.plugins.FindPlugin(plugin_id) MY_CUSTOM_MSG_ID = 4 python_object_to_send = [1,2,3,4,4] plugin_2_obj.Message(MY_CUSTOM_MSG_ID, python_object_to_send ) if __name__=='__main__': main()
In the object data plugin I have following:
def Message(self, node, type, data) : if (type == 4) : print "type: ", type return True
On 27/09/2017 at 01:19, xxxxxxxx wrote:
Hello,
a NodeData base plugin can only receive the data of special, hardcoded messages. So if you want to sent data to that plugin you must use a registered message type/ID.
There is a message c4d.MSG_BASECONTAINER which allows to send a BaseContainer. It seems that it can be used to send arbitrary data.
bc = c4d.BaseContainer() bc.SetInt32(0, 100) bc.SetInt32(1, 200) op.Message(c4d.MSG_BASECONTAINER, bc)
def Message(self, node, type, data) : if type == c4d.MSG_BASECONTAINER: print("Data:") for value in data: print(value)
But please test carefully if this has any side effects.
BTW why are you using FindPlugin()? This is not used to access an instance of an ObjectData plugin in a document.
best wishes, Sebastian
On 27/09/2017 at 01:47, xxxxxxxx wrote:
Another solution could be to use CoreMessage. https://plugincafe.maxon.net/topic/6808/7564_how-to-identify-different-calls-to-coremessage
So it's the time for asking what the difference beetwen Message and Core Message? As I understand Message are only send to one object using node.Message() While CoreMessage are propagate throught all nodes
On 27/09/2017 at 02:13, xxxxxxxx wrote:
core messages do NOT propagate through all nodes. Please read the Core Messages Manual carefully.
On 27/09/2017 at 02:59, xxxxxxxx wrote:
Thanks for correct me, was not sure about that!
So what's the difference beetween both? (I speak in term of implementation)
On 27/09/2017 at 03:13, xxxxxxxx wrote:
"BTW why are you using FindPlugin()? This is **not **used to access an instance of an ObjectData plugin in a document."
I need to send a message to the plugin. So I need the plugin object and FindPlugin() gives me the object (I thought).
On 27/09/2017 at 03:45, xxxxxxxx wrote:
An ObjectData return an object, so basicly you do
obj = doc.GetFirstObject() if not obj.CheckType(YOUR_PLUGIN_ID) : return bc = c4d.BaseContainer() bc.SetInt32(0, 100) bc.SetInt32(1, 200) obj.Message(c4d.MSG_BASECONTAINER, bc)
FindPlugin only give you a BasePlugin which is not an instance of your ObjectData object
c4d.plugins.BasePlugin : Represents a registered Cinema 4D plugin. Cannot be instantiated.
On 27/09/2017 at 05:32, xxxxxxxx wrote:
Ok, clear. Thanks, Pim