On 30/05/2018 at 13:07, xxxxxxxx wrote:
Cinema 4D Version: R19
Platform: Windows ; Mac OSX ;
I am looking to programmatically create a (hidden) tag, which is assigned to polygon objects.
The only purpose of this tag is to listen to MSG_POLYGONS_CHANGED and MSG_POINTS_CHANGED, and inform another part of the plugin.
Now, I don't want the user to take actions to create these "listener" tags manually.
As such, I use a MessageData to listen to EVMSG_CHANGE and iterate over the current active objects. When an active object does not have a listener tag, I create one using BaseObject::MakeTag.
For testing purposes I have left the tag visible. I can thus select such tag and delete it.
As a result of the deletion an EVMSG_CHANGE is sent, and automatically a (new) tag is created and assigned.
However, if I then press the undo button, the deletion of the tag is reverted and I end up having two tags.
I could check during the EVMSG_CHANGE if the active object has more than one listener tag, and remove all but one.
But isn't there a better solution?
How do people create their hidden control tags?
Note, when the tag is hidden, the user cannot select and delete it, but deletion could still occur via scripts, etc ...
So, how to prevent ending up with multiple of these (hidden) control tags?