How to prevent handle drawing
-
Hi,
just out of interest: In an object plugin which uses the GetHandleCount() / GetHandle() / SetHandle() functions, is there a way to prevent C4D from drawing the standard handles? I want to draw my own handles, but the yellow standard handles are still visible behind mine.
Skipping the call to ObjectData::Draw() in my object's Draw() function doesn't seem to be a good option, as that also skips drawing of the object gizmo.Cheers,
Frank -
Hey @fwilleke80,
Thank you for reaching out to us. You can do this by properly overriding the handles draw pass. I assume you are either not drawing your handles in the handles draw pass or you are in the handles draw pass and then call the base implementation which then will draw over your stuff.
Please note that fully customizing the handles (mouse over, colors based on state , etc.) can be a bit of a hassle, for details please see this posting.
Cheers,
FerdinandResult
I did setup shop in the
DoubleCircle
code example:
Code
static const Vector g_color_red(1, 0, 0); // The color red. DRAWRESULT MyObjectHook::Draw(BaseObject* op, DRAWPASS drawpass, BaseDraw* viewport, BaseDrawHelp* help) { // We override the DRAWPASS::HANDLES pass to draw custom handles and set up our drawing matrix for the // #viewport and the drawing color. if (drawpass == DRAWPASS::HANDLES) { viewport->SetMatrix_Matrix(op, op->GetMg()); viewport->SetPen(g_color_red); // Now we draw our handles manually. When we comment this out, our object has no handles at all. HandleInfo handle; for (Int32 i = 0; i < GetHandleCount(op); i++) { GetHandle(op, i, handle); viewport->DrawHandle(handle.position, DRAWHANDLE::VERYBIG, NOCLIP_D); } // It is important to terminate the call chain here and NOT to invoke the base implementation. return DRAWRESULT::OK; } // For everything else we fall back to the base implementation. It is important to understand that for other draw // passes such as DRAWPASS::OBJECT (and usually also DRAWPASS::HIGHLIGHT) we must also call the base implementation // when we do custom drawing. return SUPER::Draw(op, drawpass, viewport, help); }
-
Ha, right, I should've thought of that ^_^
Thank you, it works!Cheers,
Frank