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

    HOW TO BIND KEYBOARD SHORTCUT TO PLUGIN

    Cinema 4D SDK
    python r21
    2
    3
    412
    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.
    • gheyretG
      gheyret
      last edited by

      Hi~
      How can i binding a keyboard shortcut to my CommandData plugin.
      I find c4d.gui.AddShortcut() in sdk , but it's add shortcut every time of start c4d.
      I'm not clear exactly what's wrong.

      here is the simple code:

      import c4d
      from c4d import gui, plugins
      
      class CMDData(plugins.CommandData):
          def Execute(self, doc):
              print "Hello Cinema"
              return True
      
      def set_shortcut():
          bc = c4d.BaseContainer()
          bc.SetInt32(c4d.SHORTCUT_PLUGINID, 121212)
          bc.SetLong(c4d.SHORTCUT_ADDRESS, 0)
          bc.SetLong(c4d.SHORTCUT_OPTIONMODE, 0)
          bc.SetLong(0,0)
          bc.SetLong(1,c4d.KEY_F11)
          return gui.AddShortcut(bc)
      
      
      if __name__=='__main__':
          plugins.RegisterCommandPlugin( 121212, "Shortcut Test", 0, None, "", CMDData())
          set_shortcut()
      
      

      www.boghma.com

      1 Reply Last reply Reply Quote 0
      • ManuelM
        Manuel
        last edited by

        hi,

        you should want to check if the shortcut already exist and is assign to your command plugins.
        You will found information on that thread

        If you have any more question, please ask.

        Cheers,
        Manuel

        MAXON SDK Specialist

        MAXON Registered Developer

        gheyretG 1 Reply Last reply Reply Quote 0
        • gheyretG
          gheyret @Manuel
          last edited by

          @m_magalhaes
          Now i know how to solve my problem!
          Thank you for your reply.
          Cheers!

          www.boghma.com

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