THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/09/2011 at 08:42, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R12
Platform: Windows ;
Language(s) : C++ ;
---------
I have a generator plugin. In GetVirtualObjects I want to do a CurrentStateToObject on a sweep nurbs, because I need a polygon object to work with. Here's the code I'm using:
BaseObject *res = NULL, *newop = NULL;
ModelingCommandData cd;
BaseContainer bcmcd;
AutoAlloc<BaseDocument>tdoc; // temporary document
newop = static_cast<BaseObject*>(lnk->GetClone(COPYFLAGS_0, NULL)); // 'lnk' is a sweep nurbs object
tdoc->InsertObject(newop, NULL, NULL, FALSE);
cd.doc = tdoc;
cd.op = newop;
cd.mode = MODELINGCOMMANDMODE_ALL;
bcmcd.SetBool(MDATA_CURRENTSTATETOOBJECT_INHERITANCE, TRUE);
bcmcd.SetBool(MDATA_CURRENTSTATETOOBJECT_KEEPANIMATION, TRUE);
cd.bc = &bcmcd;
if(!SendModelingCommand(MCOMMAND_CURRENTSTATETOOBJECT, cd))
return NULL;
res = static_cast<BaseObject*>(cd.result->GetIndex(0));
This all works fine, as long as the sweep nurbs has a contour spline and a path spline in the usual way. However, if I put a Mograph tracer object in as the path spline, generating splines using a particle emitter, it fails. Instead of returning a polygon object, for some reason CSTO returns a null object with just the contour spline in it. That's even though there's a perfectly good object in the viewport, and if I do a CSTO on it manually using the Objects menu in the OM, it returns the polygon object I would expect.
I'm obviously doing something wrong but I can't see what. Can anyone see why this isn't working? I've tried doing a CSTO on the tracer object first then inserting it back into the temporary document, but all I get is a crash.
Would really appreciate some help with this one.
Thanks,
Steve