Tag variables and rendering?
On 26/08/2017 at 07:02, xxxxxxxx wrote:
I have a tag plugin with some (local) variables I used in the tag.
The variable is initialized in __INIT__() and filled/used in Execute and GetDDescription.
And everything is ok.
However when I render, myList is empty and thus it does not render correctly.
What is the best methode / place to define these variables?
def __init__(self) : self.myList =  def Execute(self, tag, doc, op, bt, priority, flags) : data = tag.GetDataInstance() self.myList.append(data[inputVar) ....
I also tried to put the initialization in Init(self, op),but that did not work either.
I can use global variables, but then a second same tag will have the same variable values.
On 26/08/2017 at 08:07, xxxxxxxx wrote:
For passing a list from a copied object you have to override CopyTo function from your NodeData (derived from your TagData).
For more complete informations make sure to read C++ CopyTo Manual.
Basicly when you render a scene, c4d copy the current scene and render this copied scene, c4d copy BaseContainer for this object, but not the object stored into it memory. CopyTo function is make for that, you can specified which things are copied and which are not.
On 26/08/2017 at 11:46, xxxxxxxx wrote:
Ok, i did not know that.
I will give it a try.
On 26/08/2017 at 12:24, xxxxxxxx wrote:
Thanks you very much and thanks for this great forum!
On 28/08/2017 at 09:32, xxxxxxxx wrote:
Just some additional information for future readers:
It's not mandatory, but in most case, where you have member variables that need to be covered in CopyTo(), then chances are you will also need to override Read() and Write(). Might not be the case here, but it's at least recommended to think about it and maybe also test it (you'll run into issues with loading or saving scenes in such a case). Here's the link to the respective C++ manual on NodeData::Read() and Write().
One additional thought: Maybe you don't even need the list as member of your class. Couldn't you use the BaseContainer instead? Then you wouldn't have to worry about this at all.
On 28/08/2017 at 12:42, xxxxxxxx wrote:
And yes, i did use read and write.