Scripting Reference

Graph

The pgYetiGraph command can be used to query and edit values within a graph. The command takes any number of arguments and the name of the Yeti node, for example:

pgYetiGraph -listNodes pgYetiMayaShape1

will list all of the nodes within the graph. Or

pgYetiGraph -listNodes -type "scatter" pgYetiMayaShape1

will limited the list to the node type specified.

Once you know what node you want to query you can specify it with the -node parameter and then query the parameter names:

pgYetiGraph -node "scatter01" -listParams pgYetiMayaShape1

And now that you know what parameters there are for the node, you can used the -param argument to query the parameters value:

pgYetiGraph -node "scatter01" -param "density" -getParamValue pgYetiMayaShape1

Argument Description
-create Creates a node of the type defined by the -type parameter
-rename <string newname> Renames the node defined by -node to newname.
-listNodes Lists all of the nodes in the graph.
-listParams Lists all of the parameters on the node in a graph, specified with the -node argument.
-type Is used to specify the type of node to be listed.
-node <string node> Used to specify which node you want to query.
-nodeType Return the type of the node specified by the -node parameter.
-setRootNode <string node> Sets node to be the root node of the graph.
-getRootNode Returns the current root node name.
-param <string param> Used to specify which parameter you want to query.
-paramNiceName Return the name for the parameter used by Yetis UI.
-paramType Return the data type of the parameter.
-getParamValue Return the value of the parameter, it will be cast to the required data type.
-setParamValueBoolean <bool> Set the specified parameters value if it’s a boolean data type.
-setParamValueScalar <scalar> Set the specified parameters value if it’s a int or float data type.
-setParamValueVector <vector> Set the specified parameters value if it’s a vector, point or color data type.
-setParamValueString <string> Set the specified parameters value if it’s a string data type.
-setParamValueExpr <string> Set the specified parameters value to the passed expression.
-isParamConstant Returns whether or not the value of the parameter is a variable expression or not.

Caching

You can use pgYetiCommand to cache out a select Yeti node using the -writeCache parameter which requires the full pathname as a string, frame padding should be specified using standard C notation ( ie. %04d for 4 digit padding ). Used on it’s own -writeCache will only generate a cache for the current frame, to write a range of caches the -range parameter should be used with a start and end frame. By default Yeti writes 3 samples for each frame, in most cases this should be sufficient but in cases where fast moving characters are the basis for the fur generation sometimes higher samples ( up to 7 ) can be used.

If multiple Yeti nodes are selected (or passed as parameters) they will all be cached concurrently, to allow Yeti to save the cache data to node specific files the <NAME> tag can be used.

For example: pgYetiCommand -writeCache “/myCacheDir/furryMonster_<NAME>.%04d.fur” -range 1 20

will output cache files named furryMonster_furryMosterShape.0001.fur for the first frame if furryMonsterShape was the provided node name.

Argument Description
-writeCache <string fileName> This tells Yeti you want to write a cache to the specified file name.
-range <int start> <int end> The frame range to export.
-samples <int numberOfSamples> The number of samples to be used for each frame, this is centered around the frame eg. 3 samples will write 2.5, 3.0 and 3.5 if the current frame was 3.
-sampleTimes <string sampleTimes> A string that represents a list of sample times for each frame separated by a space, these are frame offsets. eg. “-0.3 0.0 0.3” will write 2.7, 3.0 and 3.3 to the cache for frame 3.
-updateViewport <boolean> Toggle whether the 3d viewport updates while exporting.
-generatePreview <boolean> Toggle whether a preview is generated in the cache files.

As an example, if you wanted to cache out all the fur from frame 1-100 with 5 motion samples per frame you could used

pgYetiCommand -writeCache "/base/vfx/tmp/myCache.%04d.fur" -range 1 100 -samples 5

OBJ Export

pgYetiCommand can also be used with the -objExport to export polygonal geometry from the currently selected Yeti node. This will ignore any fibres and is generally meant to bake out instancing.

pgYetiCommand -objExport [density (float)] [filename (string)] [do_texture_coordinates (bool)] [do_normals (bool)]

pgYetiCommand -objExport 1 "/base/vfx/tmp/myInstances.obj" true true

Generating Maya Objects

In some instances you may want to generate Maya representations of the objects created by Yeti - to do this you can select the node and either use the “Convert to Maya Objects” option in the Yeti menu or run:

pgYetiCommand -generateMayaObjects

Yeti Node

pgYetiCreate() is used to create a new Yeti node in the Maya scene.

pgYetiCreateOnMesh() can be used to expedite the process of adding an initial input object, make sure a mesh has been selected prior to using the command.

pgYetiAddGroom( string $groom, string $pgYetiMayaNode ) will add the groom $groom as an input to $pgYetiMayaNode.

pgYetiRemoveGroom( string $groom, string $pgYetiMayaNode ) will remove the groom $groom as an input to $pgYetiMayaNode.

pgYetiAddGeometry( string $object, string $pgYetiMayaNode ) will add the geometry $object as an input to $pgYetiMayaNode.

pgYetiRemoveGeometry( string $object, string $pgYetiMayaNode ) will remove the geometry $object as an input to $pgYetiMayaNode.

pgYetiAddGuideSet( string $set, string $pgYetiMayaNode ) will add the maya set, containing guide curves, $set as an input to $pgYetiMayaNode.

pgYetiRemoveGuideSet( string $set, string $pgYetiMayaNode ) will remove the maya set $set as an input to $pgYetiMayaNode.

pgYetiRemoveAllConnections( string $pgYetiMayaNode ) will remove any and all connections on the Yeti node.

pgYetiForceUpdate( string $pgYetiMayaNode ) forces the specified node to re-evaluate it’s graph.

Groom Node

pgYetiCreateGroomOnMesh() creates a new Groom node on a selected mesh object.

pgYetiAddCollisionGeometry( string $object, string $pgYetiMayaGroomNode ) will add the geometry $object to $pgYetiMayaGroomNode‘s list of collision geometry.

pgYetiRemoveCollisionGeometry( string $object, string $pgYetiMayaGroomNode ) will remove the geometry $object to $pgYetiMayaGroomNodes‘s list of collision geometry.

pgYetiAddField( string $field, string $pgYetiMayaGroomNode ) attaches $field to $pgYetiMayaGroomNode to affect dynamic simulation.

pgYetiRemoveField( string $field, string $pgYetiMayaGroomNode ) detaches $field from $pgYetiMayaGroomNode.

pgYetiCommand -removeDuplicate <distance> is used to remove duplicate strands within the distance threshold.

Utilities

pgYetiConvertGuideSetToGroom( string $guide_set, string $mesh_object, float $stepSize ) is used to convert a guide curve set into a Yeti Groom node for combing, $guide_set is the set that you want to convert and $mesh_object is the object the guides are to be growing from. Step size should be 0.1 by default, but other values may be passed to refine the detail of the output strands.

pgYetiImportGroomFileFromNode( string $pgYetiMayaNode ) will rebuild a graph and groom nodes stored in a GRM file currently referenced by $pgYetiMayaNode.

pgYetiExtractGroomFromNode( string $in_groom, string $yetiNode, string $postFix ) is used to extract and rebuild a single groom stored in a GRM or cache file currently referenced by $pgYetiMayaNode.

pgYetiSwapGeometry( string $originalGeometry, string $newGeometry ) is a utility to swap all the Yeti connections on one mesh to another, possibly a when a model updates.

License Utilities

pgYetiCommaned -licenseAvailable returns true ( 1 ) if a license is available and/or if the license is already successfully checked out.

pgYetiCommaned -numberOfLicensesAvailable returns the number of available licenses as reported by the license server.

pgYetiCommaned -returnLicense can be used to forcibly return the Yeti license checked out by the current user.

pgYetiCommand -licenseStatus or -batchLicenseStatis with return true/false if you are currently using a license.

Rendering

Yeti has a separate render command that is used by a few of the different rendering integration tools ( it conforms to what 3delight needs and is used by RMS ) to provide a means of sampling the scene as well as saving a cache. Below are the commands that are supported that may be of interest to others building integration tools.

pgYetiRenderCommand -addStep -sampleTime <time> -frame <frame> $yeti_shape_node is used to add a sample for the specified Yeti node. <sampleTime> is the current time and <frame> is the whole frame number.

pgYetiRenderCommand -list returns a list of Yeti shape nodes currently in a state of being sampled.

pgYetiRenderCommand -flush flushes all of the stores cached data for previously cached nodes, this should be done before you start and after you’ve written a cache to disk.

pgYetiRenderCommand -remove $yeti_shape_node will remove all off the stored samples/data for the specified shape node, this is similar to flush except on a per shape basis.

pgYetiRenderCommand -contains $yeti_shape_node returns true if the specified shape node has data to be written to disk/emitted.

pgYetiRenderCommand -preRenderCache -fileName <file> $yeti_shape_node can be used to save and/or query the file name used for rendering the current node with a result being the filename resolved. The -fileName parameter is optional, if specified this will override any temporary or cache file name.

pgYetiRenderCommand -emit $yeti_shape_name will stored the cache samples to disk and emit the Renderman calls to include the shape and Yeti node in the Rib files.