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

    Get mouse wheel direction [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    6 Posts 0 Posters 530 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 30/03/2015 at 17:35, xxxxxxxx wrote:

      I've sifting through the mouse messages with:

      def Message(self, msg, result) :
          for each in msg:
              if each[0] == 1768452963:  
                  print 'mouse wheel: ', result
      

      This detects mouse wheel messages fine, but I can't find any data to indicate the direction the mouse wheel is scrolling (turning).

      How do you do that?

      Thanks,

      Chris

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

        On 31/03/2015 at 11:47, xxxxxxxx wrote:

        Hi Chris,
        I'm a bit confused about the message ID you are comparing to. Can you give me a hint, where you found that?
        And can you furthermore give me some context you are trying this (GeUserAre, ToolData,...)?

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

          On 31/03/2015 at 12:28, xxxxxxxx wrote:

          I found the message ID by staring at endless streams of message data printed to the console.
          It works fine so far.  It ignores all button presses, and only triggers on wheel scrolls, but there is no direction in the 'result' or anywhere else I can find.

          The context is 'gui.GeUserArea'.

          How do you get mouse wheel directions?

          Thanks.

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

            On 01/04/2015 at 06:42, xxxxxxxx wrote:

            Hi,

            in a GeUserArea you can use something like this:

                def InputEvent(self, msg) :
                    dev = msg[c4d.BFM_INPUT_DEVICE]
                    if dev == c4d.BFM_INPUT_MOUSE:
                        chn = msg[c4d.BFM_INPUT_CHANNEL]
                        if chn == c4d.BFM_INPUT_MOUSEWHEEL:
                            val = msg[c4d.BFM_INPUT_VALUE]
                            if val > 0:
                                print "dir up"
                            else:
                                print "dir down"
                    return True
            
            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              On 01/04/2015 at 09:55, xxxxxxxx wrote:

              Andreas,
              Now that's what I call support!

              Thanks,

              Chris

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

                On 01/04/2015 at 10:08, xxxxxxxx wrote:

                You are welcome 🙂

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