Get PluginID from within CommandData plugin
-
Hi!
Is it possible to get the pluginID of a CommandData plugin from within the registered plugin class/instance?
I saw thatBasePlugin.GetID()
exists, but sadly it doesn't seem to work in a CommandData Plugin.
I am looking for something likeself.GetPluginID()
to retrieve the ID from within the running plugin.Thanks!
-
I am somewhat confused by this question.
Since you need the pluginID to register the CommandData, why would you want to obtain the pluginID from within the CommandData? I don't get it. -
Me neither. If you defined it as global constant, you can access it from wherever you want inside your code.
For foreign plugins, you can use GetFirstPlugin() and then iterate them and use GetID() to get their IDs.Like this:
import c4d if __name__=='__main__': p = c4d.plugins.GetFirstPlugin() while p: print "Plugin: ", p.GetName(),"/ ID: ", p.GetID() p = p.GetNext()
-
I am trying to register multiple plugins that are instances of the same class, but do slightly different stuff (in this case construct different menus). I am getting some external data that I would like to put in a dictionary with the plugin ID as keys. I could then get the correct data set for each plugin by comparing the pluginID from e.g. within execute with the pluginIDs in the dictionary. But for that I would need a way to retrieve the pluginID of the class instance whose execute function was called.
Edit: I figured out a way. I can pass the pluginID when initializing the plugin in the register function and save it as a class member in
__init__