Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Register
    • Register
    • Login

    How to prevent handle drawing

    Cinema 4D SDK
    c++
    2
    3
    555
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • fwilleke80F
      fwilleke80
      last edited by

      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

      www.frankwilleke.de
      Only asking personal code questions here.

      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand @fwilleke80
        last edited by ferdinand

        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,
        Ferdinand

        Result

        I did setup shop in the DoubleCircle code example:
        b.png

        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);
        }
        

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 0
        • fwilleke80F
          fwilleke80
          last edited by

          Ha, right, I should've thought of that ^_^
          Thank you, it works!

          Cheers,
          Frank

          www.frankwilleke.de
          Only asking personal code questions here.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post