questions about SceneHookData plugin
-
On 08/08/2015 at 23:05, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 15+
Platform: Windows ;
Language(s) : C++ ;---------
I'm creating a SceneHookData plugin to track whatever happens in the document.
so far I need to do multiple stuff, but I'm not sure what is the best way to do it "as I know SceneHookData is very sensitive and needs to be efficient"what I'm gonna track:
1- materials changes "message? does the message provide specific material change or all materials?"
2- object insertion/deletion "message? + I need to add a hidden tag to the created object"
3- cache changes "message? does the message point to a specific object cache change, or it is just a global message where I need to iterate over objects and get dirty?"
4- listening to specific messages from my GeUserArea inside my MaterialData? "I have 3 different messages" -
On 09/08/2015 at 05:57, xxxxxxxx wrote:
Howdy,
Since you're polling for messages, wouldn't it be better to use a message plugin instead? From the documentation, it sounds like a scene hook plugin is for "scene prepare" before something happens.
Adios,
Cactus Dan -
On 09/08/2015 at 09:27, xxxxxxxx wrote:
Hey,
I'm not 100% sure if message plugin alone will be sufficient
-
On 10/08/2015 at 06:28, xxxxxxxx wrote:
Hello,
in Cinema 4D a dialog typically watches a certain element. When the scene is changed one typically calls EventAdd() to inform Cinema that something changed. This results in the core message EVMSG_CHANGE so you know that you have to check if the object you want to watch changed. This core message is sent to dialogs and MessageData plugins. So often one has to iterate over all objects and check their dirty state.
A SceneHookData plugin is typical used to store additional data inside the document and to add additional code to the execution and draw pipeline. Certain meessages are (also) sent to SceneHooks including MSG_DOCUMENTINFO which can include information about newly added tags, materials and objects. See MSG_DOCUMENTINFO_TYPE.
Best wishes,
Sebastian -
On 10/08/2015 at 06:58, xxxxxxxx wrote:
ok, so to summarize what I need to do:
1- a SceneHookData "which will contain a unique identifier for objects, materials, .."
here the only question is: can I modify member variables safely? I know that the class is called in a thread.2- MessageData: does ALL messages "aka EVMSG_CHANGE, MSG_DOCUMENTINFO, any other possible message anywhere" can be received here?
-
On 10/08/2015 at 07:34, xxxxxxxx wrote:
Howdy,
Remember, you can also use SpecialEventAdd() to add your own custom messages, which will be received by the MessageData::CoreMessage() function. You'd need to get a plugin ID for each custom message.
Adios,
Cactus Dan -
On 11/08/2015 at 00:43, xxxxxxxx wrote:
Hello,
MessageData is a plugin for Cinema itself so it receives messages relevant to the whole application (if the GUI has to be updated etc.). A SceneHook in contrast becomes part of a document and receives messages relevant to the elements of that document. MSG_DOCUMENTINFO is sent to elements of a document (see BaseDocument::SendInfo()).
Modifying the member variables of a SceneHook should be no problem. It is only problematic when you try to edit (other) scene elements in a thread context.
Best wishes,
Sebastian