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
    • Recent
    • Tags
    • Users
    • Login

    ToolData Detecting Right or Middle Mouse Clicks

    Scheduled Pinned Locked Moved PYTHON Development
    11 Posts 0 Posters 844 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 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

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

        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.

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

          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

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

            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.

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

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

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

                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/cpp/2023_2/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/cpp/2023_2/struct_tool_resize_data.html

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

                  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.

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

                    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.

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

                      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?

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

                        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.

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

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

                          Thank you Yannik. Looking forward to that release 🙂

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