Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
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()
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
@m_magalhaes Now i know how to solve my problem! Thank you for your reply. Cheers!