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

    Qualifiers

    SDK Help
    0
    5
    439
    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 14/03/2013 at 00:35, xxxxxxxx wrote:

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

      ---------
      Hi Folks,
       
      I'm trying to get the SHIFT key while it's pressed for a GeUserArea, in the InputEvents member. I've tried all sorts of variations of the following:

         BaseContainer Qualifier = NULL;  
      if(GetInputState(BFM_INPUT_KEYBOARD, BFM_INPUT_CHANNEL, Qualifier))   
      {  
        GePrint("Qual called..");  // this sometimes prints  
        if(Qualifier.GetLong(BFM_INPUT_QUALIFIER) & QSHIFT)  
        {  
            GePrint("SHIFT pressed..");  // this never prints  
            return TRUE;  
        }  
      }
      

      I can get other keys to work - just none of the qualifiers. Where have I gone wrong?
       
      Cheers,
       
      WP.

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

        On 14/03/2013 at 06:24, xxxxxxxx wrote:

        Hi,

        Don't forget that qualifiers are only called in combination with the mouse.
        And you don't need to call GetInputState() because InputEvents() already gives you a message container for the event.
        So you can simply write:

        if (msg.GetLong(BFM_INPUT_QUALIFIER) & QSHIFT)
        {
            GePrint("SHIFT pressed");
            return TRUE;
        }
        

        Also, this line is frightening 😄:

        BaseContainer qualifier = NULL;
        

        The variable is allocated on the stack. It's not a pointer and you should never initialize it with NULL:

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

          On 14/03/2013 at 17:01, xxxxxxxx wrote:

          Thanks Yannick,
           
          however that code runs when either the mouse buttons, or any other keyboard button, is pressed. The shift key will be used in conjunction with the mouse (to select some items) but don't we need to be able to catch the shift key on it's own first?
           
          Thanks for the tip on the allocation of variables also. I wasn't aware of that. I've gone through and cleaned up a few of my NULL variables now - cheers!
           
          WP.

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

            On 14/03/2013 at 17:15, xxxxxxxx wrote:

            hey,

            have you tried c4d.BFM_ACTION_VALUE ? some time ago i had somewhat a similar
            problem (the user pressing enter in dialog). not sure if it helps, but  here is the 
            link to the posting.

            https://developers.maxon.net/forum/topic/6804/7552_gedialogmessage-return-value-&PID=31327#31327

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

              On 15/03/2013 at 01:30, xxxxxxxx wrote:

              Originally posted by xxxxxxxx

              however that code runs when either the mouse buttons, or any other keyboard button, is pressed.

              Take a look at SDKGradientArea::InputEvent() in the async.cpp example. You can test for qualifier input after the BFM_INPUT_MOUSELEFT test.

              I'm using a similar approach in SceneHookData::MouseInput(). The mouse button and qualifier key are reliably detected when clicking in the viewport.

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