|
Katana Plug-in APIs 0.1
|
The base class for the render plug-in which takes a Katana recipe and converts it into the renderer's language. More...
#include <RenderBase.h>
Public Member Functions | |
| RenderBase (Foundry::Katana::FnScenegraphIterator rootIterator, FnAttribute::GroupAttribute arguments) | |
| virtual int | setup () |
| virtual int | cleanup () |
| virtual void | setRootIterator (Foundry::Katana::FnScenegraphIterator rootIterator) |
| virtual int | start ()=0 |
| virtual int | pause () |
| virtual int | resume () |
| virtual int | stop () |
| virtual int | startLiveEditing () |
| virtual int | stopLiveEditing () |
| virtual int | processControlCommand (const std::string &command) |
| virtual int | queueDataUpdates (FnAttribute::GroupAttribute updateAttribute) |
| virtual int | applyPendingDataUpdates () |
| virtual bool | hasPendingDataUpdates () const |
| virtual void | configureDiskRenderOutputProcess (DiskRenderOutputProcess &diskRenderOutputProcess, const std::string &outputName, const std::string &outputPath, const std::string &renderMethodName, const float &frameTime) const |
Protected Member Functions | |
| Foundry::Katana::FnScenegraphIterator | getRootIterator () const |
| std::string | getRenderMethodName () const |
| std::string | findArgument (const std::string &argumentName, const std::string &defaultValue="") const |
| bool | applyRenderThreadsOverride (int &numberOfRenderThreads) const |
| std::string | getKatanaBasePath () const |
| std::string | getKatanaTempDirectory () const |
| std::string | getKatanaHost () const |
| float | getRenderTime () const |
| bool | useRenderPassID () const |
| std::string | getRenderOutputFile () const |
| bool | isExpandProceduralActive (bool defaultValue=false) const |
| std::string | getRenderPluginDirectory () const |
| std::string | getEnvironmentVariable (const std::string &name) const |
| template<typename T , typename A > | |
| T | getAttrValue (const FnAttribute::Attribute &attr, const T &defaultValue) const |
| std::string | getStringAttrValue (const FnAttribute::Attribute &attr, const std::string &defaultValue="") const |
The base class for the render plug-in which takes a Katana recipe and converts it into the renderer's language.
A render plug-in represents a single render process (for a single frame) where the plug-in is instantiated when a render is launched and destroyed when the render is complete or cancelled. The Katana recipe is presented to the render plug-in in the form of a FnScenegraphIterator which allows traversing the scene graph in a deferred manner. The root scene graph iterator is passed to the plug-in's constructor where it is accessible anywhere in the plug-in through Render::RenderBase::getRootIterator. The render arguments are also passed to the constructor but we recommend using the wrapper functions to retrieve the standard arguments.
The plug-in has to extend the Render abstract class and register itself using the DEFINE_RENDER_PLUGIN(class) and REGISTER_PLUGIN(class, name, major_version, minor_version) macros. This will ensure the plug-in is exposed in the UI by its registered name as well as making it available to Katana's render process.
| Foundry::Katana::Render::RenderBase::RenderBase | ( | Foundry::Katana::FnScenegraphIterator | rootIterator, |
| FnAttribute::GroupAttribute | arguments | ||
| ) | [inline] |
The render plug-in class is instantiated by the renderboot process which is launched when a render is started through the UI or using the RenderManager.StartRender script function.
| rootIterator | The root FnScenegraphIterator used to traverse the scene graph produced by a Katana recipe |
| arguments | Render arguments (e.g. render time) |
| virtual int Foundry::Katana::Render::RenderBase::applyPendingDataUpdates | ( | ) | [inline, virtual] |
Apply one or more live data updates which have been processed by queueDataUpdates. This provides an opportunity to process and queue live update attributes in the update thread and then flush them in the main thread.
This function is called if hasPendingDataUpdates returns true.
Reimplemented in CompanyName::Katana::TemplateRenderPlugin.
| bool Foundry::Katana::Render::RenderBase::applyRenderThreadsOverride | ( | int & | numberOfRenderThreads | ) | const [protected] |
Update the number of render threads if a 'threads' argument is passed as a render argument. The thread value is passed to the render process in the following cases:
| numberOfRenderThreads | The render thread variable which is subject to the thread override |
| virtual int Foundry::Katana::Render::RenderBase::cleanup | ( | ) | [inline, virtual] |
Clean up any resources that the render plug-in has allocated.
| virtual void Foundry::Katana::Render::RenderBase::configureDiskRenderOutputProcess | ( | DiskRenderOutputProcess & | diskRenderOutputProcess, |
| const std::string & | outputName, | ||
| const std::string & | outputPath, | ||
| const std::string & | renderMethodName, | ||
| const float & | frameTime | ||
| ) | const [inline, virtual] |
Provide Katana with information on how to process a given render output which has been defined in a Katana scene using the RenderOutputDefine node. This is only applicable during disk render where the function is called for each render output (port) on the render node.
| diskRenderOutputProcess | Defines the render action for a given render output as well as pre- and post-commands used in the render process. |
| outputName | The name of the render output (as defined in the corresponding RenderOutputDefine node). |
| outputPath | The target location for the render output. |
| renderMethodName | The render method used to launch the render. |
| frameTime | The current frame time. |
Reimplemented in ProfilingMockRenderer::RenderPlugin, and CompanyName::Katana::TemplateRenderPlugin.
| std::string Foundry::Katana::Render::RenderBase::findArgument | ( | const std::string & | argumentName, |
| const std::string & | defaultValue = "" |
||
| ) | const [protected] |
Retrieve a render argument by name. The standard render arguments are accessible through explicit functions but custom live render arguments which have been advertised in the live render tab using the startConfiguration policy type.
| argumentName | The name of the render argument that should be retrieved |
| defaultValue | The value to return in case the argument doesn't exist |
| T Foundry::Katana::Render::RenderBase::getAttrValue | ( | const FnAttribute::Attribute & | attr, |
| const T & | defaultValue | ||
| ) | const [inline, protected] |
A helper function which retrieves and converts the value of an Attribute to a desired standard type. This is useful for instance when collecting custom rendererSettings values from the render outputs, e.g.:
int mySettings = getAttrValue<int, IntAttribute>(output.rendererSettings["mySettings"], 0);
| attr | The Attribute that we want to retrieve the value from |
| defaultValue | Default value if the attribute is not valid |
| std::string Foundry::Katana::Render::RenderBase::getEnvironmentVariable | ( | const std::string & | name | ) | const [protected] |
Looks up and returns the value of an environment variable by name.
| std::string Foundry::Katana::Render::RenderBase::getKatanaBasePath | ( | ) | const [inline, protected] |
| std::string Foundry::Katana::Render::RenderBase::getKatanaHost | ( | ) | const [inline, protected] |
Get the host and port of Katana's listener which is started when Katana is launched in UI mode. The listener is used to retrieve image and id data from the renderer plug-in.
| std::string Foundry::Katana::Render::RenderBase::getKatanaTempDirectory | ( | ) | const [inline, protected] |
Get the name of the temporary directory Katana creates at startup which is used throughout the session.
| std::string Foundry::Katana::Render::RenderBase::getRenderMethodName | ( | ) | const [protected] |
Retrieve the render method used to launch the render from the render arguments. The method name is passed to the RenderManager.StartRender function where the list of available methods is declared by RendererInfo::RendererInfoBase::fillRenderMethods in UI mode, and by configureBatchRenderMethod in batch mode, when creating debug outputs, and when rendering dependencies.
| std::string Foundry::Katana::Render::RenderBase::getRenderOutputFile | ( | ) | const [inline, protected] |
Returns the name of a file which Katana expects the render plug-in to create and populate with scene description data and/or debug information. See "Generating a render debug output" in the Katana Developer Guide.
| std::string Foundry::Katana::Render::RenderBase::getRenderPluginDirectory | ( | ) | const [inline, protected] |
Returns the directory name where the render plug-in resides on disk.
| float Foundry::Katana::Render::RenderBase::getRenderTime | ( | ) | const [protected] |
Get the render time which is either a value retrieved from the timeline (UI mode), or a single frame from the interval provided by the -t command line argument when launching a batch render.
| Foundry::Katana::FnScenegraphIterator Foundry::Katana::Render::RenderBase::getRootIterator | ( | ) | const [inline, protected] |
The scene graph iterator is used to traverse the scene graph and author data to the renderer based on the scene graph type and attributes. The root iterator provides a starting point for the traversal as it contains the entire scene graph as well as any global scene attributes which are by convention assigned to the root location.
| std::string Foundry::Katana::Render::RenderBase::getStringAttrValue | ( | const FnAttribute::Attribute & | attr, |
| const std::string & | defaultValue = "" |
||
| ) | const [inline, protected] |
A convenience function for retrieving the value of StringAttribute
| attr | The StringAttribute that we want to retrieve the value from |
| defaultValue | Default string value if the attribute is not valid |
| virtual bool Foundry::Katana::Render::RenderBase::hasPendingDataUpdates | ( | ) | const [inline, virtual] |
Inform the render process whether it has to flush and apply live updates.
Reimplemented in CompanyName::Katana::TemplateRenderPlugin.
| bool Foundry::Katana::Render::RenderBase::isExpandProceduralActive | ( | bool | defaultValue = false | ) | const [protected] |
This function is used in conjunction with getRenderOutputFile where if a render output file is expected to be generated, and if the renderer supports recursive procedurals, then this determines whether the procedurals should be expanded or not.
| virtual int Foundry::Katana::Render::RenderBase::pause | ( | ) | [inline, virtual] |
Interrupt and pause the render process but does not terminate it.
Reimplemented in CompanyName::Katana::TemplateRenderPlugin.
| virtual int Foundry::Katana::Render::RenderBase::processControlCommand | ( | const std::string & | command | ) | [inline, virtual] |
Process a custom live render control command which has been triggered by the user in the live update tab.
| command | Live render control command |
Reimplemented in CompanyName::Katana::TemplateRenderPlugin.
| virtual int Foundry::Katana::Render::RenderBase::queueDataUpdates | ( | FnAttribute::GroupAttribute | updateAttribute | ) | [inline, virtual] |
Process a data update during live render. The update is based on an attribute convention where an update for a single scene graph location is encapsulated by a GroupAttribute. Each attribute update contains the following:
| updateAttribute | A group attribute containing one or more update attributes. |
Reimplemented in CompanyName::Katana::TemplateRenderPlugin.
| virtual int Foundry::Katana::Render::RenderBase::resume | ( | ) | [inline, virtual] |
Resume a paused render.
Reimplemented in CompanyName::Katana::TemplateRenderPlugin.
| virtual void Foundry::Katana::Render::RenderBase::setRootIterator | ( | Foundry::Katana::FnScenegraphIterator | rootIterator | ) | [inline, virtual] |
Set the root FnScenegraphIterator to use to traverse the Katana scene graph to the given scene graph iterator.
| rootIterator | The root FnScenegraphIterator to use. |
| virtual int Foundry::Katana::Render::RenderBase::setup | ( | ) | [inline, virtual] |
Set up the render plug-in so that it is ready to perform one or more renders.
| virtual int Foundry::Katana::Render::RenderBase::start | ( | ) | [pure virtual] |
Start a render by traversing the scene graph using FnScenegraphIterator and interpret the locations and attributes into the renderer's language. This function is called at the start of each frame to be rendered. It is possible that this will be called multiple times during the lifetime of the plug-in.
Implemented in ProfilingMockRenderer::RenderPlugin, and CompanyName::Katana::TemplateRenderPlugin.
| virtual int Foundry::Katana::Render::RenderBase::startLiveEditing | ( | ) | [inline, virtual] |
Start the live render process. Data updates and control commands will follow.
Reimplemented in CompanyName::Katana::TemplateRenderPlugin.
| virtual int Foundry::Katana::Render::RenderBase::stop | ( | ) | [inline, virtual] |
Called at the end of each frame that is rendered. It is possible that this will be called multiple times during the lifetime of the plug-in.
Reimplemented in ProfilingMockRenderer::RenderPlugin, and CompanyName::Katana::TemplateRenderPlugin.
| virtual int Foundry::Katana::Render::RenderBase::stopLiveEditing | ( | ) | [inline, virtual] |
Stop the live render process. No further data updates or control commands should be expected.
Reimplemented in CompanyName::Katana::TemplateRenderPlugin.
| bool Foundry::Katana::Render::RenderBase::useRenderPassID | ( | ) | const [protected] |
Specifies whether an ID pass should be created. The user guide explains how to activate an ID pass in the monitor and how to use the picker tool.
See "Sending ID pass data to Katana" in the Katana Developer Guide for further information.
1.7.3