Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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
    • Login

    Drawing crosshairs

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 329 Views
    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.
    • H Offline
      Helper
      last edited by

      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.
      Thanx
      Phil

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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?

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          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 🙂
          Phil

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