RenderData Manual

About

A RenderData object represents a set of render settings of a BaseDocument. The render settings include:

  • Various parameters like resolution, image format, save path etc.
  • A list of MultipassObject elements that represent multipasses.
  • A list of BaseVideoPost elements that represent post filters or render engines.

RenderData objects are an instance of Rbase.

Access

RenderData elements can be accessed from the BaseDocument:

// This example prints the name of the active render settings.
RenderData* renderData = doc->GetActiveRenderData();
GePrint("Active RenderData: " + renderData->GetName());

Allocation/Deallocation

RenderData objects can be created with the usual tools:

The RenderData object can be handed over to a BaseDocument using:

// This example adds a new RenderData to the document and set this RenderData as the active one.
RenderData* const renderData = RenderData::Alloc();
if (renderData != nullptr)
{
renderData->SetName("Preview Render Settings");
doc->InsertRenderDataLast(renderData);
doc->SetActiveRenderData(renderData);
}

Navigation

RenderData is based on GeListNode and the render settings are organized in a tree. This tree can be navigated with:

// This example searches for the topmost parent of the active RenderData
// and sets it as the active one.
RenderData* renderData = doc->GetActiveRenderData();
RenderData* parentRenderData = renderData;
// search for the topmost parent
while (parentRenderData->GetUp())
{
parentRenderData = parentRenderData->GetUp();
}
doc->SetActiveRenderData(parentRenderData);

Properties

The RenderData object gives access to render settings, Multipasses and post effects.

Data

RenderData is based on BaseList2D so the data can be accessed with

The container IDs are defined in drendersettings.h.

// This example sets the resolution of the active render settings to 720p
// and enables the "Stereoscopic" parameter group
RenderData* renderData = doc->GetActiveRenderData();
BaseContainer* bc = renderData->GetDataInstance();
bc->SetInt32(RDATA_XRES, 1280);
bc->SetInt32(RDATA_YRES, 720);
bc->SetBool(RDATA_STEREO, true);

Additional options for the target file format are stored in a sub BaseContainer:

// This example configures the OpenEXR export format.
RenderData* renderData = doc->GetActiveRenderData();
BaseContainer* bc = renderData->GetDataInstance();
// set OpenEXR format
// set OpenEXR details
BaseContainer openEXR;
openEXR.SetInt32(0, 3); // ZIP
openEXR.SetInt32(1, true); // clamp to half float
// save
saveOptions->SetContainer(0, openEXR);

Changing the RDATA_RENDERENGINE parameter to change the render engine will not automatically create the needed video post for that render engine. The video post has to be created manually.

// This example sets "Hardware" as the current renderer.
// and adds the "Hardware" post effect
RenderData* const renderData = RenderData::Alloc();
if (renderData != nullptr)
{
renderData->SetName("Hardware Rendering");
// set "Hardware" as active renderer
BaseContainer* bc = renderData->GetDataInstance();
if (bc)
// add "Hardware" post effect
if (videoPost)
renderData->InsertVideoPost(videoPost);
// insert render data
doc->InsertRenderDataLast(renderData);
doc->SetActiveRenderData(renderData);
}

If a given RenderData element is active can be checked with a bit. To set a given RenderData object as the active one, use BaseDocument::SetActiveRenderData().

// This example loops through all topmost render settings
// and checks if the given element is the active one.
RenderData* renderData = doc->GetFirstRenderData();
while (renderData)
{
GePrint("RenderData: " + renderData->GetName());
// check if this RenderData object is the active render setting
if (renderData->GetBit(BIT_ACTIVERENDERDATA))
GePrint("--> active RenderData");
renderData = renderData->GetNext();
}

Multipasses

A render multipass contains different elements of the render result. What multipasses should be created is stored in a list of MultipassObject elements.

See also MultipassObject Manual.

// This code loops though all multipasses searching for render buffers.
while (mp)
{
GeData data;
// get the type of the multipass
{
// if this pass is a object buffer
{
// read the object buffer ID
const Int32 bufferID = data.GetInt32();
GePrint("Buffer ID: " + String::IntToString(bufferID));
}
}
mp = mp->GetNext();
}

Post Effects

Post effects are executed during the rendering process to apply filters like color correction to the final image. BaseVideoPost objects can also represent a render engine. These BaseVideoPost elements are stored in a list.

See also BaseVideoPost Manual.

// This example loops through all video posts,
// searches for the "Watermark" post effect and enables it
RenderData* renderData = doc->GetActiveRenderData();
BaseVideoPost* vp = renderData->GetFirstVideoPost();
while (vp)
{
// check if this is a "Watermark"
if (vp->GetType() == 1025462)
{
break;
}
vp = vp->GetNext();
}

Further Reading