command (MEL/Python)
|
MGPickerView
|
Go to: Synopsis. MEL examples. Python examples.
Synopsis
MGPickerView (viewIDString, [activate=boolean], [addPanel=string, string], [activePanelIndex=int], [alignSelection=unsigned int], [applyStyle=string, string, string], [author=string], [backgroundColor=float float float float], [close=boolean], [clearSelection=boolean], [distributeSelection=string], [email=string], [exportPathToNode=[string, string]], [exist=boolean], [freeNavigation=boolean], [fileVersion=boolean],[getIdFromName=string],[groupSelection=boolean],[inboundSelection=boolean],[isTemp=boolean], [listLinks=string], [list=string],[mirrorSelection=int], [message=string], [namespaceChangedCommand=[string, string]], [namespace=string], [namespaceSeparator=string], [pickerDirPath=boolean],[pickerEnterCommand=string, string], [pickerFilePath=boolean], [pickerLoadCommand=[string, string]], [parentSelectionToLast=boolean], [removeAll=boolean], [remove=string], [saveAs=string], [saveAsSceneNode=[string, boolean], [saveAsTemplate=string], [setClean=string], [select=string],[selectGroupButtons=int], [selectPickerButtons=int],[selectMode=int], [selectPanelButtons=int], [selectPanelIndexButtons=[int, int]], [syncPickerValue=boolean], [saveToFolder=string], [saveWithinSceneFolder=boolean], [tabLabel=string], [ungroupSelection=boolean],[unparentSelection=boolean], [updateSceneBoundary=boolean], [unstackSelection=String, UnsignedInt], [website=string] [zMoveSelection=string])
MGPickerView is NOT undoable, queryable, and editable.
This command queries / edit the picker document level attributes and states.
You need to specify a picker view id string in order to query / edit it, if you does not specify any id then current active picker view will be queried / edited.
To retrieve a picker view id, use one of following commands:
MGPicker -q -currentPickerView; // Get current script execution view id, eg. picker load command, picker mouse enter command. Only be set during the script being executed.
MGPicker -q -activePickerView; // Get current active view id.
MGPicker -q -findPickerView "pickerNodeOrFileName" 1 "namespace"; // Find picker view id via picker node name or picker file name and namespace.
MGPicker -q -listAllPickerViews; // List ids of all opened picker views.
MGPicker -e -createTempPicker; // Create a temporary picker view and return its id.
MGPicker -e -createPicker "pickerName" "namespace" "filePath" "nodeName"; // Create a picker view and return its id.
MGPicker -e -readPickerNode "nodeName"; // Read in-scene picker node and return its id.
MGPicker -e -readScenePicker "nodeName" "pickerName" "namespace" "pickerDataString"; // Read in-scene picker node and return its id.
MGPicker -e -readPickerFile "pickerFilePath" 1; // Read a picker file and return its id.
Long name (short name)
|
Argument types
|
Properties
|
-activate(-act)
|
|
![query query](query.gif) ![edit edit](edit.gif)
|
|
In query mode, this returns if a picker view id is activated.
In Edit mode, this active a picker view by its id.
|
|
-addPanel(-ap)
|
|
![edit edit](edit.gif)
|
|
Edit only flag, specify the panel label, and the panel layout: "horizontal" or "vertical" to add a new panel to picker view. This will return the panel id string.
|
|
-activePanelIndex(-api)
|
|
![edit edit](edit.gif)
|
|
Edit only flag, specify a panel index number, and the picker view will zoom and pan itself to frame the picker panel. A panel index is the number shown in [ ] in the title area of each picker panel.
|
|
-alignSelection(-asl)![v2_transparent](v2_transparent.png)
|
|
![edit edit](edit.gif)
|
|
Edit only flag, align selected picker items in a certain way:
0=ParentHorizontalCenter, 1=ParentVerticalCenter, 2=HorizontalCenter, 3=VerticalCenter, 4=Left, 5=Right, 6=Top, 7=Bottom
|
|
-applyStyle(-ast)![v2_transparent](v2_transparent.png)
|
|
![edit edit](edit.gif)
|
|
Apply a style to picker scene. You need to specify:
1st string: source style, it is either the style family name(s) in default user style directory; absolute path(s) to family directory(s), or absolute to one or more .mgstyle files. Multiple input needs to be joined by the character ",".
2nd string: destination mgpicker items, it is either empty, meaning it will apply style to every item in the picker, or you can specify item IDs joined by the character ",", e.g. "itemId1,itemID2,itemID3" to apply style to these items only.
3rd string: the apply option in the format of "key=0,key=1", supported values like "restrictType=1,panelbackground=1", for boolean option, you can omit "=1", like "restrictType,panelbackground".
By default, restrictType=1, and panelbackground=0.
|
|
-author(-ath)
|
string
|
![query query](query.gif) ![edit edit](edit.gif)
|
|
When queried, this flag returns a string of the picker author. In edit mode, specify a string to be the author of picker.
|
|
-backgroundColor(-bgc)![v2_transparent](v2_transparent.png)
|
float float float float
|
![query query](query.gif) ![edit edit](edit.gif)
|
|
The background color of the picker scene.
|
|
-close(-cl)
|
boolean
|
![edit edit](edit.gif)
|
|
Close the picker view, specify a boolean value of true to force close it even if the edits are not saved.
|
|
-clearSelection(-csl)
|
|
![edit edit](edit.gif)
|
|
Deselect all picker items of the picker view.
|
|
-distributeSelection(-dis)![v2_transparent](v2_transparent.png)
|
string
|
![edit edit](edit.gif)
|
|
Edit only flag to evenly space out the selected picker items, with case-insensitive mode string: "vertical" or "horizontal".
|
|
-duplicateSelection(-ds)![v2_transparent](v2_transparent.png)
|
UnsignedInt
|
![edit edit](edit.gif)
|
|
Edit only flag to duplicate the selected items in a certain direction or mode:
0=Right, 1=Down, 2=Up, 3=Left, 4=Mirror
The duplicated new item IDs will be returned.
|
|
-email(-eml)
|
string
|
![query query](query.gif) ![edit edit](edit.gif)
|
|
When queried, this flag returns a string of the picker author's email. In edit mode, specify a string to be the email address of picker.
The animator could use the email address to provide their feedback about your picker.
|
|
-exportPathToNode(-epn)
|
string string
|
![edit edit](edit.gif)
|
|
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 query](query.gif)
|
|
Return true or false the specify picker view id exists.
|
|
-freeNavigation(-fn)![v2_transparent](v2_transparent.png)
|
boolean
|
![query query](query.gif) ![edit edit](edit.gif)
|
|
If False, then only the positive quadrant will be seen, otherwise, the user can pan / zoom around to see other quadrants in the coordinate.
By default it is False.
|
|
-fileVersion (-fv)
|
|
![query query](query.gif)
|
|
Query only. This flag return the file version of the picker view.
|
|
-getIdFromName (-gin)
|
string
|
![query query](query.gif)
|
|
Query only. Provided a name, return all the picker items that has the name in the picker view.
Even if there is only one match, it will still return a string array that contain only one element.
It is useful for avoiding hard-coding the id in your script, so you just use name to get the id, and do further picker item property query/edit.
|
|
-groupSelection(-gs)![v2_transparent](v2_transparent.png)
|
|
![edit edit](edit.gif)
|
|
Edit only flag to group selected picker items and return the new group id.
|
|
-inboundSelection(-ibs)![v2_transparent](v2_transparent.png)
|
|
![edit edit](edit.gif)
|
|
Edit only flag to move items back into the visible area of a group or picker panel. The previous picker view selection will be cleared and the moved items will be selected.
If you select groups/panels and inboundSelection, all their children will be inbound. Otherwise only selected items will be inbound.
|
|
-isTemp(-it)![v2_transparent](v2_transparent.png)
|
|
![query query](query.gif)
|
|
Query only flag. Return if the picker view is a temp picker view.
|
|
-listLinks(-ll)
|
string
|
![query query](query.gif)
|
|
Query only flag. Return all the link IDs of a certain link type as a string array, in "sourceItemId > targetItemId" format;
Specify a type string as the argument, values include "parentlink", "attributelink" (case-insensitive), you could specify empty string or "parentlink|attributelink" to return all types of links.
|
|
-list(-ls)
|
string
|
![query query](query.gif)
|
|
Query only flag. Return all the picker item IDs of a certain type as a string array.
Specify a type string as the argument, values include "selectButton", "commandButton", "attributeButton", "slider", "sliderHandle", "text", "panel" (case-insensitive), a empty string will return all the picker item IDs.
The type string also support combination: say if you wanna list all select buttons and command buttons, you could use "selectButton|commandButton".
|
|
-mirrorSelection(-ms)
|
int
|
![edit edit](edit.gif)
|
|
Utilize the mirror relationship of picker items, mirror the scene selection in one of these mode:
0 = replace selection ,1 = add selection, 2 = deselect, 3 = invert selection.
|
|
-message(-msg)
|
string
|
![edit edit](edit.gif)
|
|
When queried, this flag returns a string of the picker author's message. In edit mode, specify a string to be the message of picker.
The picker designer use this to say something to all the animators who use this picker.
|
|
-namespaceChangedCommand(-ncc)
|
string script
|
![query query](query.gif) ![edit edit](edit.gif)
|
|
Query/edit the namespace changed command of picker file / node.
The namespace changed command will be executed after you changed the namespace of the picker view.
In query mode, this will return a string array, the first element is "mel/python" indicate the command type, the second element contains the actual command code.
In edit mode, specify the first argument "mel/python" and second argument the actual command code to edit the namespace changed command.
|
|
-namespace(-ns)
|
string
|
![query query](query.gif) ![edit edit](edit.gif)
|
|
When queried, this flag returns the picker's namespace. In edit mode, specify a string as the picker's namespace.
The string should obey to namespace naming convention, any invalid characters will be converted to '_'.
|
|
-namespaceSeparator(-nsp)![v2_transparent](v2_transparent.png)
|
string
|
![query query](query.gif) ![edit edit](edit.gif)
|
|
When queried, this flag returns the separator characters between picker's namespace and object base name or sub-namespace. In edit mode, specify a string as the picker's namespace separator.
Use empty namespace to use the default namespace separator, e.g. for Maya, it is ':'.
|
|
-pickerDirPath(-pdp)
|
|
![query query](query.gif)
|
|
This is a query only flag that can be used to query for the directory path name of the picker file.
|
|
-pickerEnterCommand(-pec)
|
string script
|
![query query](query.gif) ![edit edit](edit.gif)
|
|
Query/edit the mouse enter command of picker file / node.
The enter command will be executed whenever your mouse enter the picker view.
In query mode, this will return a string array, the first element is "mel/python" indicate the command type, the second element contains the actual command code.
In edit mode, specify the first argument "mel/python" and second argument the actual command code to edit the load command.
|
|
-pickerFilePath(-pfp)
|
|
![query query](query.gif)
|
|
This is a query only flag that can be used to query for the path name of the picker file.
|
|
-pickerLoadCommand(-plc)
|
string script
|
![query query](query.gif) ![edit edit](edit.gif)
|
|
Query/edit the load command of picker file / node.
The load command will be executed once after the picker file / node is loaded.
In query mode, this will return a string array, the first element is "mel/python" indicate the command type, the second element contains the actual command code.
In edit mode, specify the first argument "mel/python" and second argument the actual command code to edit the load command.
|
|
-parentSelectionToLast(-psl)![v2_transparent](v2_transparent.png)
|
|
![edit edit](edit.gif)
|
|
Edit only flag to parent selected items to the last selection which must be a group or a picker panel. Return the number of items get parented to the last selected group/panel.
|
|
-removeAll(-ra)
|
|
![edit edit](edit.gif)
|
|
This is a edit only flag that can be used to clear all the content of the picker.
|
|
-remove(-ra)
|
string
|
![edit edit](edit.gif) ![multiuse](multiuse.gif)
|
|
Edit only flag. Specify a picker item id to delete it from the view. Support multiple use in one single command.
|
|
-saveAs(-sa)
|
string boolean
|
![edit edit](edit.gif)
|
|
This is a edit only flag that can be used to save the picker file / node to another picker name. The saved picker file will be stored within the current picker project folder in the maya's user application directory / MG_PickerData.
Specify the target picker name and a boolean control whether or not override existed. Notice that the picker view id will stay unchanged.
|
|
-saveAsSceneNode(-sas)
|
string boolean
|
![edit edit](edit.gif)
|
|
This is a edit only flag that can be used to save picker file / node to another picker node, specify a 0~1 boolean value to indicate the picker view should be changed to refer to the saved node.
So 0 means exporting the picker node, 1 means save current picker as the target picker node. No matter what, it always override if the node already exists.
Notice that the picker view id will stay unchanged.
|
|
-saveAsTemplate(-sat)
|
string boolean
|
![edit edit](edit.gif)
|
|
This is a edit only flag that can be used to save picker file / node to picker template. Specify a picker template name to save to, a boolean value to control whether or not we override even the template already exist. If empty string is specified, a automatic template name will be used. Notice that the picker view id will stay unchanged.
|
|
-setClean(-sc)
|
|
![edit edit](edit.gif)
|
|
This is a edit only flag that can be used to mark the picker view as clean, this will remove the * sign from the tab.
|
|
-select(-sel)
|
string
|
![query query](query.gif) ![edit edit](edit.gif) ![multiuse](multiuse.gif)
|
|
In query mode, this returns the selected picker item IDs. In edit mode it is multi-usable, this perform picker item selection via IDs, you might need to use -selectMode to cooperate with this flag.
|
|
-selectGroupButtons(-sgb)![v2_transparent](v2_transparent.png)
|
int
|
![edit edit](edit.gif)
|
|
This is a edit only flag to evaluate all the select button within a group, with select mode of:
0 = replace selection ,1 = add selection, 2 = deselect, 3 = invert selection.
This is semi-internal use, as it requires the cursor over the group, it may only work when you implement right-click context menu feature over the group.
|
|
-selectPickerButtons(-skb)
|
int
|
![edit edit](edit.gif)
|
|
This is a edit only flag that can be used to eval all the select-buttons in picker, select their members in maya scene. This does not select related maya nodes from attribute buttons and sliders.
It is often used in the "Select All" command button. Use 0~3 int to specify the select mode:
0 = replace selection ,1 = add selection, 2 = deselect, 3 = invert selection.
|
|
-selectMode(-sm)
|
int
|
![edit edit](edit.gif)
|
|
This is a edit only flag that can be used to with -select falg to select picker items in picker view. Use 0~3 int to specify the select mode:
0 = replace selection ,1 = add selection, 2 = deselect, 3 = invert selection.
|
|
-selectPanelButtons(-spb)
|
int
|
![edit edit](edit.gif)
|
|
This is a edit only flag that can be used to evaluate all the select-buttons within picker panel, select their members in maya scene.
The command use current mouse position to decide which picker panel to eval all its children select-buttons.
It is often used in the "Select All" command button for picker panel. Use 0~3 int to specify the select mode:
0 = replace selection ,1 = add selection, 2 = deselect, 3 = invert selection.
This is semi-internal use, as it requires the cursor over the group, it may only work when you implement right-click context menu feature over the panel.
|
|
-selectPanelIndexButtons(-spi)
|
int int
|
![edit edit](edit.gif)
|
|
This is a edit only flag that can be used to eval all the select-buttons within the picker panel with the panel index, select their members in maya scene. This does not select related maya nodes from attribute buttons and sliders.
It is often used in the "Select *" command button for picker panel. Use 0~3 int to specify the select mode:
0 = replace selection ,1 = add selection, 2 = deselect, 3 = invert selection.
You must specify a valid panel index int for the second argument.
|
|
-syncPickerValue(-spv)
|
|
![edit edit](edit.gif)
|
|
Sync all the picker items values with maya scene, in a programming approach. eg. attr-button value, slider values.
This will validate all sync-watchers for newly created nodes or loaded referenced nodes.
Usually this is done automatically when maya attribute changed.
|
|
-saveToFolder(-stf)
|
string boolean
|
![edit edit](edit.gif)
|
|
This is a edit only flag that can be used to save picker file / node within target directory. The saved picker file will be within target directory/pickername/ directory.
Specify a boolean to control a force override if file already exist. Notice that the picker view id will stay unchanged.
|
|
-saveWithinSceneFolder(-sws)
|
boolean
|
![edit edit](edit.gif)
|
|
This is a edit only flag that can be used to save picker file / node to current maya scene directory / pickers folder. This directory will be auto-searched for related picker file.
Specify a boolean to control a force override if file already exist. Notice that the picker view id will stay unchanged.
|
|
-tabLabel(-tl)
|
string
|
![query query](query.gif) ![edit edit](edit.gif)
|
|
In query mode, this return the tab label of current picker view.
In edit mode, this edit the tab label of current picker view, as well as the view's internal picker name.
|
|
-ungroupSelection(-ugs)![v2_transparent](v2_transparent.png)
|
|
![edit edit](edit.gif)
|
|
Edit only flag to ungroup selected picker items from their parent groups or picker panels, and remove the groups or picker panels; If groups or panels are selected then they will be removed and their old children will be reparented to the group or panel's parent. The number of group removed will be returned.
|
|
-unparentSelection(-ups)![v2_transparent](v2_transparent.png)
|
|
![edit edit](edit.gif)
|
|
Edit only flag to unparent items from their parent groups or picker panels, these group or panels will not be removed. The number of items unparented will be returned.
The selected items will be parent to scene.
|
|
-updateSceneBoundary(-usb)
|
|
![edit edit](edit.gif)
|
|
Update the picker scene display area boundary, to show all the picker items.
You may need to use this flag in the converter, after all picker item have been created.
|
|
-unstackSelection(-uss)![v2_transparent](v2_transparent.png)
|
string Int
|
![edit edit](edit.gif)
|
|
Edit only flag to unstack selected items that are overlapped with each other.
You need to specify "horizontal" or "vertical" for the direction, and unstack mode of 0=simpleMode, 1=hierarchicalMode.
|
|
-website(-www)
|
string
|
![query query](query.gif)
|
|
When queried, this flag returns the website of the current picker author. In edit mode, specify a string to be the website address of current picker.
The animator could visit the website to know more about the picker designer.
|
|
-zMoveSelection(-zms)![v2_transparent](v2_transparent.png)
|
string
|
![edit edit](edit.gif)
|
|
Edit only flag to send selected picker items to bottom or bring them to top. Possible argument values are "top" or "bottom". The number of items whose zvalues were changed will be returned.
|
|
|
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
// 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
from mgpicker import mgp
#Create a new picker named "myPicker"
#it is a untitled picker, not refer to a picker file / node.
viewId = mgp.MGPicker (edit=True,createPicker=("myPicker","wrongNamespace","",""))
mgp.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.
mgp.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.
mgp.MGPickerView(viewId, edit=True, updateSceneBoundary=True) #update the scene boundary to show all the picker items.
mgp.MGPickerView(viewId, edit=True, setClean=True) #set the picker we just created clean.
|