command (MEL/Python)
|
MGPickerService
|
Go to: Synopsis. MEL examples. Python examples.
Synopsis
MGPickerService (string, [cleanNamespaceMix=[string]],[getViewCoordinate=[string, float, float, float]], [modelEditorSize=string], [namespaceFromSelection=boolean], [namespace=string], [osLanguage=boolean],[resolvePath=string], [translate=string], [translate1=[string, string]], [translate2=[string, string, string]], [unzip=string], [zipFileFolder=string])
Note: Strings representing zip full path when used with zip related flags. This is not depicted in the synopsis.
MGPickerService is NOT undoable, queryable, and editable.
This command provide zipping, translation, coordinate mapping services. It is mainly for internal use.
Long name (short name)
|
Argument types
|
Properties
|
-cleanNamespaceMix(-cnm)
|
string
|
![query query](query.gif)
|
|
Remove the non-namespace head from a dag path, eg.
|path|to|myChar:control|myChar:subControl ----> myChar:control|myChar:subControl
myChar:control|myChar:subControl will remain the same.
myChar:control|myChar:subControl|the|control will remain the same.
|
|
-getViewCoordinate(-gvc)
|
string float float float
|
![query query](query.gif)
|
|
This is a query only flag that can be used to query for the view coordinate via the world coordinate.
You need to specify the modelEditor name and the x,y,z world coordinate, the flag will return an int array, first element is 0~1 indicating the point is within the viewport or not, another two elements are x, y view coordinates.
|
|
-modelEditorSize(-mes)
|
string
|
![query query](query.gif)
|
|
This is a query only flag that can be used to query for the size of a modelEditor.
|
|
-namespaceFromSelection(-nfs)
|
boolean
|
![query query](query.gif)
|
|
Get the namespace from current selected node, specify True means if first selected node contain no namespace, it will continue to the next selected node, False means it will stop at first selected node anyway.
|
|
-namespace(-ns)
|
string
|
![query query](query.gif)
|
|
Retrieve the namespace from a node dag path or node name.
|
|
-osLanguage(-osl)
|
|
![query query](query.gif)
|
|
This is a query only flag that can be used to query for the language that probably need to be used in your operation system
|
|
-resolvePath(-rp)
|
string string
|
![query query](query.gif)
|
|
Resolve the file path that contains environment variable denoted by $ or ${} to actual file path.
The first argument is the path to resolve, the second argument is the picker node you wanna resolve the file path attribute from, this one is optional, only in case when ${M_CURRENT_ASSET_DIR} is specified in path.
Specify empty string if you don't need the second argument.
|
|
-translate(-tr)
|
|
![query query](query.gif)
|
|
Internal use only. This is a query only flag that return a translated string for a string id.
|
|
-translate1(-tr1)
|
string string
|
![query query](query.gif)
|
|
Internal use only. This is a query only flag that return a translated string for a string id and a string replacement.
|
|
-translate2(-tr2)
|
string string string
|
![query query](query.gif)
|
|
Internal use only. This is a query only flag that return a translated string for a string id and two string replacements.
|
|
-unzip(-uzp)
|
string
|
![create](create.gif)
|
|
Unzip the zip file to target directory path assigned by the argument.
|
|
-zipFileFolder(-zip)
|
string
|
![create](create.gif) ![query query](query.gif)
|
|
In query mode this flag returns all the folders and files in a zip file.
In creation mode, this package target file / directory into a zip file.
|
|
Flag can appear in Create mode of command
|
Flag can appear in Edit mode of command
|
Flag can appear in Query mode of command
|
Flag can be used more than once in a command.
|
MEL examples
//zip the folder into a zip package:
MGPickerService -zipFileFolder "D:/test" "D:/test.zip";
//list out the zip package content:
print "The contents in test.zip:\n";
print `MGPickerService -q -zip "D:/test.zip"`;
//unzip to another directory:
MGPickerService -unzip "D:/test/unzipped/" "D:/test.zip";
Python examples
from maya import cmds
cmds.MGPickerService("D:/test.zip", zipFileFolder="D:/test")
#list out the zip package content:
print ("The contents in test.zip:\n")
print (cmds.MGPickerService("D:/test.zip", q=True,zip=True))
#unzip to another directory:
cmds.MGPickerService("D:/test.zip", unzip="D:/test/unzipped/")
|