Render Toolbox 3  v2.1
 All Functions Groups Pages
Functions
Mappings

Functions that support the Batch Renderer. More...

Functions

 ApplySceneDOMPaths (idMap, mappings)
 Modify a scene document with a mapping.
 
obj EditObjectProperty (obj, oldName, newName, newType)
 Change a mappings object property name and type.
 
obj FillInObjectProperty (obj, name, type, value)
 Make sure the given mappings object has the given property.
 
value GetObjectProperty (obj, name)
 Get a mappings object property value.
 
objects MappingsToObjects (mappings)
 Group mappings into meaningful objects.
 
names values ParseConditions (conditionsFile)
 Read conditions data from a text file.
 
mappings ParseMappings (mappingsFile)
 Read mappings data from a text file.
 
mappings ResolveMappingsValues (mappings, varNames, varValues, colladaFile, adjustments, hints)
 Update mappings by resolving expressions to concrete values.
 
obj SetObjectProperty (obj, name, value)
 Set a mappings object property value.
 
objects SupplementGenericObjects (objects)
 Fill in generic objects with default properties, if needed.
 
 ApplyMitsubaObjects (idMap, objects)
 Apply Mitsuba mappings objects to the adjustments DOM.
 
objects GenericObjectsToMitsuba (objects)
 Translate generic object names and values to Mitsuba.
 
objects GenericObjectsToPBRT (objects)
 Translate generic object names and values to PBRT.
 

Detailed Description

Functions that support the Batch Renderer.

These functions support the batch renderer. They mostly deal with reading manipulations specified in the the conditions file and mappings files, formatting it properly, and applying it to the Collada parent scene. Users don't usually need to call these functions.

Function Documentation

ApplySceneDOMPaths ( idMap  ,
mappings   
)

Modify a scene document with a mapping.

Parameters
idMap
mappings

Modify the document represented by the given idMap, with the given mappings. mappings must be a struct array of mappings data as returned from ParseMappings(). The mappings should contain Scene DOM paths on the left-hand side.

Creates document nodes as needed, to satisfy the left-hand Scene DOM paths.

Used internally by MakeSceneFiles().

Usage: ApplySceneDOMPaths(idMap, mappings)

obj EditObjectProperty ( obj  ,
oldName  ,
newName  ,
newType   
)

Change a mappings object property name and type.

Parameters
obj
oldName
newName
newType

Change the name and type of a mappings object's existing property. The property with the given oldName will be modified to have the given newName and newType. Returns the updated mappings object.

Used internally by MakeSceneFiles().

Usage: obj = EditObjectProperty(obj, oldName, newName, newType)

obj FillInObjectProperty ( obj  ,
name  ,
type  ,
value   
)

Make sure the given mappings object has the given property.

Parameters
obj
name
type
value

Make sure the given mappings object has a property with the given name. If not, creates a new property with the given name, type, and value. Returns the updated mappings object.

Used internally by MakeSceneFiles().

Usage: obj = FillInObjectProperty(obj, name, type, value)

value GetObjectProperty ( obj  ,
name   
)

Get a mappings object property value.

Parameters
obj
name

Get the value of a property value of a mappings object. Returns the value.

Used internally by MakeSceneFiles().

Usage: value = GetObjectProperty(obj, name)

objects MappingsToObjects ( mappings  )

Group mappings into meaningful objects.

Parameters
mappings

Create a struct array of mappings objects, based on the struct array of mappings data as returned from ParseMappings(). Each mappings object incorporates one declaration and zero or more property configurations. These are taken from mappings that use the same id value and reside within the same mappings block. Returns a new struct array of mappings objects.

Used internally by MakeSceneFiles().

Usage: objects = MappingsToObjects(mappings)

names values ParseConditions ( conditionsFile  )

Read conditions data from a text file.

Parameters
conditionsFile

Reads batch renderer condition variables from the given conditionsFile. See the RenderToolbox3 wiki for more about Conditions Files.

Returns a 1 x n cell array of string variable names from the first line of conditionsFile. Also returns an m x n cell array of varible values, with m values per variable.

Used internally by MakeSceneFiles().

Usage: [names, values] = ParseConditions(conditionsFile)

mappings ParseMappings ( mappingsFile  )

Read mappings data from a text file.

Parameters
mappingsFile

Reads batch renderer mappings from the given mappingsFile. See the RenderToolbox3 wiki for more about Mappings Files.

Returns a 1xn struct array with mapping data. The struct array will have one element per mapping, and the following fields:

  • text - raw text before parsing
  • blockType - block type, 'Collada', 'Generic', 'Mitsuba', or 'PBRT'
  • blockNumber - the order of the block in the mappings file
  • group - name of a set of related blocks
  • left - a struct of info about the left-hand string
  • operator - the operator string
  • right - a struct of info about the right-hand string

Each 'left' or 'right' field will contain a struct with data about a string, with the following fields

  • text - the raw text before parsing
  • enclosing - the enclosing brackets, if any, '[]', '<>', or ''
  • value - the text found within enclosing brackets

Used internally by MakeSceneFiles().

Usage: mappings = ParseMappings(mappingsFile)

mappings ResolveMappingsValues ( mappings  ,
varNames  ,
varValues  ,
colladaFile  ,
adjustments  ,
hints   
)

Update mappings by resolving expressions to concrete values.

Parameters
mappingsstruct of mappings data from ParseMappings()
varNamescell array of variable names to be replaced
varValuescell array of variable values to replace names
colladaFilename or path of a Collada parent scene file
adjustmentsrenderer-native adjustments from an ApplyMappings function
hintsstruct of RenderToolbox3 options

Updates the given mappings, as returned from ParseMappings(), by replacing expressions with concrete values. Several different kinds of expression will be replaced, as described below.

Replaces parenthetical () expressions that contain variable names with corresponding variable values. For example, would replace all occurences of the expression (foo) with the value of the foo variable. varNames should be a cell array of string variable names. varValues should be a cell array of variable values, with the same size as varNames.

For right-hand values, expressions in square brackets [] should contain Scene DOM Paths that refer to nodes in the colladaFile. These expressions will be replaced with the string values of the referenced nodes. For example, the expression [Camera:translate|sid=location] might be replaces with XYZ coordinates such as "2 2 25".

For right-hand values, expressions in angle brackets <> should contain Scene DOM Paths that refer to nodes in renderer adjustments. The presence of these expressions assumes that adjustments contains the name of an XML adjustments file, which may not be true for all renderers. These expressions will be replaced with the string values of the referenced nodes. For example, the expression [integrator:parameter|name=pixelsamples] might be replaces with a string like "8".

All right-hand values will be evaluated as expressions that might match the names of files within hints.workingFolder or on the Matlab path. Whenever a right-hand value does match the name of such a a file, the value will be replaced with an unambiguous path to the matched file. Matched files that are within hints.workingFolder will be replaced with relative paths starting at hints.workingFolder. Matched files from the Matlab path will be replaced with full absoulte path names.

Returns the given mappings, updated with expressions replaced by concrete values.

Used internally by MakeSceneFiles().

Usage: mappings = ResolveMappingsValues(mappings, varNames, varValues, colladaFile, adjustments, hints)

obj SetObjectProperty ( obj  ,
name  ,
value   
)

Set a mappings object property value.

Parameters
obj
name
value

Set a property value for a mappings object. Returns the updated object.

Used internally by MakeSceneFiles().

Usage: obj = SetObjectProperty(obj, name, value)

objects SupplementGenericObjects ( objects  )

Fill in generic objects with default properties, if needed.

Parameters
objects

Add default properties to generic mappings objects, as needed to make them complete. objects must be a struct array of mappings objects as returned from MappingsToObjects() or GenericObjectsToMitsuba().

Used internally by MakeSceneFiles().

Usage: objects = SupplementGenericObjects(objects)

ApplyMitsubaObjects ( idMap  ,
objects   
)

Apply Mitsuba mappings objects to the adjustments DOM.

Parameters
idMap
objects

Modify the document represented by the given idMap, with the given mappings objects. objects must be a struct array of mappings objects as returned from MappingsToObjects() or GenericObjectsToMitsuba().

Used internally by MakeSceneFiles().

Usage: ApplyMitsubaObjects(idMap, objects)

objects GenericObjectsToMitsuba ( objects  )

Translate generic object names and values to Mitsuba.

Parameters
objects

Convert generic mappings objectsto Mitsuba-native mappings objects. objects must be a struct array of mappings objects as returned from SupplementGenericObjects().

Used internally by MakeSceneFiles().

Usage: objects = GenericObjectsToMitsuba(objects)

objects GenericObjectsToPBRT ( objects  )

Translate generic object names and values to PBRT.

Parameters
objects

Convert generic mappings objectsto PBRT-native mappings objects. objects must be a struct array of mappings objects as returned from SupplementGenericObjects().

Used internally by MakeSceneFiles().

Usage: objects = GenericObjectsToPBRT(objects)