DRAWHANDLE_CUSTOM?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 18/08/2012 at 17:12, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   13 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hey gang.
    Here's one I haven't seen addressed yet.
    How the heck do we create our own custom handle shapes?
    There's a flag called DRAWHANDLE_CUSTOM in the SDK. But absolutely no mention on how to actually use it.

    I've been playing around with the DoubleCircle example in the SDK. And I've been able to add things like lines and highlight color changing by adding a Draw() method to it:

    DRAWRESULT DoubleCircleData::Draw(BaseObject *op, DRAWPASS drawpass, BaseDraw *bd, BaseDrawHelp *bh)  
    {  
      LONG hitid, i;  
      Matrix mx;  
      HandleInfo info;  
      
      if(drawpass != DRAWPASS_HANDLES)                      //Only draw the handles in this plugin  
      return DRAWRESULT_SKIP;  
      
      hitid = op->GetHighlightHandle(bd);                      //Check if the user is hovering over the handle  
      bd->SetMatrix_Matrix(op, bh->GetMg());                        //Converts coordinates into global space  
      bd->SetPen(GetViewColor(VIEWCOLOR_ACTIVEPOINT));              //Sets the color of the handle to this color  
      
      for(i = 0; i < HANDLES; i++)  
      {  
          if(i == hitid)                                             //If the handle is hit  
              bd->SetPen(GetViewColor(VIEWCOLOR_SELECTION_PREVIEW)); //Draw it in a different color so we can tell it's been hit  
      
          GetHandle(op, i, info);                                    //Get the handle's info from the GetHandle function  
          bd->DrawHandle(info.position, DRAWHANDLE_BIG, 0);          //Use the info to create a big ball type looking handle  
      }  
      
      //We only have handles at this point...This next code draws the lines  
      GetHandle(op, 0, info);                                        //Get the first handle and it's info  
      bd->DrawLine(info.position, Vector(0.0), 0);                   //Draws a line from the center of the object to the handle  
      GetHandle(op, 1, info);                                        //Get the second handle and it's info  
      bd->DrawLine(info.position, Vector(0.0), 0);                   //Draws a line from the center of the object to the handle  
      
      return DRAWRESULT_OK;  
    }
    

    It would be very cool If I could replace DRAWHANDLE_BIG with DRAWHANDLE_CUSTOM.
    But the SDK never tells us what it requires.

    -ScottA




  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/08/2012 at 07:56, xxxxxxxx wrote:

    Hei Scott,

    have you actually tried replacing _BIG with _CUSTOM? :)
    I'm at the beach and cannot try it out now. But I could imagine that it doesn't actually
    draw a handle into the viewport, but makes the passed point available to handle-detection.

    -Nik



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/08/2012 at 08:34, xxxxxxxx wrote:

    At the beach huh?
    Cowabunga dude...Surfs up!
    Watch out for sharks! Wink

    Yeah I've tried it. But I don't know how to pass another object as the new handle object.
    I don't even know if we can pass an object, array of points, whatever..?
    I can't find any information about doing this at all in the SDK.

    -ScottA



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 24/08/2012 at 00:48, xxxxxxxx wrote:

    Hi,

    I asked the developers and here's the answer I got: if DRAWHANDLE_CUSTOM is specified the handle point is drawn with the size set by BaseDraw::SetPointSize(). So there's no way to pass an object, array of points etc.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 24/08/2012 at 08:05, xxxxxxxx wrote:

    In other words, it is just a 'custom' handle size specification.  Gotcha. :)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 24/08/2012 at 08:19, xxxxxxxx wrote:

    Thanks for asking them Yannick.
    Kind of a bummer that it's a size only flag. But at least I know what that flag is used for now.

    -ScottA


Log in to reply