...
Code Block |
---|
MSyntax syntax; syntax.addFlag("-st", "-sampleTime", MSyntax::kDouble); syntax.addFlag("-a", "-addstep"); syntax.addFlag("-r", "-remove"); syntax.addFlag("-e", "-emit"); syntax.addFlag("-f", "-flush"); syntax.addFlag("-c", "-contains"); syntax.addFlag("-l", "-list"); syntax.setObjectType(MSyntax::kSelectionList, 0, 1); // Next call not strictly needed, but it more clearly states that the command // should not fallback on the current selection. Command invocations with // "-list" and "-flush" flags will not specify any objects. syntax.useSelectionAsDefault(false); |
The cache command may be invoked by 3Delight for Maya in the following forms:
cache_command -addstep -sampleTime <double> <shape>
The command is expected to keep a sample of the specified object at the current time, which is passed via the -sampleTime flag; the command can assume that Maya’s current time is already set to this value when it is called. The command should store a combination of the object’s name, topology, sample time. No return value is expected.
cache_command -list
Return the names of the shapes that have been cached by this command in a string array. The command is expected to operate without any objects specified for this flag.
cache_command -flush
Clear all cached data. No return value is expected. The command is expected to operate without any objects specified for this flag.
cache_command -contains <shape>
Returns true if the specified object has been cached, regardless of the sample time. Returns false otherwise.
cache_command -remove <shape>
Removes the specified object from the cache. No return value is expected.
cache_command -emit <shape>
Issues the Ri calls that will go inside the ObjectBegin/End
or ArchiveBegin/End
block for the specified object. If the object can be deformation blurred, it should produce the proper motion blocks. No return value is expected.
Registering the node type and the associated cache command
Multiple custom node types can be registered at once by defining the following procedure:
global proc DL_userGetGeoTypeData (string $node types[], string $plugin requirements[], string $cache commands[], string $not used[])
Register custom node types, their associated cache commands and plugin requirements. The procedure is passed empty string arrays. For a given index, each array is expected to contain the relevant information for a given node type. The parameters are:
Parameter | Description |
---|---|
string $node_types[] | The names of the custom node types. |
_____________________________ | The names of the plugins required to render a given node type. Before trying to cache nodes of that type, 3Delight for Maya will check if the specified plugin name is loaded. If the plugin is not loaded, any nodes of the related type will be ignored from the rendering. Setting the plugin name to an empty string will avoid any plugin verification. |
string $cache_commands[] | The names of the cache commands. Nodes of type $node_type[x] will be cached using the string value specified at index x of this array. |
string $not_used[] | This parameter is not used at this time. |
Specify if the custom node can use object instances
.By default, 3Delight for Maya will assume that the cache command’s -emit
flag produces an ObjectBegin / End
block (which are more efficient with object instances) and will issue proper ObjectInstance
statements for each renderable object. If the cache command produces an inline archive following procedure should be defined:
global proc int DL_<custom_type>CanUseObjectInstance (string $shape name)
<custom type>
is a placeholder for the custom node type name. The procedure is passed the name of the shape to be rendered. If the procedures returns a non-zero value, ObjectInstance
commands will be used; otherwise ReadArchive statements will be issued.