Show / Hide Table of Contents

    General commands

    Introduction

    The Simplygon-command has a number of flags which can be set from script, for example the sf (SettingsFile) flag which specifies which kind of Pipeline / settings Simplygon will use during optimization. This documentation will focus mostly on MEL, but there will be some Python examples as well.

    MEL

    // select objects in scene
    select -all;
    
    // execute Simplygon with the given Pipeline (settings-file)
    Simplygon -sf "D:/Pipelines/reductionPipeline.json"
    

    Python

    import maya.cmds as cmds
    
    # select objects in scene
    cmds.select( all=True )
    
    # execute Simplygon with the given Pipeline (settings-file)
    cmds.Simplygon(sf = "D:/Pipelines/reductionPipeline.json")
    

    Commands and flags

    The following listing describes all supported MEL commands and flags.

    Command
    Simplygon
    Short Long Argument(s) Description
    -mb -LockMaterialBoundaryVertices string materialName Locks vertices along the specified material's borders. These vertices will not be touched when generating the MeshLOD.
    -lsv -LockSetVertices string setName Locks vertices in the named set. These vertices will not be touched when generating the MeshLOD.
    -lse -LockSetEdges string setName Locks edges in the named set. These edges will not be touched when generating the MeshLOD.
    -mc -MaterialColor string materialName
    string channelName
    float r
    float g
    float b
    float a
    Overrides or creates the color on the specified channel of the material.
    -mt -MaterialTexture string materialName
    string channelName
    string texturePath
    Overrides or sets the texture on the specified channel of the material.
    -mlt -MaterialLayeredTexture string materialName
    string channelName
    string texturePath
    int layer
    string blendType
    Overrides or sets the texture on the specified texture layer of the material. Blend type can be add, multiply, subtract or none.
    -mtn -MaterialTextureNormals string materialName
    string texturePath
    bool isTangentSpace
    Overrides the normals texture of the material. Set the third parameter isTangentSpace to true if the normal map is in tangent space.
    -tcn -MaterialTextureChannelName string materialName
    string channelName
    string uvSetName
    Overrides the UV-set for the material.
    -tod -TextureOutputDirectory string outputPath Overrides the texture output folder for all processed textures to this absolute path.
    -caw -UseColorSetAsWeights string colorSetName Sets which color set to use as vertex weights.
    -wm -SetWeightsMultiplier float multiplier Sets the weight multiplier. The lower bound of the weights is 1/multiplier and the upper bound is multiplier. The multiplier must be in the range 2-8.
    -wi -SetWeightsInterpreter uint interpreter Sets which interpreter to use when interpreting vertex colors as weights
    0 Black: reduce more | White: reduce less
    1 Black: unchanged | White: reduce less
    2 Black: reduce more | White: unchanged.
    -ss -SelectionSet string setName
    string objectNames (separated by |)
    Creates a Selection Set that can be used for grouping objects. These groups can, if specified in the Simplygon UI, be used to process objects individually. Ex: ```setName "objectName1
    -cpb -UseCurrentPoseAsBindPose <none> Specifies that the skinning data will be extracted from the current pose rather than the bind pose. Please do not use this flag when in bind pose as synchronization issues might appear!
    -swp -SkipBlendShapeWeightPostfix <none> If set, the default prefix in blend shape attribute names (_LOD, as in Mouth_LOD1) will be removed.
    Note: If set, all generated target meshes will be left in the scene!
    -sf -SettingsFile string settingsPath Sets the path to the settings-file (pipeline-file) which will be used when processing.
    Note: SPL-files and preset-files are not supported in this version of the plugin!
    -so -SettingsObject int pipelineId Specifies which settings-object (pipeline-object) to use when processing.
    Note: SPL-objects are not supported in this version of the plugin!

    Examples

    This section contains various examples written in MEL and Python. We've left out some aprts of the scripts to keep things as simple as possible.

    • import maya.cmds as cmds must be declared at the top of each Python script.
    • reductionPipeline settings-path must be declared for both MEL and Python scripts where it makes scense.
    • a scene-selection is made before each Simplygon-command.

    Run Simplygon

    To run Simplygon, simply execute the Simplygon- command along with a Pipeline settings-path or Pipeline settings-object. A Pipeline contains the settings that Simplygon will use during optimization, much like SPL (8.x) and INI (7.x). The optimized result will be returned to Maya as soon as the processing has completed.

    Execute Simplygon using a Pipeline file-path

    MEL

    // execute simplygon with the given pipeline (settings-file)
    Simplygon -sf "D:/Pipelines/reductionPipeline.json";
    

    Python

    # execute simplygon with the given pipeline (settings-file)
    cmds.Simplygon(sf = "D:/Pipelines/reductionPipeline.json")
    
    Execute Simplygon using a Pipeline-object

    MEL

    // create a reduction pipeline-object
    $reductionPipeline = `Pipeline -c "ReductionPipeline"`;
    ...
    
    // execute Simplygon with the given pipeline-object
    Simplygon -so $reductionPipeline;
    
    // clear all pipelines
    Pipeline -cl;
    

    Python

    # create a reduction pipeline-object
    reductionPipeline = cmds.Pipeline(c = "ReductionPipeline")
    ...
    
    # execute Simplygon with the given pipeline-object
    cmds.Simplygon(so = reductionPipeline)
    
    # clear all pipelines
    cmds.Pipeline(cl = True)
    

    Material color override

    To override a color of a material channel, enter the material name, the name for the channel and the rgba values for a specific color. In the example below we choose to set the diffuse channel of "MyMaterial" to blue. If the material channel does not exist it will be created.

    MEL

    // execute Simplygon with settings file
    // and material color override
    Simplygon
     -sf $reductionPipeline 
     -mc "MyMaterial" "Diffuse" 0.0 0.0 1.0 1.0;
    

    Python

    # execute Simplygon with settings file
    # and material color override
    cmds.Simplygon(sf = reductionPipeline, mc = ["MyMaterial", "Diffuse", 0.0, 0.0, 1.0, 1.0])
    

    Material texture override

    To override a texture of a material channel, enter the name of the material, the name of the channel and at last the path to the texture. In the example below we choose to set a diffuse texture to the diffuse channel of the material. If the material channel does not exist it will be created.

    MEL

    // execute Simplygon with settings file
    // and material texture override
    Simplygon
     -sf $reductionPipeline 
     -mt "MyMaterial" "Diffuse" "c:/MyTexture.jpg";
    

    Python

    # execute Simplygon with settings file
    # and material texture override
    cmds.Simplygon(sf = reductionPipeline, mt = ["MyMaterial", "Diffuse", "c:/MyTexture.jpg"])
    

    Weight sets

    Setting which color-set to use as vertex weights.

    MEL

    // execute Simplygon with settings file
    // and colorset-as-weights override
    Simplygon
     -sf $reductionPipeline 
     -caw "SimplygonColorSet";
    

    Python

    # execute Simplygon with settings file
    # and colorset-as-weights override
    cmds.Simplygon(sf = reductionPipeline, caw = "SimplygonColorSet")
    

    Then, set the weight multiplier (a value between 2 and 8):

    MEL

    -wm 8
    

    Set which interpreter to use (a value between 0 and 2, where 0 is default):

    MEL

    -wi 0
    

    Selection sets

    To create a selection set, enter the name of the set to be created followed by a list of objects seaprated by a "|" without the quotes. Can be used for object selection, edge- and vertex-locks, bone lock and bone removal. Specify which set to use in the settings.

    MEL

    // execute Simplygon with settings file
    // and selection-set
    Simplygon 
    -sf $reductionPipeline 
    -ss "SelectionSet1" "pCube1|pCube2|pCube3";
    

    Python

    # execute Simplygon with settings file
    # and selection-set
    cmds.Simplygon(sf = reductionPipeline, ss = ["SelectionSet1", "pCube1|pCube2|pCube3"])
    
    Back to top Terms of Use | Privacy and cookies | Trademarks | Copyright © 2019 Microsoft