Generator object not updating
-
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 -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/11/2012 at 06:50, xxxxxxxx wrote:
You should be doing CURRENTSTATETOOBJECT in a dummy document (do a search here about this).
Otherwise, not sure. You might want to check all of your returns to see if any are being hit before the last one when you load the saved document.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/11/2012 at 00:33, xxxxxxxx wrote:
Thanks for your input! I tried your suggestions but the problem remains. I'll keep bughunting and post here again if I find a solution.
/Filip