Core Message or use MSG_BASECONTAINER
On 14/12/2017 at 04:10, xxxxxxxx wrote:
Hello a question come at me in this thread
So what is the best way for send message over our plugin.
By that I mean should I use a CoreMessage with SpecialEventAdd or it's better to send a Message with MSG_BASECONTAINER as primary ID and our data with for example bc = Our Type of message then fill the rest of the bc with our datas.
In more general when should we implement Core Message instead of a simple NodeData.Message?
And what are the difference beetween both?
Thanks in advance !
On 15/12/2017 at 04:04, xxxxxxxx wrote:
Core messages are asynchronous and are always run in the main thread. These are sent around Cinema 4D application (i.e. to the GUI dialogs/user areas and message plugins) but never propagated to the nodes of a document.
Node messages are synchronous and are run in the thread context of the caller (for instance an execution pipeline thread or the main thread).
These are sent to specific nodes ( Message() ) and optionally also to their hierarchy ( MultiMessage() ).
Core messages are useful to perfom operations in the main thread, e.g. GUI, respond to changes/events, access document.
Node messages are meant to be evaluated in the context of a node to notify it about a change or send/retrieve data from it.
Choosing between core and node messages depends on the task and the plugin's type/context.
If you need to send data to a NodeData plugin then a node message is obvious. You can use _MSG_BASECONTAINER _or a custom registered plugin ID.
Note it's possible to set the ID of a container (with constructor or SetId() ) for the type of the message sent with MSG_BASECONTAINER.
On 15/12/2017 at 04:27, xxxxxxxx wrote:
Thanks a lot for this precise answerd, way more clear to me.