Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Hi!
When I need the polygons of some object, I usually use the JOIN command to build a fresh cache, apply all the modifiers and include all the children. Works really good.
But I have a setup now, of a Plane with a Bend and a Jiggle to give some physics to the animation. When I apply the Join command to this plane, I get the Bend deformation but never the Jiggle. Is there anything different with the Jiggle to force it's deformation into the cache? I see there's an Enable Cache in it, but from the docs I think it's not what I'm looking for, and of course I tried it and made no difference for me.
This is how I join the object...
bool MakePolygon( BaseDocument* doc, BaseObject* src, PolygonObject* dst ) { auto clonedSource = static_cast<BaseObject*>( src->GetClone( COPYFLAGS_0, nullptr ) ); CHECK_RETURN_FALSE( clonedSource != nullptr ); // ignore object transform clonedSource->SetMg( Matrix() ); // The JOIN command will make editable, appy all modifiers, and join into a single polygon ModelingCommandData joinCommand; joinCommand.op = clonedSource; joinCommand.doc = doc; // cannot be null, wil not create object joinCommand.mode = MODELINGCOMMANDMODE_ALL; joinCommand.flags = MODELINGCOMMANDFLAGS_0; auto success = SendModelingCommand( MCOMMAND_CURRENTSTATETOOBJECT, joinCommand ); if( !success || joinCommand.result == nullptr ) { BaseObject::Free( clonedSource ); return false; } auto result = false; PolygonObject* joinedPolygon = static_cast<PolygonObject*>( joinCommand.result->GetIndex(0) ); if( joinedPolygon->IsInstanceOf( Opolygon ) ) { joinedPolygon->CopyTo( dst, COPYFLAGS_0, nullptr ); result = true; } BaseObject::Free( clonedSource ); PolygonObject::Free( joinedPolygon ); return result; }
@rsodre Passing the deform cache to the command bakewd the Jiggle deformation to my polygon.
if( src->GetDeformCache() != nullptr ) { src = src->GetDeformCache(); }
Does this sounds ok?
Using MCOMMAND_CURRENTSTATETOOBJECT instead of MCOMMAND_JOIN seems to have the same effect. What's the difference of using each one?
MCOMMAND_CURRENTSTATETOOBJECT
MCOMMAND_JOIN
Hello,
Regarding the question yes, using GetDeformCache is the way to go.
GetDeformCache
Using one object, there's not too much difference between MCOMMAND_CURRENTSTATETOOBJECT and MCOMMAND_JOIN as the MCOMMAND_JOIN is calling a MCOMMAND_CURRENTSTATETOOBJECT for each object.
The obvious part is that the Join command will create one object while the other will return a hierarchy. (if there are children)
Cheers, Manuel