On 12/09/2016 at 01:09, xxxxxxxx wrote:
Cinema 4D Version: R18
Platform: Windows ;
Language(s) : C++ ;
Here is how I copy general settings from Active Document to a cloned one.
BaseDocument* cloned_document = BaseDocument::Alloc();
BaseContainer data = GetActiveDocument->GetData(DOCUMENTSETTINGS_GENERAL);
Nevertheless, whenever I load one of my projects in R18, a breakpoint is triggered in SetData in the very first execution of this code. I use this code inside InitGLImage method of a MaterialData plugin.
What causes this breakpoint ?
Thank you for your time.
On 12/09/2016 at 08:25, xxxxxxxx wrote:
as always one should never use GetActiveDocument() inside a NodeData based plugin. Access the host document of an element using GeListNode::GetDocument() (see BaseDocument Manual).
So far I could not reproduce any breakpoint with the description and code you provided. Can you provide more information?
On 20/09/2016 at 02:03, xxxxxxxx wrote:
Here is the code that triggers breakpoint. This code is at the start of InitGLImage in my MaterialData (there is nothing before it). This happens only when I have an R17 scene and I open it in R18.
The doc parameter is the one passed in InitGLImage
BaseDocument* dummy_document = BaseDocument::Alloc();
BaseContainer doc_data = doc->GetData(DOCUMENTSETTINGS_GENERAL);
I was using GetActiveDocument because InitGLImage runs only when you have Cinema4D opened (right?).
On 23/09/2016 at 08:33, xxxxxxxx wrote:
well, InitGLImage() is called when the OpenGL renderer is used. One can use the "Hardware OpenGL" or "Software OpenGL" renderer as the render engine in the render settings. This is typically done to create fast animation previews. And this render job can be rendered on the command line, team render etc. where GetActiveDocument() would not be valid.