THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/07/2010 at 12:37, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 11.514
Platform:
Language(s) : C++ ;
---------
Hello,
I am writing a plugin to save and restore geometry groupings in the BaseDocument for a major visual effect studio in Los Angeles.
The reason being is that our texture artists have to regroup their geometry for each new model version they receive to paint. I have created a plugin which saves the hierarchy to an xml file and can restore it.
I am having an issue with using BaseObject::InsertUnder(BaseObject * ) with existing BaseObjects in the scene.
Basically, I am trying to move existing polygon shapes / Null objects to new locations in the scenegraph.
After I call
obj- >InsertUnder( parentObj );
the object lives in 2 locations in the scenegraph, it's original location and the new spot.
When you select either of the same name objects, both are highlighted.
If you attempt to move the NULL objects above, c4d crashes. It only becomes stable, if I manually parent the 'old location' object to it's new location. Then, I am left with only one object in the proper location.
The other issue is after I call 'obj- >InsertUnder( parentObj );', and get 2 copies of obj,
if I attempt to traverse the scenegraph (w obj- >GetNext() / obj->GetDown ),
I have a circular loop in the graph.
###############
I am wondering if I need to issue a command to trigger the BaseDocument to refresh or flush the object from its original location.
I have tried this : **
obj- >InsertUnder( parentObj );
obj->Message(MSG_UPDATE);
doc->Message(MSG_UPDATE);
doc->SetChanged();
EventAdd(); **
with no luck.
I have also tried adding Undos :
**
StopAllThreads();
doc->StartUndo();
doc->AddUndo(UNDO_NEW, returnObj);//add an undo for the insertion
doc->EndUndo();**
but, no luck.
Is there something that I'm missing?
################
Please note, this is only w/ existing objects.
If I Alloc a new object, I am able to parent it with InsertObject / InsertUnder just fine.
Thanks for the Help!