THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/11/2012 at 02:50, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 12
Platform:
Language(s) : C++ ;
---------
Hi all,
I have written a generator object that implements GetVirtualObjects() to generate a new polygonobject based on the children of the generator. Everything works fine, except one problem:
When I load a saved scene with my generator in it, the generator is not updated until I select the child of my generator in edge mode.
Does anyone have any suggestions on how to resolve this? Here is my code, with some parts removed:
BaseObject* SC_Modifier::GetVirtualObjects(BaseObject* op, HierarchyHelp* hh){
op->NewDependenceList();
BaseObject* child=op->GetDown();
if(!child ){
return PolygonObject::Alloc(0,0);
}
ModelingCommandData cd;
cd.doc = op->GetDocument();
cd.op = child;
if (!SendModelingCommand(MCOMMAND_CURRENTSTATETOOBJECT, cd)) return FALSE;
BaseObject* tmp=(BaseObject* )(cd.result->GetIndex(0));
if(!tmp->IsInstanceOf(Opolygon)){
return PolygonObject::Alloc(0,0);
}
PolygonObject* mesh = (PolygonObject* ) tmp;
op->AddDependence(hh, child);
op->TouchDependenceList();
AutoAlloc<Modeling> mod;
mod->InitObject(mesh);
//Do some modifications to "mesh" here
mod->Commit();
mesh->Message(MSG_UPDATE);
return mesh;
}
Thanks
/Filip