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
    • Login

    Mouse hovering

    SDK Help
    0
    5
    463
    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
      Helper
      last edited by

      On 21/09/2016 at 07:04, xxxxxxxx wrote:

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

      ---------
      Hi,
      let's say I have class derived from ToolData. I'd like to implement some functionality when user is just hovering with mouse cursor over my objects. Is there any way how to do it?

      I tried to implement it in MouseInput function, but according to documentation it is called only if user clicks into scene and so it doesn't receive message BFM_INPUT_MOUSEMOVE.

      Structure of my MouseInput function is simple - looks like this:

      Bool MyToolPlugin::MouseInput(BaseDocument* doc, BaseContainer& data, BaseDraw* bd, EditorWindow* win, const BaseContainer& msg)  
      {  
        switch(msg.GetInt32(BFM_INPUT_CHANNEL)){  
            case BFM_INPUT_MOUSELEFT:  
                {  
                }  
                break;  
        
            case BFM_INPUT_MOUSERIGHT:  
                {  
                }  
                break;  
        
            case BFM_INPUT_MOUSEMOVE:  
                {  
                    // this is never called  
                }  
                break;  
        
            default:    return false;  
        }  
        
        return true;  
      }  
      

      Tool plugin is registered without any PLUGINFLAG (0).

      Thank you.

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

        On 22/09/2016 at 01:53, xxxxxxxx wrote:

        Hello,

        what kind of functionality do you want to implement? I'm not aware of any tool that "does something" just by hovering. A tool is typically used by placing the cursor somewhere in the viewport and then pressing the mouse button to start the actual interaction.

        But a tool can also implement GetCursorInfo(). This function is called frequently to define the currently used cursor. So this function might be used to "do something" but it is not intended to be used this way.

        best wishes,
        Sebastian

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

          On 22/09/2016 at 23:28, xxxxxxxx wrote:

          I'm porting LWCAD to Cinema. Big part of it is custom snapping system (we have custom primitives and custom geometry so cinema snapping cannot be used). So I need to make a preview of snapping while user is moving the cursor over objects.

          I'll try to use GetCursorInfo() but drawing something in this function just doesn't seems right.

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

            On 23/09/2016 at 01:18, xxxxxxxx wrote:

            Hello,

            to draw something in the viewport with a tool you have to implement ToolData::Draw(). Examples are the PickObjectTool or LiquidToolData. You could also create a custom snap mode based on SnapData as shown in the NullSnap example.

            best wishes,
            Sebastian

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

              On 23/09/2016 at 01:41, xxxxxxxx wrote:

              Hello,
              thank you, I'll check it.

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