Skip to content
On this page

Run a Pipeline

The Simplygon command provides flags for specifying which Pipeline to use for the optimization. The following example will load a Pipeline from file using the SimplygonPipeline command and then execute the Simplygon command with the so (SettingsObject) flag followed by the previously loaded pipeline.

INFO

The export does support preservation of quads (to be used by the quad reducer). To enable quad export; add the flag -qm (-QuadMode) to the Simplygon command. The Simplygon UI appends the QuadMode-flag automatically whenever there is a QuadReductionPipeline involved, but for scripting this has to be done manually.

MEL
// load an asset
file -f -options "v=0;" -ignoreVersion -typ "mayaBinary" -o "D:/Assets/SomeAsset.mb";

// select everything in scene
select -all;

// load previously saved pipeline
$reductionPipeline = `SimplygonPipeline -l "D:/Pipelines/reductionPipeline.json"`;

// execute pipeline on selection,
// returns result to Maya once completed
$bQuadMode = false;

if($bQuadMode)
{
   Simplygon -so $reductionPipeline -qm;
}
else
{
   Simplygon -so $reductionPipeline;
}

// clear all pipelines that resides in memory
SimplygonPipeline -cl;
python
import maya.cmds as cmds

# load an asset
cmds.file('D:/Assets/SomeAsset.mb', i = True, mergeNamespacesOnClash = True, namespace = ':', importFrameRate = True)

# select objects
cmds.select(all = True)

# load previously saved pipeline
reductionPipeline = cmds.SimplygonPipeline(l = 'D:/Pipelines/reductionPipeline.json')

# execute pipeline on selection,
# returns result to Maya once completed
bQuadMode = False

if bQuadMode:
    cmds.Simplygon(so = reductionPipeline, qm = True)
else:
    cmds.Simplygon(so = reductionPipeline)

# clear all pipelines that resides in memory
cmds.SimplygonPipeline(cl = True)

Next steps

Get to know how to work with Pipelines: