Shortcuts



  • On 14/05/2017 at 09:00, xxxxxxxx wrote:

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

    ---------
    Hi,
    I was playing around with shortcut keys, and wrote the following to detect the used shortcut key for a given plugin.

      
      Int32 nbr = 10;  
      Int32 *idxarray = NewMemClear(Int32, nbr);  
      Int32 ret = FindShortcutsFromID(MY_PLUGIN_ID, idxarray, nbr);  
      
      for (Int32 i = 0; i < ret; i++)  
      {  
          BaseContainer bc = GetShortcut(idxarray[i]);  
      
          Int32 pluginID = bc.GetInt32(SHORTCUT_PLUGINID);  
          Int32 managerID = bc.GetInt32(SHORTCUT_ADDRESS);  
          Bool shortcutOptionMode = bc.GetBool(SHORTCUT_OPTIONMODE);  
      
          Int32 shortcutQualifier = bc.GetInt32(0);  
          Int32 shortcutKey = bc.GetInt32(1);  
      }  
        
      DeleteMem(idxarray);  
    

    But what about multi key shortcuts (example Q~E), only the first key can be obtained with above code. What if I have multiple commands, all assigned multi keys (Q~A, Q~E, Q~R, ...), how to know their "full" shortcut, since the above code will only return "Q" for all of them?



  • On 15/05/2017 at 10:25, xxxxxxxx wrote:

    Hi,

    for shortcut sequences you find the following keys and qualifiers with an offset of 10 in the container. So 10 and 11 for second qualifier and key, 20, 21 for third,... for up to ten keys.
    Unfortunately I found this documented only in the Python docs on AddShortcut(). Sorry for the inconvenience. We'll fix the docs.



  • On 15/05/2017 at 10:30, xxxxxxxx wrote:

    I tried to read out the container, but stopped at index 7. Should have known better to at least try until 10.
    Ah, never expected the Python docs would have more info than the C++ ones. As such, I didn't think of having a look.
    Thanks for pointing it out.


Log in to reply