Last active
July 18, 2019 10:45
-
-
Save fwilleke80/f110061f9b4f14b95e32e0687364eea9 to your computer and use it in GitHub Desktop.
[C4D] A function that finds the name of a plugin by ID, and even works for builtin BaseList2D elements that are not registered plugins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def GetPluginName(pluginId, pluginType=c4d.PLUGINTYPE_ANY): | |
# Check if it's the ID of a registered plugin | |
foundPlugin = c4d.plugins.FindPlugin(pluginId, type=pluginType) | |
if foundPlugin is not None: | |
return foundPlugin.GetName() | |
# It's not the ID of a registered plugin, but might still be a builtin | |
# Try to allocate a new instance, and get type name | |
newObj = c4d.BaseList2D(pluginId) | |
if newObj is not None: | |
return str(type(newObj).__name__) | |
# No idea what this is | |
return "N/A" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment