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
|

|
|
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
|

|
|
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
|

|
|
This is a query only flag that can be used to query for the size of a modelEditor.
|
|
-namespaceFromSelection(-nfs)
|
boolean
|

|
|
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
|

|
|
Retrieve the namespace from a node dag path or node name.
|
|
-osLanguage(-osl)
|
|

|
|
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
|

|
|
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)
|
|

|
|
Internal use only. This is a query only flag that return a translated string for a string id.
|
|
-translate1(-tr1)
|
string string
|

|
|
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
|

|
|
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
|

|
|
Unzip the zip file to target directory path assigned by the argument.
|
|
-zipFileFolder(-zip)
|
string
|
 
|
|
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/")
|