Hi,
below is a simple CommandData plugin with a submenu to invoke different actions.
This works fine if more than one of these plugins (with unique Plugin Ids ofc) are in one plugin folder.
But there is no menu if there is only one plugin present in the folder.
Is there a way to create such a menu with one plugin, while not registering each menu point as separate command?
best index
# encoding: utf-8
''' CommandData Plugin with Menu '''
import c4d
PLUGIN_ID = 12345678 # Unique Plugin Id
MENUID_CMD0 = 1000
MENUID_CMD1 = 1001
class MenuHandler(c4d.plugins.CommandData):
def Register(self):
return c4d.plugins.RegisterCommandPlugin(
id=PLUGIN_ID, str="Test", info=c4d.PLUGINFLAG_COMMAND_HOTKEY, icon=None, help=None, dat=MenuHandler())
def GetSubContainer(self, doc, submenu):
bc = c4d.BaseContainer()
bc.SetString(1, "Test")
bc.SetString(MENUID_CMD0, "Command 0")
bc.SetString(MENUID_CMD1, "Command 1")
submenu.InsData(0, bc)
return True
def ExecuteSubID(self, doc, id):
if id == MENUID_CMD0:
pass
if id == MENUID_CMD1:
pass
return True
def Execute(self, doc):
return True
if __name__ == "__main__":
MenuHandler().Register()