ToolData Detecting Right or Middle Mouse Clicks



  • On 03/03/2015 at 19:01, xxxxxxxx wrote:

    Hi,

    Is it possible to detect Middle Mouse clicks or Right Mouse clicks w/ a ToolData plugin? I've overloaded MouseInput and it gets called w/ LMB clicks, but it doesn't get called when I use RMB or MMB clicks.

      
        def MouseInput(self, doc, data, bd, win, msg) :   
            print "MouseInput()"   
    

    Thanks!

    Donovan



  • On 04/03/2015 at 06:24, xxxxxxxx wrote:

    Hi Donovan,

    I'm afraid middle and right clicks are already bound to Cinema 4D functions and this cannot be changed.



  • On 04/03/2015 at 15:42, xxxxxxxx wrote:

    Gotcha, I was hoping to allow for MMB-Drag to adjust brush size - but it looks like I need to use a Sculpt Brush to get access to that. Oh well.
    Thanks for the timely response!

    -Donovan



  • On 03/07/2017 at 15:34, xxxxxxxx wrote:

    Is there any way to do this with the C++ API? My initial tests tell me the answer is no unless I create a SculptBrush, but those must be initialized with polygon objects.



  • On 04/07/2017 at 03:16, xxxxxxxx wrote:

    I'm afraid there's no workaround with the C++ API for this limitation either. Both C++ and Python APIs have the same behavior.
    Right mouse buttons events are sent to SculptBrushToolData::MouseInput() but sculpt brushes have other limitations (you've already noticed these).



  • On 04/07/2017 at 13:37, xxxxxxxx wrote:

    It can be done. Just check for MSG_TOOL_ASK in your tools Message(...) method, then fill in the ToolAskMsgData structure.

    Set use_rightmouse and use_middlemouse to true and you will then get the calls in your MouseInput method.

    https://developers.maxon.net/docs/Cinema4DCPPSDK/html/struct_tool_ask_msg_data.html

    And for middle mouse button dragging to change a brush size you can look at ToolResizeData. There is even a nice example in the docs.

    https://developers.maxon.net/docs/Cinema4DCPPSDK/html/struct_tool_resize_data.html



  • On 04/07/2017 at 17:25, xxxxxxxx wrote:

    Yannick - Thank you for the reply! Kent, I was going to email you about this as you were the person whose brushes inspired me to want to make use of MMB & RMB. Thank you so much for the input, I really appreciate it.



  • On 05/07/2017 at 17:38, xxxxxxxx wrote:

    Oh man, ToolResizeData is a treasure trove! It even allows you to automatically process single clicks for selecting using "a->use_singleclick". I've coded my own click detection more than a few times now, glad to avoid doing that in the future.

    @Kent - the code example you linked to is incredibly useful.



  • On 10/07/2017 at 08:23, xxxxxxxx wrote:

    Is this possible in python as well?
    To be precise I would like to code a Right-Drag or Middle-Drag but all I get is the Popup Menu

    Is there a way to 'read' or 'set' the popup_allowed and resize_allowed C++ Data with python?



  • On 11/07/2017 at 02:16, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Is this possible in python as well?
    To be precise I would like to code a Right-Drag or Middle-Drag but all I get is the Popup Menu

    Is there a way to 'read' or 'set' the popup_allowed and resize_allowed C++ Data with python?

    I'm afraid this is not possible currently with the Python API.
    MSG_TOOL_ASK support will be added in a future release.



  • On 14/07/2017 at 00:47, xxxxxxxx wrote:

    Thank you Yannik. Looking forward to that release :)


Log in to reply