Tuesday 18 November 2014

Accessing Octane plugin data from python in Poser

The OctaneRender for Poser plugin is largely implemented in python. You can write your own python code to tweak Octane settings using the following approach.  Use the following information at your own risk!  Remember to make a backup of your Poser scene prior to running python code which directly interacts with the plugin.

Loading the plugin in a PythonShell

Load the plugin via the following python code:
octanePlugin = __import__("OctaneRender for Poser")
Octane Data

The Octane scene data is stored in:
octanePlugin.Globals.m_SavedTreeInfo

Do not modify the above variable if the plugin Setup window is open.  If the above variable is {}, then the plugin has not yet been run for the current scene. After running the plugin, querying octanePlugin.Globals.m_SavedTreeInfo will return a large python dictionary.

To access a rendertarget setting (for example the Maxsamples settings in the kernel), use the following python code:
octanePlugin.Globals.m_SavedTreeInfo['rendertarget']['kernel']['maxsamples']['value']

You can change the Maxsamples with:
octanePlugin.Globals.m_SavedTreeInfo['rendertarget']['kernel']['maxsamples']['value'] = 100
Remember, only modify values if the setup window is closed.

OctaneCommands

Close the Viewport
octanePlugin.UiManager.GetViewportForm().CloseWindow()
Close the Setup Window
octanePlugin.UiManager.GetSetupForm().CloseWindow()

No comments:

Post a Comment