Home  Previous Next

command (MEL/Python)

MGPicker

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

MEL Synopsis

MGPicker [-about] [-aboutCurrentPicker] [-activate] [-addGenericPicker] [-activePickerArea] [-activePanelIndex] [-activePickerView] [-appendRecentPickerFile] [-appendRecentPickerNode][-addSearchPath] [-author] [-closeAll] [-currentAttributeName] [-config] [-currentItem] [-close] [-createPicker] [-recentPickerFiles] [-recentPickerNodes] [-currentPickerView] [-createTempPicker] [-deleteGenericPicker] [-dockPanelVisible] [-deleteSearchPath] [-evenlyDistributePickers] [-email] [-exportPathToNode] [-exist] [-fallbackPicker] [-findPickerView] [-getIdFromName] [-genericPickers] [-hotkeyOutliner] [-interactiveMode] [-listAllPickerViews] [-listLinks] [-list] [-menuItemCommand] [-mirrorSelection] [-message] [-namespace] [-openPicker] [-parent] [-pickerAreaCount] [-progressBar] [-popupColorEdit] [-pickerDirPath] [-pickerEnterCommand] [-pickerFilePath] [-programInfo] [-pickerLoaded] [-pickerLoadCommand] [-pickerLayout] [-pickerMode] [-popupNamespace] [-pickerProject] [-pickerToShelf] [-removeAll] [-readPickerFile] [-readScenePicker] [-saveAsSceneNode] [-saveAsTemplate] [-saveCurrentAs] [-selectionHelper] [-select] [-selectPickerButtons] [-selectPanelButtons] [-setPickerClean] [-selectPanelIndexButtons] [-searchPaths] [-syncPickerValue] [-searchUi] [-saveToFolder] [-saveWithinSceneFolder] [-tabLabel][-updateSceneBoundary] [-version] [-visible] [-website]

Python Synopsis

MGPicker ([about=boolean], [aboutCurrentPicker=boolean], [activate=[string, string]],[addGenericPicker=[string, int]],[activePickerArea=[int]], [activePanelIndex=int], [activePickerView=string], [appendRecentPickerFile=string], [appendRecentPickerNode=string][addSearchPath=[string, int]], [author=string], [closeAll=boolean], [currentAttributeName=int], [config=[string, string]], [currentItem=boolean], [close=[string, boolean, string]], [createPicker=[string, string, string, string]], [recentPickerFiles=[string]], [recentPickerNodes=[string]], [currentPickerView=[boolean]], [createTempPicker=boolean], [deleteGenericPicker=string], [dockPanelVisible=boolean], [deleteSearchPath=string], [evenlyDistributePickers=boolean], [email=string], [exportPathToNode=[string, string]], [exist=[boolean]],[fallbackPicker=string],[findPickerView=string, int, string],[getIdFromName=string],[genericPickers=string],[hotkeyOutliner=boolean],[interactiveMode=int],[listAllPickerViews=boolean],[listLinks=string], [list=string],[menuItemCommand=int], [mirrorSelection=int], [message=string], [namespace=string], [openPicker=boolean], [parent=string], [pickerAreaCount=boolean], [progressBar=int], [popupColorEdit=int], [pickerDirPath=boolean],[pickerEnterCommand=string, string], [pickerFilePath=boolean],[programInfo=boolean], [pickerLoaded=[string, string]],[pickerLoadCommand=[string, string]], [pickerLayout=string], [pickerMode=int], [popupNamespace=boolean], [pickerProject=string], [pickerToShelf=boolean], [removeAll=boolean], [readPickerFile=[string, boolean]], [readScenePicker=[string, string, string, string]], [saveAsSceneNode=[string, boolean], [saveAsTemplate=string], [saveCurrentAs=string], [selectionHelper=boolean], [select=int,stringArray], [selectPickerButtons=int], [selectPanelButtons=int], [setPickerClean=boolean], [selectPanelIndexButtons=[int, int]], [searchPaths=string],[syncPickerValue=boolean], [searchUi=boolean], [saveToFolder=string], [saveWithinSceneFolder=boolean], [tabLabel=string], [updateSceneBoundary=boolean], [version=boolean], [visible=boolean], [website=string])

MGPicker is NOT undoable, queryable, and editable.

This command queries / edit the picker document level attributes and states, as well as some program related attributes.

In creation mode, this command is used to create the MG-Picker widget, only one widget instance is allowed at a time, you will never need to use the command in creation mode.

Return value

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

Flags

about, aboutCurrentPicker, activate, addGenericPicker, activePickerArea, activePanelIndex, activePickerView, appendRecentPickerFile, appendRecentPickerNode, addSearchPath, author, closeAll, currentAttributeName, config, currentItem, close, createPicker, recentPickerFiles, recentPickerNodes, currentPickerView, createTempPicker, deleteGenericPicker, dockPanelVisible, deleteSearchPath, evenlyDistributePickers, email, exportPathToNode, exist, fallbackPicker, findPickerView, getIdFromName, genericPickers, hotkeyOutliner, interactiveMode, listAllPickerViews, listLinks, list, menuItemCommand, mirrorSelection, message, namespace, openPicker, parent, pickerAreaCount, progressBar, popupColorEdit, pickerDirPath, pickerEnterCommand, pickerFilePath, programInfo, pickerLoaded, pickerLoadCommand, pickerLayout, pickerMode, popupNamespace, pickerProject, pickerToShelf, removeAll, readPickerFile, readScenePicker,saveAsSceneNode,saveAsTemplate, saveCurrentAs, selectionHelper, select, selectPickerButtons, selectPanelButtons, setPickerClean, selectPanelIndexButtons, searchPaths, syncPickerValue, searchUi, saveToFolder, saveWithinSceneFolder, tabLabel, updateSceneBoundary, version, visible, website

 

Long name (short name)

Argument types

Properties

-about(-abt)

 

edit


Show "About MG-Picker Studio" dialog.

-aboutCurrentPicker(-acp)


edit


Show "About Current Picker" dialog. The dialog shows the name, email, website and message of picker designer.

-activate(-act)

string string

queryedit


In query mode, this returns if a provided picker file path / node is activated.

In Edit mode, you active a picker tab by assign a picker file path / picker node name. If the picker file / node has not been opened yet, this will won't open it. Return 1 if a picker tab been activated, 0 if failed.

Specify namespace string for the second parameter, if namespace is not empty, when checking to activate the picker view, it will check if the namespaces match too. Use empty namespace string if you don't want to check the namespace.

Alternatively, record the picker view id when you create it, and call this instead to activate it:

       MGPickerView -e -activate viewID;

-addGenericPicker(-agp)

string int

edit


This always affects only current picker project. Use it to add a generic picker name for current picker project. Specify a picker file name(without extension) and an int value stands for index. Specify index of -1 will append the picker name at the end, specify 0 to insert at the head. If the picker name already added to generic before, it will first remove it, and then insert it with the index you specified. The generic picker menu will update itself after the change.

-activePickerArea(-apa)

int

queryedit


Active picker area of specified area index, ranging from 0~3. The maximum of multiple picker view areas are 4, so the maximum of index value is 3.

However, there probably less than 4 views, so this maximum index value could be even smaller than 3, setting a index larger than supposed will just active the maximum index number.

-activePanelIndex(-api)

int

edit


Will be obsolete. Please use MGPickerView command instead:

           MGPickerView -e -activePanelIndex index;

-activePickerView(-apv)

string

queryedit


In query mode this return currently active picker view id, the id then could be used in MGPickerView command.

In edit mode, this activate the picker view specified by view id, for this purpose, MGPickerView is more suggested:

          MGPickerView -e -activate viewID;

-appendRecentPickerFile(-arf)

string

edit


Append a picker file path to the "Recent Picker Files" menu.

-appendRecentPickerNode(-arn)

string

edit


Append a picker node to the "Recent Picker Nodes" menu.

-addSearchPath(-asp)

string int

edit


This always affects only current picker project. Use it to add a custom picker searching path into the searching list for current picker project.

Specify a path string and an int value stands for searching priority. Specify priority of -1 will append the search path to the last to be the last searched, specify 0 to be the first to be searched.

-author(-ath)

string

queryedit


Will be obsolete. Please use MGPickerView command instead:

        MGPickerView -q -author;

        MGPickerView -e -author "Your Name";

-closeAll(-ca)

boolean

edit


Close all opened picker. Specify a 0~1 value to make the program close all the picker by force without any unsaved warning even in designer mode.

Be aware that in Animator mode, this won't warn any unsaved edit but close all pickers directly.

-currentAttributeName(-can)

boolean

query


Return the namespace:node.attribute string of current interacting attribute button.

For use with pre/post change command of attribute-button. If not argument or an  argument of 1 provided, the returned attribute will include the namespace, argument value of 0 will return attribute without namespace.

-config(-cfg)

string string

queryedit


Internal use only. For setting the specific user config. In query mode, this return the string array of for all the user configs if no arguments provided, otherwise, if you provide two arguments to query, it will return the specific config.

eg. MGPicker -q -config "language" "";

-currentItem(-ci)

 

query


Return the current interacting picker item id. For use in the picker item's change command, to query the item id the script belong to.

-close(-cl)

string boolean string

edit


Specify a picker path / picker node to close, specify an empty string to close current picker file/node.

Specify a 0~1 value as the secondary argument to make the program close the picker by force without any unsaved warning even in designer mode.

Specify a namespace string as the third argument, it it is not an empty string, when finding the target picker view to close, it will match the namespaces and close the picker view only if it has the same namespace.

Use empty namespace string if you don't want to check the namespace.

Be aware that in Animator mode, this won't warn any unsaved edit but close the picker directly.

-createPicker(-cp)

string string string string

edit


Specify the picker name, namespace, an optional picker file path or an optional picker node name, to create a new picker and return its id string.

For use in the picker converter, to create a new picker to contain the converted picker items.

-recentPickerFiles(-cpf)

string

queryedit


Return the full path list of recently opened picker files in query mode. In edit mode, with a maya menu item id string specified, it will clear its sub-menus and fill it with "recent picker files" menu.

-recentPickerNodes(-cpn)

string

queryedit


Return the list of recently loaded picker nodes in query mode. In edit mode, with a maya menu item id string specified, it will clear its sub-menus and fill it with "recent picker nodes" menu.

-currentPickerView(-cpv)

 

query


Query only flag. Like -currentItem flag, this return current interacting picker view id.

For use in the picker's load command and mouse enter command, to query the view id the script belong to.

Be careful to distinguish with -activePickerView flag, this current view only valid during picker load command and mouse enter command.

-createTempPicker(-ctp)

 

edit


Create a temporary picker view and return its id string, the view is untitled but with the ":Temp#" as tab label.

The temporary picker is for animator use only to contain their temporary picker items created in simple edit mode.

-deleteGenericPicker(-dgp)

string

edit


Delete a picker name from the generic pickers list. Specify an empty string to clear all the generic picker names. The generic picker menu will update itself after the change.

-dockPanelVisible(-dpv)

boolean

edit


Internal use only.

-deleteSearchPath(-dsp)

string

edit


Delete a custom search path from the picker searching directories list. Specify an empty string to clear all the custom searching paths.

The default searching path item, such as *[In-Scene], *[Scene/pickers], *[local] are not deletable.

-evenlyDistributePickers(-edp)


edit


Evenly distribute the picker tabs for all the visible picker view areas, so each picker layout area has a approximate number of picker tabs.

-email(-eml)

string

queryedit


Will be obsolete. Please use MGPickerView command instead:

        MGPickerView -q -email;

        MGPickerView -e -email "email@gmail.com";

-exportPathToNode(-epn)

string string

edit


Export picker file path to a picker node. Bascially it store a file path to a picker file, in pickerFilePath attribute in picker node.

When picker node is loaded, the picker file will be loaded instead. The file path support environment variable denoted by $ or ${}

Specify the node name to export / edit and the picker file path as arguments.

-exist(-ex)

 

query


Check if the picker ui exists.

-fallbackPicker(-fbp)

string

queryedit


When queried, this flag returns the fallback picker name.

With fallback picker name been set, if program cann't find any matched picker to maya selection, it will load fallback picker instead.

-findPickerView (-fpv)

string boolean string

query


Query only. This flag find and return a picker view id string, by searching and matching picker name and namespace. You must specify the picker file name / node name as first argument, a boolean to control whether to match namespace or not, and the namespace string.

-getIdFromName (-gin)

string

query


Will be obsolete. Please use MGPickerView command instead:

        string $ids [] = `MGPickerView -q -getIdFromName "name"`;

-genericPickers (-gps)

string

queryedit


Return string array containing all generic files in query mode, in edit mode, specify generic picker names joined by '|' to set the generic picker settings.

The generic picker menu will update itself after the change. Alternatively, use this to query / set the generic pickers:

         global string $MGPicker_Config_GenericPickerID;     // Don't change this value, it already defined.

         MGPicker -q -config $MGPicker_Config_GenericPickerID "";                        // This will return a string joined by '|'

         MGPicker -e -config $MGPicker_Config_GenericPickerID "genericPickerName1|genericPickerName2";           // This will set the generic pickers. Notice that it won't update the menu.

-hotkeyOutliner (-ho)

 

edit


Popup hotkey outliner, to checkout the hotkey set for MG-Picker Studio animator mode & designer mode.

Actually the hotkey outliner is also made by a mgpicker file.

-interactiveMode(-im)

int

queryedit


For internal use. When queried, this flag returns current tool index in animator mode, setting this flag will switch current tools in MG-Picker Studio.

Since this flag only works on animator mode, so current valid value range is [0~1], 0 for preview tool, 1 for simple edit tool.

-listAllPickerViews(-lav)

 

query


Query only flag. Return all the picker view id string array.

-listLinks(-ll)

string

query


Will be obsolete. Please use MGPickerView command instead:

        string $links [] = `MGPickerView -q -listLinks "parentLink"`;

-list(-ls)

string

query


Will be obsolete. Please use MGPickerView command instead:

        string $btns [] = `MGPickerView -q -list "selectButton|slider|sliderHandle"`;

-menuItemCommand(-mic)

int

query


Query only flag. Internal used only, to support the mel/python menu item command for each picker item.

-mirrorSelection(-ms)

int

edit


Will be obsolete. Please use MGPickerView command instead:

        MGPickerView -e -mirrorSelection 1;

-message(-msg)

string

edit


Will be obsolete. Please use MGPickerView command instead:

        MGPickerView -e -message "Thanks for using the picker I designed!";

-namespace(-ns)

string

queryedit


Will be obsolete. Please use MGPickerView command instead:

        MGPickerView -e -namespace "MyNS:SubNS";

-openPicker(-opp)


edit


Show file dialog to picker .mgpkr file to be opened / activated.

Use -rpf/-readPickerFile flag to open a picker file directly, or use  -rsp/-readScenePicker flag to read a in-scene picker node directly.

-parent(-p)

string

create


Internal use only. Use in creation mode to assign the picker widget's parent layout.

-pickerAreaCount(-pac)

 

query


Query only flag to get the visible count of picker area.

-progressBar(-pb)

int

queryedit


Specify 0~100 int value to show the progress bar in ui and set the percentage value, specify -1 to hide the progress bar.

-popupColorEdit(-pce)

int

edit


Internal use only. Pop up the color edit in simple edit mode. 0 for the item fill color, 1 for the item label color.

-pickerDirPath(-pdp)

 

query


Will be obsolete. Please use MGPickerView command instead:

        string $dirPath = `MGPickerView -q -pickerDirPath`;

-pickerEnterCommand(-pec)

string string

queryedit


Will be obsolete. Please use MGPickerView command instead:

        string $enterCommand[] = `MGPickerView -q -pickerEnterCommand`;

-pickerFilePath(-pfp)

 

query


Will be obsolete. Please use MGPickerView command instead:

        string $dirFilePath = `MGPickerView -q -pickerFilePath`;

-programInfo(-pi)

 

query


Return MG-Picker Studio program launching information.

-pickerLoaded(-pl)

string string

query


This is a query only flag that can be used to query for if a picker file or node is loaded.

Specify a picker file path or a node name for the first parameter, specify namespace string for the second parameter, if namespace is not empty, when checking if a picker loaded, it will check if the namespaces match too.

Use empty namespace string if you don't want to check the namespace.

-pickerLoadCommand(-plc)

string string

queryedit


Will be obsolete. Please use MGPickerView command instead:

        string $loadCommand[] = `MGPickerView -q -pickerLoadCommand`;

-pickerLayout(-ply)

string

queryedit


Query / specify the picker view layout. In edit mode, valid string values are: "Single","Column2","Column3","Column4","Row2","Row3","Row4","Col2SplitLeft","Col2SplitRight","Row2SplitTop","Row2SplitBottom","GridVerticalUnified","GridHorizontalUnified","GridBothUnified".

-pickerMode(-pm)

int

queryedit


Internal use only.  In query mode this return if current is in Animator mode / Designer mode.

The edit mode is only used to assistant the switch of the mode, you don't need to use this flag.

-popupNamespace(-pns)


edit


Pop up the namespace setting dialog to change the namespace of current picker.

-pickerProject(-ppj)

string

queryedit


In query mode this return current picker project name, by default it is "Default".

In edit mode, this edit current picker project. The picker project is used when searching for a related picker file for scene selection.

If the target picker project name does not exist, this will create the project folder and set as current picker project.

-pickerToShelf(-pts)


edit


Pop up the "Convert Picker Items To Shelves" dialog, which you could use to convert picker items to maya's shelves.

-removeAll(-ra)


edit


Will be obsolete. Please use MGPickerView command instead:

        MGPickerView -e -removeAll;

-readPickerFile(-rpf)

string boolean

edit


This is a edit only flag that can be used to read and load the picker file and return the picker view id string.

If it is already opened, and the second parameter is false or 0, this will activate the tab and return.

If the second parameter is specified to true or 1, it will read the picker into new picker view anyway.

Use -opp/-openPicker to provide user a file dialog to picker a picker file.

-readPickerNode(-rsp)

string

edit


This is a edit only flag that can be used to read and load the in-scene picker node and return the picker view id string.

Specify a picker node name to read, if the node already loaded in picker view, it will activate it and return the view id string.

-readScenePicker(-rsp)

string string string string

edit


This is a edit only flag that can be used to read and load the in-scene picker node and return the picker view id string.

Instead of simply specify a picker node name, you must get the datas in mel/python, and specify the node name, picker name, namespace and the picker xml data string to read the and load the picker node.

-saveAsSceneNode(-sas)

string boolean

edit


Will be obsolete. Please use MGPickerView command instead:

        MGPickerView -e -saveAsSceneNode "sceneNodeName" 0;

-saveAsTemplate(-sat)

string boolean

edit


Will be obsolete. Please use MGPickerView command instead:

        MGPickerView -e -saveAsTemplate "myTemplate" 0;

-saveCurrentAs(-sca)

string boolean

edit


Will be obsolete. Please use MGPickerView command instead:

        MGPickerView -e -saveAs "newPickerName" 0;

-selectionHelper(-seh)

 

edit


Create a show a MG-Select Helper window.

-select(-sel)

int stringArray

queryedit


Will be obsolete. Please use MGPickerView command instead:

        MGPickerView -e -select "selectButton1" -select "commandButton1" -selectMode 1;

-selectPickerButtons(-skb)

int

edit


Will be obsolete. Please use MGPickerView command instead:

        MGPickerView -e -selectPickerButtons 1;

-selectPanelButtons(-spb)

int

edit


Will be obsolete. Please use MGPickerView command instead:

        MGPickerView -e -selectPanelButtons 0;

-setPickerClean(-spc)

 

edit


Will be obsolete. Please use MGPickerView command instead:

        MGPickerView -e -setClean;

-selectPanelIndexButtons(-spi)

int int

edit


Will be obsolete. Please use MGPickerView command instead:

        MGPickerView -e -selectPanelIndexButtons 1 0;

-searchPaths(-sps)

string

queryedit


In query mode this returns string array of searching paths for current picker project.

In edit mode, specify paths joined with character '|' to be the search paths. Notice that these values are always there: *[In-Scene], *[Scene/pickers], *[Local]

-syncPickerValue(-spv)

 

edit


Will be obsolete. Please use MGPickerView command instead:

        MGPickerView -e -syncPickerValue;

-searchUi(-sru)

boolean

queryedit


In edit mode, this shows / hides the node/attribute searching UI in animator mode.

In query mode this return the visibility of searching UI.

-saveToFolder(-stf)

string boolean

edit


Will be obsolete. Please use MGPickerView command instead:

        MGPickerView -e -saveToFolder "/path/to/folder" 1;

-saveWithinSceneFolder(-sws)

boolean

edit


Will be obsolete. Please use MGPickerView command instead:

        MGPickerView -e -saveWithinSceneFolder 0;

-tabLabel(-tl)

string

queryedit


Will be obsolete. Please use MGPickerView command instead:

        MGPickerView -e -tabLabel "pickerTab";

-updateSceneBoundary(-usb)

 

edit


Will be obsolete. Please use MGPickerView command instead:

        MGPickerView -e -updateSceneBoundary;

-version(-v)


query


This is a query only flag that can be used to query for the float version of current MG-Picker Studio.

-visible(-vis)

boolean

createedit


Internal use only. Set the visibility of the picker widget.

-website(-www)

string

query


Will be obsolete. Please use MGPickerView command instead:

        MGPickerView -e -website "http://mgland.com";

 


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

// create a new picker named "myPicker"

string $view = `MGPicker -e -createPicker "myPicker" "wrongNamespace" "" ""`;   //it is a untitled picker, not refer to a picker file / node.

MGPickerView -e -namespace "rightNamespace" $view;          //edit the namespace of the picker.

 

//To-Do: use MGPickerItem command to created picker items.

//....

//if you does create any picker items, this picker view will be completely empty.

MGPickerView -e -author "Miguel" 

         -website "http://twincodes.com" 

         -email "mgpickerstudio@gmail.com"

         -message "Feel free to send feedback to me!" 

         $view;  //edit the meta info of the current picker file.

 

MGPickerView -e -updateSceneBoundary $view;  //update the scene boundary to show all the picker items.

MGPickerView -e -setClean $view;   //set the picker we just created clean.

Python examples

import maya.cmds as cmd
#Create a new picker named "myPicker"
#it is a untitled picker, not refer to a picker file / node.
viewId = cmds.MGPicker (edit=True,createPicker=("myPicker","wrongNamespace","",""))
cmds.MGPickerView(viewId, edit=True,namespace="rightNamespace")    #edit the namespace of the picker.

#To-Do: use MGPickerItem command to created picker items.
#....
#if you does create any picker items, this picker view will be completely empty.
cmds.MGPickerView(viewId, edit=True, author="Miguel",
                 website="http://twincodes.com",
                 email="mgpickerstudio@gmail.com",
                 message="Feel free to send feedback to me!")  #edit the meta info of the current picker file.
cmds.MGPickerView(viewId, edit=True, updateSceneBoundary=True)  #update the scene boundary to show all the picker items.
cmds.MGPickerView(viewId, edit=True, setClean=True)   #set the picker we just created clean.

 

Home Previous Next