On 27/07/2015 at 06:22, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R16
Platform: Mac OSX ;
Language(s) : C++ ;
---------
Hi,
Inside GetVirtualObjects() I create a few objects.
One of them is a spline from two combined (joined) splines.
However, it does return a polygonobject with 24 points instead of the splineobject with 8 points, which I want.
I've tested it in an empty project, and there everything works fine.. :s
Here is my code for creating the Spline:
SplineObject* firstSpline = SplineObject::Alloc(4, SPLINETYPE_LINEAR);
if (!firstSpline) return nullptr;
firstSpline->SetParameter(SPLINEOBJECT_CLOSED, GeData(true), DESCFLAGS_SET_0);
firstSpline->InsertUnderLast(myNull);
SplineObject* secondSpline = SplineObject::Alloc(4, SPLINETYPE_LINEAR);
if (!secondSpline) return nullptr;
secondSpline->SetParameter(SPLINEOBJECT_CLOSED, GeData(true), DESCFLAGS_SET_0);
secondSpline->InsertUnderLast(myNull);
SplineObject* mySpline;
AutoAlloc<AtomArray> mySplineSelection;
if (!mySplineSelection) return nullptr;
mySplineSelection->Append(secondSpline);
mySplineSelection->Append(firstSpline);
ModelingCommandData cdMySpline;
cdMySpline.doc = hh->GetDocument();
cdMySpline.arr = mySplineSelection;
if (SendModelingCommand(MCOMMAND_JOIN, cdMySpline))
{
SplineObject::Free(firstSpline);
SplineObject::Free(secondSpline);
mySpline = static_cast<SplineObject*>(cdMySpline.result->GetIndex(0));
if (!mySpline) return nullptr;
mySpline->SetName("My_Spline");
mySpline->SetRelPos(Vector(0, -bc->GetFloat(SPLINE_HEIGHT) + bc->GetFloat(SPLINE_LENGTH) * 3 / 4, -bc->GetFloat(SPLINE_LENGTH) / 2));
mySpline->InsertUnderLast(myNull);
Vector* padrMySpline = mySpline->GetPointW();
if (!padrMySpline) return nullptr;
padrMySpline[0] = Vector(bc->GetFloat(SPLINE_WIDTH) / 2, 0, 0);
padrMySpline[1] = Vector(-bc->GetFloat(SPLINE_WIDTH) / 2, 0, 0);
padrMySpline[2] = Vector(-bc->GetFloat(SPLINE_WIDTH) / 2, -bc->GetFloat(SPLINE_HEIGHT), 0);
padrMySpline[3] = Vector(bc->GetFloat(SPLINE_WIDTH) / 2, -bc->GetFloat(SPLINE_HEIGHT), 0);
padrMySpline[4] = Vector(bc->GetFloat(SPLINE_WIDTH) / 2, 0, bc->GetFloat(SPLINE_LENGTH));
padrMySpline[5] = Vector(-bc->GetFloat(SPLINE_WIDTH) / 2, 0, bc->GetFloat(SPLINE_LENGTH));
padrMySpline[6] = Vector(-bc->GetFloat(SPLINE_WIDTH) / 2, -bc->GetFloat(SPLINE_HEIGHT), bc->GetFloat(SPLINE_LENGTH));
padrMySpline[7] = Vector(bc->GetFloat(SPLINE_WIDTH) / 2, -bc->GetFloat(SPLINE_HEIGHT), bc->GetFloat(SPLINE_LENGTH));
}
Does somebody know what could cause this?
I really have no idea :s
Thanks in advance for your help and time!