Get information about renderer plugin via Python
-
Hi
Is there any way to get some information about renderer plugins?
I want to get the version of the Octane plugin.Background:
All I have found was a script snipplet to get some information from a data block inside the C4D document.doc = c4d.documents.GetActiveDocument() bc = doc[ID_OCTANE_LIVEPLUGIN] print ("Octane version=",bc[c4d.SET_OCTANE_VERSION])
But this might not be the version that is currently used, it can be the version that was used to create/save the scene.
So how I can loop through all plugins loaded and get some information from the plugins like the version?
-
-
Hello @hSchoenberger,
Thank you for reaching out to us. Unfortunately, your question is off topic for the forum you have posted in. Please check the Forum Overview for an overview of the scope of the different forums.
As a result, your posting has been moved into General Talk.
Regarding your Posting
All questions about third parties APIs are off topic, you would have to ask OTOY if they somewhere store information about the version of Octane. There is no (publicly available) standardized interface with which plugins or specifically renderer plugins would store their version.
Cheers,
Ferdinand -
Hey @hSchoenberger ,
You can take a look at Renderer library, it has a method to get the version of support render engine.
Cheers~
DunHouimport c4d from Renderer import Octane def main() -> None: print(Octane.GetVersion()) if __name__ == '__main__': main() # Will return 13000200 for 2023.1.2.R2
-
@ferdinand said in Get information about renderer plugin via Python:
your question is off topic for the forum you have posted in.
Sorry, but this is a C4D SDK question!
It is NOT about the Octane SDK."How can I list all installed renderer plugins in C4D with their version?"
Plugins have to provide informations for RegisterVideoPostPlugin().
Like the name and a disklevel (which might or might not set to the same as the plugin version),
I though I can access this information.There is no (publicly available) standardized interface with which plugins or specifically renderer plugins would store their version.
Ok, I assumed that C4D works just like e.g. the plugin manager in Maya.
Which is able to list the version of each plugin.And as I have found some script for a probbaly old C4D versions, I assumed there is still a way to do that with the latest version.
plugins = c4d.plugins.GetFirstPlugin() while plugins: print("Name:", plugins.GetName()) print("ID:", plugins.GetID()) if plugins.GetPluginType() == c4d.PLUGINTYPE_SCENESAVER or plugins.GetPluginType() == c4d.PLUGINTYPE_SCENELOADER: print("Version:", plugins.GetFileVersion()) else: print("Version:", plugins.GetVersion()) print("\n") plugins = plugins.GetNext()
-
@Dunhou
I am sorry, but your module uses the exact same code as I have already posted as NOT working (for all cases).
You are reading the information from the document, not the installed plugin. -
Hello @hSchoenberger,
Sorry, but this is a C4D SDK question!
It is NOT about the Octane SDK."How can I list all installed renderer plugins in C4D with their version?"
Although you have put your sentence into quotes, that was not what you asked, your questions were:
Is there any way to get some information about renderer plugins?
I want to get the version of the Octane plugin.So how I can loop through all plugins loaded and get some information from the plugins like the version?
And I answered that: There is no public interface with which you could get the version of a plugin. And when plugins provide version information on their own, you must ask their vendors about that. You can access the flags a plugin has been registered with BasePlugin.GetInfo, the disk-level is in-accessible for you.
You can detect installed render engines by looping over all video post data plugins and check if they have
PLUGINFLAG_VIDEOPOST_ISRENDERER
set (this assumes that the to be detected render engine sets this flag on registration - which is usually unavoidable as you otherwise cannot hook in the render system of Cinema 4D, but there might be 'rogue' render engines out there which side step things).import c4d doc: c4d.documents.BaseDocument # The currently active document. op: c4d.BaseObject | None # The primary selected object in `doc`. Can be `None`. def main() -> None: """Called by Cinema 4D when the script is being executed. """ plugin: c4d.plugins.BasePlugin for plugin in c4d.plugins.FilterPluginList(c4d.PLUGINTYPE_VIDEOPOST, True): if (plugin.GetInfo() & c4d.PLUGINFLAG_VIDEOPOST_ISRENDERER): print (plugin.GetName()) if __name__ == '__main__': main()
# Example output for a vanilla installation. Physical Redshift Viewport Renderer
Cheers,
Ferdinand