On 28/05/2018 at 23:52, xxxxxxxx wrote:
Cinema 4D Version: R19
Platform: Windows ; Mac OSX ;
Language(s) : C++ ;
I am currently investigating the feasability of a new plugin.
Parsing the SDK documentation in search of collecting the required information I ended up having more questions than answers.
I understand the forum to encourage a single question per thread.
But since most questions are related to each other, and due to their common context, I hope it is OK for me to list the questions here.
I 'd be happy to split off the questions into their own thread should the discussion require it, or steer into that direction.
The main topic for his plugin is the detection of change of polygons for a polygon object.
We've discussed this in the past (for another plugin), and the MSG_POLYGONS_CHANGED then came up.
This message would be sent to a (hidden) tag assigned to the polygon object. Let's call this the "ListenerTag", for future reference.
Q1: is there another type of plugin which could receive this message, apart from a tag plugin?
Reason for this question is that I would want to avoid adding a tag to the object.
When user would share this object with others not having the tag plugin, a message would popup mentioning the missing ListenerTag plugin. Not a big deal, but I would want to avoid this.
I then noticed MSG_DOCUMENTINFO_TYPE_SAVE_BEFORE which could be received by a SceneHook plugin when the scene is about to be written.
Q2: Could I detect MSG_DOCUMENTINFO_TYPE_SAVE_BEFORE in a SceneHook data, and remove the ListenerTag from the object(s)?
Is it save to remove tags right before writing the scene file? Will the saved scene file indeed NOT contain the ListenerTag, avoiding the "missing plugins" message pop up when user loading this scene file, not having the ListenerTag plugin installed?
The alternative for when the whole idea -of using a ListenerTag and specially removing it before saving the scene file- is too far fetched and unusable:
Using a MessageData I could detect EVMSG_CHANGE, check for the dirty count, or get the polygon count from the Polygon tag.
Comparing this value with some stored value in a custom BaseContainer in the object. When values are different this means the poylgon count has changed, and I update the stored value with the new polygon count.
I could, similar to the ListerenTag idea, remove the custom container from the object once the scene files get saved.
But I wouldn't mind leaving it, as it only represents a few bytes.
Q3: does an object containing a custom BaseContainer (using a registered plugin ID) trigger a "missing plugin" message, when plugin is not installed?
I don't think so, because a plugin ID for a custom BaseContainer does not necessarily mean there exists a plugin with this ID. Just like plugin IDs are used for specific messages being sent via SpecialEventAdd.
Still, better be safe than sorry and ask.
Q4: what in case I decide I want to remove the custom BaseContainer before user saves the scene file, can I do so by receiving the MSG_DOCUMENTINFO_TYPE_SAVE_BEFORE and simply removing the basecontainer from the object?
Q5: are there next to MSG_POLYGONS_CHANGED or EVMSG_CHANGE other options to detect a change of geometry / toplogy?
Thanks for reading,