Query commands
Introduction
The SimplygonQuery
-command is intended for querying information about processed geometries, such as processed mesh and material information.
Commands and flags
The following listing contains all supported MEL commands and flags.
Command |
---|
SimplygonQuery |
Short | Long | Argument(s) | Description |
---|---|---|---|
-ver |
-Version |
<none> | Gets the Simplygon SDK version. |
-gpm |
-GetProcessedMeshes |
<none> | Returns a list of processed mesh names from the last run. |
-mrm |
-MeshReusesMaterial |
string meshName |
Returns material name if the material is shared, otherwise empty string. (deprecated) |
-rms |
-MeshReusesMaterials |
string meshName |
Return a list of material names if the material is shared, otherwise empty list. Use this if you expect multi-material meshes back from Simplygon. |
-gmm |
-GetMaterialForMesh |
string meshName |
Returns material name for the specified mesh. This can be used for single-material meshes, for example a mesh of which material has gone through material baking. (deprecated) |
-mfm |
-GetMaterialsForMesh |
string meshName |
Return a list of material names for the specified mesh. This can be used for both single- and multi-material meshes, can be used in combination with -gmi. |
-gmi |
-GetMaterialIdsForMesh |
string meshName |
Return a list of material ids for multi-material meshes that has not gone through material baking. Material baking will always result in one single material with material id 0 (the material returned by reuse, if any will cover the entire asset). |
-gm |
-GetMaterials |
<none> | Returns a list of material names from the last run. |
-gcm |
-GetChannelsForMaterial |
string materialName |
Returns a list of material channel names for the specified material. |
-gtc |
-GetTexturePathForChannel |
string materialName string channelName |
Returns the texture path for the specified material channel. |
Examples
This section contains some 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.
Get processed meshes
Returns a string array of the names of the processed meshes from the most recent Simplygon
-command. The result can be used select or rename processed objects.
MEL
// execute SimplygonQuery with gpm-flag
$processedMeshes[] = `SimplygonQuery -gpm`;
Python
# execute SimplygonQuery with gpm-flag
processedMeshes = cmds.SimplygonQuery(gpm = True)
Get materials for mesh
Returns a string array of material-names for the processed mesh.
MEL
// execute SimplygonQuery with mfm-flag
$materials[] = `SimplygonQuery -mfm "pCube1_LOD1"`;
Python
# execute SimplygonQuery with mfm-flag
materials = cmds.SimplygonQuery(mfm = "pCube1_LOD1")
Get material-ids for mesh
Returns a int array of material-ids for the processed mesh.
MEL
// execute SimplygonQuery with gmi-flag
$materialIds[] = `SimplygonQuery -gmi "pCube1_LOD1"`;
Python
# execute SimplygonQuery with gmi-flag
materialIds = cmds.SimplygonQuery(gmi = "pCube1_LOD1")
Get materials
Returns a string array of material-names from the most recent Simplygon run.
MEL
// execute SimplygonQuery with gm-flag
$materials[] = `SimplygonQuery -gm`;
Python
# execute SimplygonQuery with gm-flag
materials = cmds.SimplygonQuery(gm = True)
Get material channels for material
Returns a string array of material-channels from the given material.
MEL
// execute SimplygonQuery with gcm-flag
$materialChannels[] = `SimplygonQuery -gcm "SimplygonMaterial1"`;
Python
# execute SimplygonQuery with gcm-flag
materialChannels = cmds.SimplygonQuery(gcm = "SimplygonMaterial1")
Get texture-path for material-channel
Returns a string array of texture-paths from the given material-channel.
MEL
// execute SimplygonQuery with gtc-flag
$texturePath = `SimplygonQuery -gtc "SimplygonMaterial1" "Diffuse"`;
Python
# execute SimplygonQuery with gtc-flag
texturePath = cmds.SimplygonQuery(gtc = ["SimplygonMaterial1", "Diffuse"])
Mesh reuses materials
Returns a string array of materials that the mesh is reusing, empty if not reusing. Points into the material list that can get
MEL
// execute SimplygonQuery with rms-flag
$materials[] = `SimplygonQuery -rms "pCube1_LOD1"`;
Python
# execute SimplygonQuery with rms-flag
materials = cmds.SimplygonQuery(rms = "pCube1_LOD1")
Get material for mesh (deprecated)
Returns the first/only material-name for the processed mesh.
MEL
// execute SimplygonQuery with gmm-flag
$material = `SimplygonQuery -gmm "pCube1_LOD1"`;
Python
# execute SimplygonQuery with gmm-flag
material = cmds.SimplygonQuery(gmm = "pCube1_LOD1")
Mesh reuses material (deprecated)
Returns a the name of the material that the mesh is reusing, empty if not reusing.
MEL
// execute SimplygonQuery with mrm-flag
$material = `SimplygonQuery -mrm "pCube1_LOD1"`;
Python
# execute SimplygonQuery with mrm-flag
material = cmds.SimplygonQuery(mrm = "pCube1_LOD1")