THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/12/2011 at 18:04, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 12
Platform: Windows ;
Language(s) : C++ ;
---------
Hi,
Can anyone tell me why AutoAlloc does not work in this example:
//AutoAlloc<PolygonObject> mypoly(4,1); //This does not work!!?
PolygonObject *mypoly = PolygonObject::Alloc(4,1); if(!mypoly) return NULL; //This does work
//mypoly->ResizeObject(4,1); //Only used if changing an existing polygon
Vector *gp = mypoly->GetPointW();
gp[0] = Vector(-100,0,-100); // Place the first point here
gp[1] = Vector(-100,0,100); // Place the first point here
gp[2] = Vector(100,0,100); // Place the first point here
gp[3] = Vector(100,0,-100); // Place the fourth point here
doc->InsertObject(mypoly, NULL, NULL);
// Create the new poly based on the points
CPolygon *p = mypoly->GetPolygonW();
p->a = 0;
p->b = 1;
p->c = 2;
p->d = 3;
p->d = mypoly->GetPointCount()-1; //<---Creates a quad polygon
//p->a = mypoly->GetPointCount()-1; //<---Creates a tri polygon if desired
mypoly->Message(MSG_UPDATE);
EventAdd();
When I use Alloc it works just fine. And creates a new polygon.
But when I use AutoAlloc. The polygon stays stuck in memory. And won't insert into the OM.
I don't understand why that's happening.
-ScottA