Yes, I already expected that.
One comment, the same behavior occurs when you Copy and Paste a node into a new document.
When I try to Isolate, using c4d.documents.IsolateObjects(), a Cloner, I noticed the Effector is not 'Isolated / copied'.
Also Copy and Paste into a new document (same as Isolate) does not 'Isolated / copy' the effector
Is there a way to fix this or should I use c4d.AliasTrans()?
@m_magalhaes, Aha, clear.
I will convert it to a Command plugin.
However, I find an issue with Isolate().
I will open another thread for that one.
Basically it is that when I isolate a Cloner, the effector is not 'copied'.
For now let's close this thread.
Thanks for all the information and your patience.
@zipit, The strange thing is the sequence of things / of messages in the console.
In the code I do:
So, in the console I would expect:
But what I get in the console is:
So the question is, why is the Write function called?
I guess it is called by c4d.documents.SaveDocument()?
I try to save an object (using IsolateObjects()) using the Tag plugins Write() function.
Here the code:
class EDITABLECLEANTAG(plugins.TagData): myData = None def Write(self, node, HFfile): print "WRITE myData: ", self.myData # Store the size HFfile.WriteInt32(self.myData) # Store the data itself if HFfile.WriteMemory(self.myData) is False: raise ValueError("can't write the file") return True def Message(self, tag, type, data): doc = tag.GetDocument() id = GetMessageID(data) if id == CLICK_EDITABLECLEAN: # If this Gizmo is activated # using a MemoryFileStructure to store a document mfs = c4d.storage.MemoryFileStruct() mfs.SetMemoryWriteMode() IsolateObject = tag.GetObject() print "IsolateObject: ", IsolateObject newdoc = c4d.documents.IsolateObjects(doc , [IsolateObject]) # Save the document to the MemoryFileStructure c4d.documents.SaveDocument(newdoc, mfs, c4d.SAVEDOCUMENTFLAGS_NONE, c4d.FORMAT_C4DEXPORT) #Retrieve the data and store it somewhere, here in self.myData self.myData = mfs.GetData() print "Data saved: ", self.myData
When a button is clicked in the tag UI, I do an IsolateObjects(), and then store the resulting newdoc in myData.
Later on, when the scene file is saved, the Write() function is called automatically and the data is saved.
However, it looks to me that c4d.documents.SaveDocument() also calls Write().
If so, myData is not filled yet, and an error occurs.
What am I doing wrong?
Great, thank you very much.
I am beginning to see the light.
And yes, my fault, apparently I indicated it as c++, but I am doing it in Python.
About your warning.
My plan was to do it all in a tag plugin.
There I can have the interface, do the isolate and the read/write in a hf.
Or is it better to do it in a Object plugin?
Thanks for the explanation.
the line <c4d.documents.BaseDocument object called '' with ID 110059 at 0x00000135BC7F9030> always show a strange name ''? Why is it not showing the name of the document?
Back to the main questions, what to do, to store the node in scene file.