Module vrVariantSets
[frames] | no frames]

Module vrVariantSets

Contains the functionality to switch between defined variants of a model.

Functions
bool
beginDissection()
Starts the dissection process.
 
captureVariantSetFromRootNodes(name, roots, inclNodes, inclMaterials, inclLights, inclEnvs, inclView, inclRenderlayerStates, sendMsg)
Captures variants to an existing variant set.
vrVariantSet
createVariantSet(name)
Creates a variant set.
 
createVariantSetGroup(name)
Creates a variant set group.
 
deleteVariantSet(name)
Deletes a variant set.
 
deleteVariantSetGroup(name)
Deletes a variant set group.
 
dissectionSnapshot(filename, width, height, ssf)
Creates a snapshot in dissection mode.
bool
endDissection()
Ends the dissection process.
dict
getGroupedVariantSets(skipHidden)
Gets all variant sets.
string
getMaterialVariantCurrent(name)
Returns the current state of a material variant.
string
getMaterialVariantDefault(name)
Returns the default state of a material variant.
list of strings
getMaterialVariantStates(name)
Returns all possible states of a material variant.
list of strings
getMaterialVariants(name)
Returns a list of all material variants of a single variant set or a list of all material variants of all variant sets if you omit the name parameter.
string
getNodeVariantCurrent(name)
Returns the current state of a node variant.
string
getNodeVariantDefault(name)
Returns the default state of a node variant.
list of strings
getNodeVariantStates(name)
Returns all possible states of a node variant.
list of strings
getNodeVariants(name)
Returns a list of all node variants of a single variant set or a list of all node variants of all variant sets set if you omit the name parameter.
list of strings
getVariantAnimations(name)
Returns a list of all animations of a variant set.
vrVariantSet
getVariantSet(name)
Gets a variant set.
string
getVariantSetPreview(name)
Get a preview image for the variant set (if it has one).
list of strings
getVariantSets()
Returns a list of all defined variant sets.
list of strings
getVariantViewPoints(name)
Returns a list of all viewpoints belonging to a variant set.
 
hideMaterialVariantGeometry(name)
Disables the geometry that is switched by a material variant.
 
hideNodeVariantGeometry(name)
Disables the geometry that is switched by a node variant.
 
hideVariantSetGeometry(name)
Disables the geometry that is switched by a variant set.
 
loadVariants(name)
Loads variant definitions from an XML file.
vrVariantSet
moveVariantSetToGroup(variantSetName, variantSetGroupName)
 
renderVariantSetPreview(name)
Render variant set preview .
bool
saveSwitchedGeometry(filename)
Saves the current switched geometry/materials into a file.
 
saveVariants(name)
Saves the variant definitions to an XML file.
 
selectMaterialVariant(name, state)
Activates a state of a material variant.
 
selectNodeVariant(name, state)
Activates a state of a node variant.
 
selectVariantSetDefault(name)
Activates the default state of a variant set.
 
showMaterialVariantGeometry(name)
Enables the geometry that is switched by a material variant.
 
showNodeVariantGeometry(name)
Enables the geometry that is switched by a node variant.
 
showVariantSetGeometry(name)
Enables the geometry that is switched by a variant set.
Function Details

beginDissection()

 

Starts the dissection process. This saves the current state of all material and geometry variants and then disables all nodes in the scene graph.

Returns: bool
True on success, false otherwise.

captureVariantSetFromRootNodes(name, roots, inclNodes, inclMaterials, inclLights, inclEnvs, inclView, inclRenderlayerStates, sendMsg)

 

Captures variants to an existing variant set. Use createVariantSet(name) before capturing to create a new variant set.

Parameters:
  • name (string) - The name of the variant set.
  • roots (list of vrNodePtrs) - The root nodes to capture from.
  • inclNodes (bool) - The flag for capturing node state(inactive nodes only) and switch state.
  • inclMaterials (bool) - The flag for tracking materials internally in variant set and capturing material switch state.
  • inclLights (bool) - The flag for capturing active/inactive light node.
  • inclEnvs (bool) - The flag for capturing active/inactive environment nodes, switch state and material.
  • inclView (bool) - The flag for capturing the current camera and creating a view from this. Created viewpoint is set to default viewpoint.
  • inclRenderlayerStates (bool) - The flag for capturing the current render layer states.
  • sendMsg (bool) - The flag to send message when creating variants.

createVariantSet(name)

 

Creates a variant set.

Parameters:
  • name (string) - The name of the variant set.
Returns: vrVariantSet
The Variant Set.

createVariantSetGroup(name)

 

Creates a variant set group.

Parameters:
  • name (string) - The name of the variant set group.

deleteVariantSet(name)

 

Deletes a variant set.

Parameters:
  • name (string) - The name of the variant set.

deleteVariantSetGroup(name)

 

Deletes a variant set group. The variant sets of the group will be ungrouped and not be deleted.

Parameters:
  • name (string) - The name of the variant set group.

dissectionSnapshot(filename, width, height, ssf)

 

Creates a snapshot in dissection mode. Actually, there are 4 versions of it:

dissectionSnapshot() creates a snapshot in default size (from the preferences). The user will be asked for a filename.

dissectionSnapshot(filename) creates a snapshot in default size (from the preferences).

dissectionSnapshot(filename,width,height) creates a snapshot in specified size.

dissectionSnapshot(filename,width,height,ssf) creates a snapshot in specified size and with the provided supersampling factor.

Parameters:
  • filename (string) - The name of the file.
  • width (integer) - The width (-1 to use default).
  • height (integer) - The height (-1 to use default).
  • ssf (integer) - The supersampling factor (-1 to use default).

endDissection()

 

Ends the dissection process. This restores the previously saved state of all materials and nodes.

Returns: bool
True on success, false otherwise.

getGroupedVariantSets(skipHidden)

 

Gets all variant sets.

Parameters:
  • skipHidden (bool) - If True, exclude hidden variant sets. Default is False.
Returns: dict
The Variant Sets.

getMaterialVariantCurrent(name)

 

Returns the current state of a material variant.

Parameters:
  • name (string) - The name of the material variant.
Returns: string
The current state.

getMaterialVariantDefault(name)

 

Returns the default state of a material variant.

Parameters:
  • name (string) - The name of the material variant.
Returns: string
The default state.

getMaterialVariantStates(name)

 

Returns all possible states of a material variant.

Parameters:
  • name (string) - The name of the material variant.
Returns: list of strings
The states.

getMaterialVariants(name)

 

Returns a list of all material variants of a single variant set or a list of all material variants of all variant sets if you omit the name parameter.

Parameters:
  • name (string) - The name of the variant set. This parameter can be omitted.
Returns: list of strings
The material variants.

getNodeVariantCurrent(name)

 

Returns the current state of a node variant.

Parameters:
  • name (string) - The name of the node variant.
Returns: string
The current state.

getNodeVariantDefault(name)

 

Returns the default state of a node variant.

Parameters:
  • name (string) - The name of the node variant.
Returns: string
The default state.

getNodeVariantStates(name)

 

Returns all possible states of a node variant.

Parameters:
  • name (string) - The name of the node variant.
Returns: list of strings
The states.

getNodeVariants(name)

 

Returns a list of all node variants of a single variant set or a list of all node variants of all variant sets set if you omit the name parameter.

Parameters:
  • name (string) - The name of the variant set. This parameter can be omitted.
Returns: list of strings
The node variants.

getVariantAnimations(name)

 

Returns a list of all animations of a variant set.

Parameters:
  • name (string) - The name of the variant set.
Returns: list of strings
The animations.

getVariantSet(name)

 

Gets a variant set.

Parameters:
  • name (string) - The name of the variant set.
Returns: vrVariantSet
The Variant Set.

getVariantSetPreview(name)

 

Get a preview image for the variant set (if it has one).

Convert returned data to Base64: base64.b64encode(getVariantSetPreview("View"))

Parameters:
  • name (string) - The name of the variant set.
Returns: string
bytes of a png image.

getVariantSets()

 

Returns a list of all defined variant sets.

Returns: list of strings
The variant sets.

getVariantViewPoints(name)

 

Returns a list of all viewpoints belonging to a variant set.

Parameters:
  • name (string) - The name of the variant set.
Returns: list of strings
The viewpoints.

hideMaterialVariantGeometry(name)

 

Disables the geometry that is switched by a material variant.

Parameters:
  • name (string) - The name of the material variant.

hideNodeVariantGeometry(name)

 

Disables the geometry that is switched by a node variant.

Parameters:
  • name (string) - The name of the node variant.

hideVariantSetGeometry(name)

 

Disables the geometry that is switched by a variant set.

Parameters:
  • name (string) - The name of the variant set.

loadVariants(name)

 

Loads variant definitions from an XML file.

Parameters:
  • name (string) - The name of the XML file.

moveVariantSetToGroup(variantSetName, variantSetGroupName)

 
Parameters:
  • variantSetName (string) - The name of the variant set.
  • variantSetGroupName (string) - The name of the group.
Returns: vrVariantSet

renderVariantSetPreview(name)

 

Render variant set preview .

Parameters:
  • name (string) - The name of the variant set.

saveSwitchedGeometry(filename)

 

Saves the current switched geometry/materials into a file. Unused parts of the scene as well as unused materials will not be saved to disk. The file will only contain geometry and materials that are really needed for the actual scene. Depending on the configuration of your scene this file could be much smaller than the original.

Parameters:
  • filename (string) - The name of the file. If this parameter is omitted a file dialog pops up and asks the user for a filename.
Returns: bool
True on success, false otherwise.

saveVariants(name)

 

Saves the variant definitions to an XML file.

Parameters:
  • name (string) - The name of the XML file.

selectMaterialVariant(name, state)

 

Activates a state of a material variant. The parameter "state" allows possible values like "!Previous", "!Previous (Loop)", "!Next" and "!Next (Loop)" to cycle through or the name of the material to be activated.

Parameters:
  • name (string) - The name of the material variant.
  • state (string) - The name of the state. If this parameter is omitted, the default state will be activated.

selectNodeVariant(name, state)

 

Activates a state of a node variant. The parameter "state" allows possible values depending on the type of node variant.

For a typical node like a geometry or a group "!Enable", "!Disable" and "!Toggle" are possible, for a switch variant it is possible to enable all children with "!All", disable all children with "!None", cycle through with "!Previous", "!Previous (Loop)", "!Next" and "!Next (Loop)" or choose the appropriate child simply with its name. If this parameter is omitted, the default state will be activated.

Parameters:
  • name (string) - The name of the node variant.
  • state (string) - The name of the state to be activated. If this parameter is omitted, the default state will be activated.

selectVariantSetDefault(name)

 

Activates the default state of a variant set. All its associated node and material variants will be set to their defaults, respectively.

Parameters:
  • name (string) - The name of the variant set.

showMaterialVariantGeometry(name)

 

Enables the geometry that is switched by a material variant.

Parameters:
  • name (string) - The name of the material variant.

showNodeVariantGeometry(name)

 

Enables the geometry that is switched by a node variant.

Parameters:
  • name (string) - The name of the node variant.

showVariantSetGeometry(name)

 

Enables the geometry that is switched by a variant set.

Parameters:
  • name (string) - The name of the variant set.