Mouse hovering



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



  • 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



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



  • 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



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

    Hello,
    thank you, I'll check it.


Log in to reply