thanks for looking into it
BaseObject *wobbler::GetVirtualObjects(BaseObject *op, HierarchyHelp *hh)
{
BaseDocument* doc = op->GetDocument();
BaseContainer* bc = op->GetDataInstance();
ModelingCommandData cd;
Bool dirty;
Vector *pNormals = NULL;
Vector polyNormal = (Vector)0;
const CPolygon* pol = NULL;
Vector tempVec = (Vector)0;
Float time = doc->GetTime().GetFrame(doc->GetFps());
if ((speed).GetLength()!=0)
bc->SetFloat(ZEIT,time);
Vector *padr;
Float arr[12];
InitFbm(arr,10,0.1,0.5);
BaseObject* main = NULL;
BaseObject* group = NULL;
PolygonObject* clone = NULL;
BaseObject* child = NULL;
BaseContainer cbc;
if (smooth)
{
main = BaseObject::Alloc(Osds);
main->SetParameter(SDSOBJECT_SUBEDITOR_CM,GeData(subdive),DESCFLAGS_SET::NONE);
main->SetParameter(SDSOBJECT_SUBRAY_CM,GeData(subdivr),DESCFLAGS_SET::NONE);
group = BaseObject::Alloc(Onull);
if (!group) goto Error;
group->InsertUnderLast(main);
}
else
{
main = BaseObject::Alloc(Onull);
}
if (!main) goto Error;
child = op->GetDown();
if (!child) goto Error;
op->NewDependenceList();
while(child)
{
op->AddDependence(hh,child);
child = child->GetNext();
}
dirty = op->CheckCache(hh) || op->IsDirty(DIRTYFLAGS::MATRIX|DIRTYFLAGS::DATA|DIRTYFLAGS::CHILDREN);
dirty = dirty || !op->CompareDependenceList();
if (!dirty)
{
blDelete(main);
op->TouchDependenceList();
return op->GetCache(hh);
}
if (checkEllo()) GePrint("Rebuilding wobbler..."_s);
child = op->GetDown();
while(child)
{
clone = static_cast<PolygonObject*>(op->GetAndCheckHierarchyClone(hh,child,HIERARCHYCLONEFLAGS::ASPOLY,&dirty,0,false));
if (clone)
{
if (clone->GetType()==Opolygon)
{
cd.doc = doc;
cd.op = clone;
cbc.SetBool(MDATA_SUBDIVIDE_HYPER, true);
cbc.SetFloat(MDATA_SUBDIVIDE_ANGLE, 90);
cbc.SetInt32(MDATA_SUBDIVIDE_SUB, sub);
cd.bc = &cbc;
if(SendModelingCommand(MCOMMAND_SUBDIVIDE, cd))
{
pNormals = GetVertexNormals(clone);
padr = clone->GetPointW();
pol = clone->GetPolygonR();
for (int i=0;i<clone->GetPointCount();i++)
{
//polyNormal = normalRotation(padr[i], pNormals[i], 0,0,padr,pol,i,false);
tempVec = padr[i];
Float rmf1 = RidgedMultifractal(arr, Vector(seed + 1) + padr[i]*factor.x + time*speed + op->GetRelPos()*bypos.x, 20, 0, 1)*strength.x;
Float rmf2 = RidgedMultifractal(arr, Vector(seed + 2) + padr[i]*factor.y + time*speed + op->GetRelPos()*bypos.y, 20, 0, 1)*strength.y;
Float rmf3 = RidgedMultifractal(arr, Vector(seed + 3) + padr[i]*factor.z + time*speed + op->GetRelPos()*bypos.z, 20, 0, 1)*strength.z;
tempVec += Vector(rmf1,rmf2,rmf3);
tempVec += pNormals[i] * Turbulence(Vector(factor.x * (seed + tempVec.x*normalScale)) + time*speed,20,0)*normalStrength;
tempVec += pNormals[i] * Turbulence(Vector(factor.y * (seed + tempVec.y*normalScale)) + time*speed,20,0)*normalStrength;
tempVec += pNormals[i] * Turbulence(Vector(factor.z * (seed + tempVec.z*normalScale)) + time*speed,20,0)*normalStrength;
padr[i]=tempVec;
}
if (pNormals) DeleteMem(pNormals);
}
if (smooth)
clone->InsertUnderLast(group);
else
clone->InsertUnderLast(main);
}
else
{
blDelete(clone);
}
}
child = child->GetNext();
}
op->NewDependenceList();
child = op->GetDown();
while(child)
{
op->AddDependence(hh,child);
child = child->GetNext();
}
if (op != nullptr)
{
op->TouchDependenceList();
}
return main;
Error:
if (group) blDelete(group);
if (main) blDelete(main);
return NULL;
}
edit: still happens