On 03/01/2018 at 00:36, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R14
Platform: Windows ;
Language(s) : C++ ;
---------
Hi folks,
think I'm missing something simple here - how do I draw a SplineObject in an objectdata's Draw() function? Everything I try results in the base draw returning DRAWRESULT_SKIP.
// Init function - allocate class level variable
Bool My_Object::Init(GeListNode *node)
{
Spline = SplineObject::Alloc(2,SPLINETYPE_LINEAR);
Vector *pnt = Spline->GetPointW();
pnt[0] = Vector(0.0,100.0,0.0);
pnt[1] = Vector(0.0,100.0,-100.0);
Spline->Message(MSG_UPDATE);
return TRUE;
}
// Draw function
DRAWRESULT My_Object::Draw(BaseObject *op,DRAWPASS drawpass,BaseDraw *bd,BaseDrawHelp *bh)
{
if(drawpass == DRAWPASS_OBJECT)
{
Vector col = Vector(0.0,1.0,1.0);
bd->SetMatrix_Matrix(nullptr,bh->GetMg());
Spline->SetMg(bh->GetMg());
Spline->SetAbsPos(Vector(0.0,100.0,0.0));
DRAWRESULT res = bd->DrawObject(bh,Spline,DRAWOBJECT_FORCEPOINTS|DRAWOBJECT_USE_OBJECT_COLOR,drawpass,op,col);
if(res == DRAWRESULT_OK)
{
GePrint("Success!!"); // never called
}
else if(res == DRAWRESULT_SKIP)
{
GePrint("Skipped.."); // always called
}
}
return SUPER::Draw(op,drawpass,bd,bh);
}
// Spline is freed in plugin object's Free()
Always prints "Skipped..". Cheers,
WP.