Belhaviour on tag delete
-
On 15/11/2015 at 02:32, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R17
Platform: Windows ;
Language(s) : C++ ;---------
Hi, one more question about tag and behaviors.
I tried to perform search on forum but I can't find any help.I'm trying to reset my object visibility and position on tag delete ? I can't perform my actions when I create free method :
virtual void Free(GeListNode* node);
This free method is executed but it can't catch object, probably because object is not longer connected to it.
Thanks guys !!
-
On 15/11/2015 at 03:37, xxxxxxxx wrote:
you may store the BaseObject* as a class member, use it on Free()
-
On 16/11/2015 at 04:46, xxxxxxxx wrote:
Hello,
please do not store and handle a pointer to a BaseObject in a Free() function. Cinema will allocate and free various instances of any entity, for example with the undo system. So Free() may be called many times, even it the tag is not removed from the host object. Also, do not store pointer to object since these pointer may become invalid for the same reasons. Always use a BaseLink.
It seems that when a tag is removed from the object no special message is sent to the tag. Only the core message EVMSG_CHANGE is triggered and sent to MessageData plugins. So you could try to catch that message there and react accordingly.
Best wishes,
Sebastian -
On 16/11/2015 at 05:45, xxxxxxxx wrote:
Thanks MohamedSakr for your idea. I could be great but like S_Bach said the free function is called many time. And make my pointer crash ! I'm looking to the Message way. I'll post news here ! thanks for your helps guys !
-
On 16/11/2015 at 06:50, xxxxxxxx wrote:
there is another solution, a hidden tag, this hidden tag will be attached with your tag, once your tag get deleted, hidden tag will notice this and will do whatever you want, I guess this should work
-
On 17/11/2015 at 02:49, xxxxxxxx wrote:
So when my tag is created on my object I need to create a hidden tag so. And at every run cycle I should ask to my hidden tag if the normal tag exist ? But this way I need to add one extra tag and my execution time will be a bit slow...
Hum, I'm trying, it's good idea but I'm not sure I will keep it !
-
On 17/11/2015 at 03:08, xxxxxxxx wrote:
execution time should be quite fast , it is just a single if statement
-
On 17/11/2015 at 03:56, xxxxxxxx wrote:
Yes your right ! As fast as a Switch from a message catcher. Your right, I'm a bit greedy with execution time !
Should I need to create a complete new plugin with new plugin ID to do that ?