Home  Previous Next

command (MEL/Python)

MGPickerService

Go to: MEL synopsis. Python synopsis. Return value. Flags. MEL examples. Python examples.

MEL Synopsis

MGPickerService [-cleanNamespaceMix] [-getViewCoordinate] [-modelEditorSize] [-namespaceFromSelection] [-namespace] [-osLanguage] [-resolvePath] [-translate] [-translate1] [-translate2] [-unzip] [-zipFileFolder]

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

Return value

Depend on the flag, the return value could be string, boolean, etc.

Flags

cleanNamespaceMix, getViewCoordinate, modelEditorSize, namespaceFromSelection, namespace, osLanguage, resolvePath, translate, translate1, translate2, unzip, zipFileFolder

 

Long name (short name)

Argument types

Properties

-cleanNamespaceMix(-cnm)

string

query

 

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


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


This is a query only flag that can be used to query for the size of a modelEditor.

-namespaceFromSelection(-nfs)

boolean

query


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


Retrieve the namespace from a node dag path or node name.

-osLanguage(-osl)

 

query


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


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)

string

query


Internal use only. This is a query only flag that return a translated string for a string id.

-translate1(-tr1)

string string

query


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


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


Unzip the zip file to target directory path assigned by the argument.

-zipFileFolder(-zip)

string

createquery


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.

 


create Flag can appear in Create mode of command

edit Flag can appear in Edit mode of command

query Flag can appear in Query mode of command

multiuse 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

import maya.cmds as cmd

cmd.MGPickerService("D:/test.zip", zipFileFolder="D:/test")

#list out the zip package content:
print ("The contents in test.zip:\n")
print (cmd.MGPickerService("D:/test.zip", q=True,zip=True))

#unzip to another directory:
cmd.MGPickerService("D:/test.zip", unzip="D:/test/unzipped/")

 

Home Previous Next