Calling CommandData by name
rsodre last edited by r_gigante
I'm writing a C++ CommandData plugin that I call from Python with
Is there any way to give it a name and call it by the name? I think
GetScriptName()should do it but there's no info on how to use the name.
as far as I understand, you would like to be able to do a CallCommand(ID_MYCOMMANDPLUGIN) instead of a call with the numeric value, right?
Unfortunately this is not possible, as the symbol parser does not scan the plugins. So you will need to define that ID within your Python code.
rsodre last edited by
I would like to call it by the actual plugin name name, like
I'll try to make some python shortcut functions that do that.
you can ignore
GetScriptName(), it is used internally to construct strings (or rather IDs) to refer to the online help for example.
While it is not possible to call a command by name, you can for example scan the list of plugins for the name you are looking for, resulting in the ID you need to call the command.
Roughly like so:
plugins = c4d.plugins.FilterPluginList(c4d.PLUGINTYPE_COMMAND, True) for plugin in plugins: if plugin.GetName() == "My Plugin Name": print plugin.GetFilename(), ": ", plugin.GetID()
just want to ask, if can consider this topic as solved.