Drawing crosshairs

  • On 16/01/2013 at 01:00, xxxxxxxx wrote:

    Hey guys,
    I got myself stuck again in something maybe not so easy.
    I'm trying to create crosshairs in the orthogonal views for my tool-plugin, corresponding to the mouse-position.
    In particular I have problems in my "Draw" method, as it seems to be the only place to draw lines into the viewport but only updates as something in the scenes changes: camera, objects, but not the mouseposition.
    The mouse position is another problem, as the "MouseInput" method only seems to kick in when one mouse button is clicked. 
    So while I got this hole process working with clicking and then dragging the mouse, I would really prefer not to click first. In a way this seems so be possible as the internal lighting-tool does something similar, or just selecting polygons or points of mesh results in a highlighting.
    Again a short recap what I'm doing:
    - checking the mouse position in the MouseInput method (sadly by clicking first), and forcing a redraw by using c4d.DrawViews(c4d.DA_ONLY_ACTIVE_VIEW|c4d.DA_NO_THREAD|c4d.DA_NO_ANIMATION)
    - drawing some lines in the viewport according to the retrieved mouse position in the Draw method
    Maybe there is an easier or more logical way someone could explain to me.

  • On 16/01/2013 at 02:59, xxxxxxxx wrote:

    Maybe you could use GetCursorInfo() which is called when the mouse is moved over the viewport and call DrawViews there?

  • On 16/01/2013 at 03:13, xxxxxxxx wrote:

    I honestly don't know why I overlooked that method.
    Thanks for the tip, works perfectly :)

Log in to reply