On 11/06/2014 at 00:16, xxxxxxxx wrote:
Cinema 4D Version: 13.061
Platform: Windows ;
Language(s) : C++ ;
I need some help about my use case. I like to move a BaseObject in the tree of object manager.
If I'm using simple the GeListNode::Remove() command and the GeListNode::InsertObject(...) it works sometimes. But mostly C4D hang up.
I read the note in your SDK documentation that "documents must never be modified using the direct list functions .. Remove, InsertBefore etc."
But how should I do this? Exist a workaround or anything other commands?
Should I'm create new objects and copy the data to this new objects?
On 11/06/2014 at 01:05, xxxxxxxx wrote:
In what context do you do these operations? Scene modifications should only be done from the
main thread, ie. not from ObjectData or Tag plugins, except in their Message() function.
On 11/06/2014 at 01:14, xxxxxxxx wrote:
It's in a message context of a other ObjectData.
What is the best way to do this in the main thread?
On 11/06/2014 at 01:40, xxxxxxxx wrote:
Well, if its in ObjectData::Message(), it should be fine (except if you called it yourself from another
thread). Maybe you're doing something wrong with inserting the object (eg. op->InsertUnder(op)
will crash C4D).
You can also use GeIsMainThread() to check if the code is being executed from the main thread.
But since Message() is supposed to be called from the main thread only, it should be (and Cinema
will also call it from the main thread only. There could still be details about specific message type,
but that does not apply to most of the built-in messages)