Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Shortcuts for buttons from gui.GeDialog

    Cinema 4D SDK
    r20 python
    3
    4
    1.3k
    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.
    • FlavioDinizF
      FlavioDiniz
      last edited by FlavioDiniz

      Hello!
      I'm so happy with the C4D python API, it allows to create scripts, plugins, interfaces, menus, etc, very easily!

      My question is:
      Is it possible to assign shortcuts to these buttons from gui.GeDialog ?
      alt text

      If not, I think I could achieve that by writing separate scripts to perform the same action the button does, so it appear in the customize commands window.

      Thanks in advance!

      Flavio

      1 Reply Last reply Reply Quote 0
      • C4DSC
        C4DS
        last edited by

        You cannot assign shortcuts to buttons.
        An alternative solution (which I have used in the past) is to create a CommandData plugin for each button, and let the CommandData::Execute call the button. Or instead of a CommandData plugin you could also create a separate script for each button.
        Either way, these can then be assigned a shortcut.

        1 Reply Last reply Reply Quote 3
        • M
          m_adam
          last edited by

          Hi @FlavioDiniz, as C4DS said the correct way to handle shortcut is to create a command for them.

          Beside of that in this CommandData.Execute you could do two things:

          • Implement the action (only possible if you don't need any data stored in the GUI, otherwise, your GUI have to expose them in any kind of form).
          • Send a CoreMesage to the dialog, then in your dialog, catch this message and do the logic (The GUI have to be open).

          With that's said, you could also listen for Message BFM_INPUT_DEVICE and especially BFM_INPUT_KEYBOARD. Then react to the keyboard, as it's explained in the Mouse and Keyboard Interaction C++ Manual.
          But in this case, it will not show up in the customize commands window.

          If you have any question please let me know!
          Cheers,
          Maxime.

          MAXON SDK Specialist

          Development Blog, MAXON Registered Developer

          FlavioDinizF 1 Reply Last reply Reply Quote 3
          • FlavioDinizF
            FlavioDiniz @m_adam
            last edited by FlavioDiniz

            Thanks a lot @C4DS @m_adam !
            So I think it's better to create separate CommandDataplugins to perform the same action of each button, it's less complicated and allow the user to change the keyboard shortcuts and exclude the need of the GUI being always open.

            Although the m_adam suggestions may be useful for other plugins ideas I have. I'll try it later.
            Thanksss !

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