On 13/04/2014 at 13:56, xxxxxxxx wrote:
Cinema 4D Version: R14
Platform: Windows ;
Language(s) : C++ ;
I was wondering why the virtual Init() function is called more than just when the plugin is instantiated..
For example when i run my plugin, change a value or press a button in it
s properties, it fires Init().. It also only fires it the first time - so for example if i change a specific value three times, it only firse Init() the first time, then if i hit a DIFFERENT button, it fires Init(), and i can then go back and change the first value and again itll fire Init() the first time the value is changed..
Can anybody explain the reason for this or logic behind it?
Having trouble with an INEXCLUDE that only seems to update after a call to Init(), trying to get to the bottom of it..
On 13/04/2014 at 21:49, xxxxxxxx wrote:
Init() is always called when an instance of your plugin is created. An
undo step is added when you change a value of your node. That will
call Init() on a different NodeData.
On 14/04/2014 at 13:44, xxxxxxxx wrote:
Cheers Niklas.. The GePrint("Init()") i have at the start of my Init override is displaying in the console every time it fires - i would assume from that that it is running my Init override, no?
On 17/04/2014 at 14:42, xxxxxxxx wrote:
Yes, it is your plugin class that is invoked, but another instance of it. Check the memory address
of the "this" pointer when Init() is called. Basically, what happens when an undo is created, is that
a copy of your object/tag/material is created and that requires the NodeData subclass to be
initialized with Init().