THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/06/2006 at 08:33, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 9.1+
Platform: Windows ; Mac ; Mac OSX ;
Language(s) : C++ ;
---------
Hi all,
i hope that someone can help me to fix this problem.
All work like a charm except when i render on viewport on a picture viewer.
BaseObject *Fast_Fur::GetVirtualObjects(PluginObject *op, HierarchyHelp *hh)
{
BaseDocument *doc=op->GetDocument();
BaseObject *ret = NULL;
BaseContainer *data=op->GetDataInstance();
BaseObject *geo=data->GetObjectLink(FAST_FUR_GEOMETRY,doc);
if (!geo) return NULL;
BaseTime tempo = doc->GetTime();
Real fps = doc->GetFps();
Real frame = tempo.Get()*fps;
//PolygonObject* cloned = (PolygonObject* ) (geo->GetClone(NULL,NULL));
//PolygonObject* cloned = ToPoly(geo->GetClone(COPY_NO_HIERARCHY,NULL));
PolygonObject* cloned = static_cast<PolygonObject*>( geo->GetClone(COPY_NO_HIERARCHY,NULL) );
if (!cloned) return NULL;
Vector* vettore=NULL;
// Get undeformed object
ModelingCommandData cd;
cd.doc = doc;
cd.op = cloned;
if (!SendModelingCommand(MCOMMAND_CURRENTSTATETOOBJECT, cd)) return NULL;
//PolygonObject* geopoly = static_cast<PolygonObject*>(cd.result->GetIndex(0));
AutoAlloc<PolygonObject> geopoly(static_cast<PolygonObject*>(cd.result->GetIndex(0)));
if (!geopoly) return NULL;
// Getting *Deformed* object at frame - 1
doc->AnimateObject(geo,BaseTime( (frame-1)/fps ),NULL);
BaseContainer bc;
cd.doc = doc;
cd.op = geo;
cd.bc=&bc;
bc.SetBool(MDATA_CURRENTSTATETOOBJECT_KEEPANIMATION,TRUE);
if (!SendModelingCommand(MCOMMAND_CURRENTSTATETOOBJECT, cd)) return NULL;
AutoAlloc<PolygonObject> Deformed_Object(static_cast<PolygonObject*>(cd.result->GetIndex(0) ));
if (!Deformed_Object) return FALSE;
Matrix Mres=Deformed_Object->GetMg();
Vector *deformed_padr=Deformed_Object->GetPoint();
LONG countpoint=Deformed_Object->GetPointCount();
vettore = (Vector* ) GeAlloc ( sizeof(Vector) * countpoint );
// store vertex coordinate
for (LONG i=0; i<countpoint; i++ ) {
vettore _=deformed_padr _*Mres;
}
// Get deformed vertex at current frame
doc->AnimateObject(geo,BaseTime( frame/fps ),NULL);
cd.doc = op->GetDocument();
cd.op = geo;
cd.bc=&bc;
bc.SetBool(MDATA_CURRENTSTATETOOBJECT_KEEPANIMATION,TRUE);
if (!SendModelingCommand(MCOMMAND_CURRENTSTATETOOBJECT, cd)) return NULL;
AutoAlloc<PolygonObject> Deformed_Object2(static_cast<PolygonObject*>(cd.result->GetIndex(0) ));
if (!Deformed_Object2) return FALSE;
Matrix Mres2=Deformed_Object2->GetMg();
Vector *deformed2_padr=Deformed_Object2->GetPoint();
for (LONG i=0; i<countpoint; i++ ) {
vettore _=vettore _- deformed2_padr _*Mres2 ;
}
Real lod;
Real fur_display = data->GetReal(FAST_FUR_DISPLAY);
lod=doc->GetLOD() * fur_display;
if(hh->GetVFlags()==20 ) lod=hh->GetLOD();
ret = GenerateFast_Fur( op, hh->GetThread(), lod, geopoly, Deformed_Object2, vettore, Mres);
if (!ret) goto Error;
ret->SetName(op->GetName());
PolygonObject::Free(cloned);
if (vettore) GeFree(vettore);
return ret;
Error:
if (ret) blDelete(ret);
if (vettore) GeFree(vettore);
return NULL;
}