On 03/01/2018 at 00:36, xxxxxxxx wrote:
Cinema 4D Version: R14
Platform: Windows ;
Language(s) : C++ ;
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 = Vector(0.0,100.0,0.0);
pnt = Vector(0.0,100.0,-100.0);
// 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);
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
// Spline is freed in plugin object's Free()
Always prints "Skipped..". Cheers,
On 03/01/2018 at 01:58, xxxxxxxx wrote:
You must retrieve LineObject. A good read for you https://c4dprogramming.wordpress.com/2012/11/21/drawing-a-spline-in-the-viewport/
Hope it's help
On 03/01/2018 at 02:21, xxxxxxxx wrote:
I missed the LineObject. Page bookmarked. Thanks gr4ph0s!
On 03/01/2018 at 07:47, xxxxxxxx wrote:
Thanks gr4ph0s for getting here fast and precise!
As a side note, consider that the SplineObject::GetLineObject() has changed compared to that used in the blog post and appreciable changes in terms of spline curve tessellation can be obtained with LOD ranging between 0.1 and 1.
On 03/01/2018 at 23:25, xxxxxxxx wrote:
could you explain the spline curve tessellation a little more?
On 04/01/2018 at 02:18, xxxxxxxx wrote:
Hi WickedP, thanks for writing back.
Since we need to represent lines rather than pure spline curves using the ObjectData::Draw() function, we need to approximate the real curve to a sequence of segments whose distance from the curve represent the level of approximation desired. Using the LOD parameter you're able to change this approximation where a value of 0 basically create straight lines among the points building the spline whilst greater values create smaller line pieces approximating better and better the spline itself.
On 04/01/2018 at 02:40, xxxxxxxx wrote:
So it's to do with the quality of the curve line draw between points? Assuming there's a curve between points, a value closer to 1.0 draws a more precise curve line?
On 04/01/2018 at 05:18, xxxxxxxx wrote:
On 04/01/2018 at 13:32, xxxxxxxx wrote: