command (MEL/Python)
|
MGPickerItem
|
Go to: Snopsis. MEL examples. Python examples.
Synopsis
MGPickerItem (itemIdString, [attributeIconOption=string], [attributeIcons=string], [applyMirroredAttribute=boolean], [annotation=string], [addSelectMember=string], [attributeType=string], [attribute=string], [attributeValue=float], [bgHorizontalAlign=string], [backgroundImage=string], [bgKeepRatio=boolean], [bgMargin=[int, int, int, int]], [boolState=[boolean]], [backgroundSVGElement=[string]], [bgScaleFit=boolean], [bevel=boolean], [bgVerticalAlign=string], [command=string], [closeCurve=boolean], [children=UnsignedInt], [clearSelectMembers=boolean], [commandType=string], [componentWidth=int], [componentWidthPolicy=string], [drawBGRect=boolean], [drawBackgroundShape=boolean], [exist=boolean], [fillColor=[float, float, float, float]], [flipImageHorizontally=boolean], [forceImageMargin=boolean], [flipImageVertically=boolean], [frameColor=[float, float, float, float]], [frameVisible=boolean], [fullNamespace=boolean], [floatState=float], [gradient=boolean], [gradientMode=int], [height=int], [highlightImage=string], [hoverLightness=int], [highlightSvgElement=string], [hoverSvgElement=string], [hoverImage=string],[image=string], [interactive=boolean], [imageKeepRatio=boolean], [imageMargin=[int, int, int, int]], [intState=[int]], [imageScaleFit=[boolean]], [label=string], [labelBold=boolean], [labelColor=[float, float, float, float]], [labelFont=string], [labelFontSize=int], [labelHorizontalAlign=string], [labelItalic=boolean], [links=boolean], [leftMenuPolicy=string], [labelPosition=string], [leftSlope=int], [labelVerticalAlign=string], [masterButtons=boolean], [mirror=string],[name=string], [opacity=float], [parent=string], [postAction=string], [panelContentPadding=boolean], [pressedImage=string], [postChangeCommand=string], [postChangeCommandType=string], [preChangeCommand=string], [preChangeCommandType=string], [pressedSvgElement=string], [queryObjects=boolean], [rotation=int], [roundness=int], [rightMenuPolicy=string], [resizePreferSize=boolean], [removeSelectMember=string], [rightSlope=int], [shape=boolean], [slaveButtons=boolean], [strokeColor=[float, float, float, float]], [sliderChangeCommand=string], [sliderChangeCommandType=string], [shapeDirection=string], [svgElement=string], [select=int], [sliderHandle=boolean], [sliderHAttribute=string],[sliderHMin=float], [sliderHRange=boolean], [sliderHSpeed=float], [sliderHValue=float], [sliderHMax=float],[showItemTip=string], [slider=boolean], [selectMembers=string],[subNamespaceSeparator=string], [subNamespace=string],[stringState=string], [supportShapeTypes=boolean], [strictClick=boolean], [sliderUseHAttribute=boolean], [sliderUseVAttribute=boolean], [sliderVAttribute=string], [sliderVMin=float], [sliderVRange=boolean], [sliderVSpeed=float], [sliderVValue=float], [sliderVMax=float], [strokeWidth=int], [type=string], [useAutoAnnotation=string], [usePickerNamespace=boolean], [view=string], [viewAnchor=string], [valueColor=[float, float, float, float]], [visible=boolean], [viewMargin=[int, int, int, int]], [visibilityOperator=string],[viewStretch=boolean], [width=int], [widgetMargins=[int, int, int, int]], widgetStretchPolicy=string],[xPosition=int], [yPosition=int], [zValue=boolean])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
MGPickerItem is NOT undoable, queryable, and editable.
This command create / queries / edit a picker item, currently this include select-button, command-button, attribute-button, slider, text and panel.
Specify -view flag and a picker view id string if the picker item is not in current active picker view.
Some flags only make sense to a certain type of picker item, but it is ok to apply to unsupported picker item type, which just has no effect.
Long name (short name)
|
Argument types
|
Properties
|
-attributeIconOption(-aio)![v2_transparent](v2_transparent.png)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
The options used for attribute button icons. An example value is "IconMode=2,IconWithValue=0,IconInMenu=1";
The available values for IconMode: 0=IconOnly, 1=IconInComboBox, 2=ComboBoxOnly, as it is only for enum attribute button with widgetControl shape.
The available values for IconWithValue and IconInMenu are just 0 and 1 which stands for boolean values.
|
|
-attributeIcons(-ais)![v2_transparent](v2_transparent.png)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
The icons used for attribute button's widgetControl shape.
e.g. "path/to/icon.svg,elementId1,path/to/another.png,"
Note that the form is "image,elementId,...", the elementId is for svg image only, but for bitmap images, you still need the extra ',' after the image path.
The API always expect the even number of values after splited by ',' including the empty parts.
|
|
-applyMirroredAttribute(-ama)
|
|
![edit edit](edit.gif)
|
|
Apply mirrored attribute values to its mirrored item, attribute values such as color, size, shape will be copied as is, yet some attributes will be mirrored, such as "labelHorizontalAlign" will be mapped between "left" and "right", position and rotation will be mirrored, etc. If no mirror item then a warning will be issued.
|
|
-annotation(-ann)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
The tool tip text for the item, will be shown when you hover mouse over the item.
|
|
-addSelectMember(-asm)
|
string
|
![create create](create.gif) ![edit edit](edit.gif) ![multiuse](multiuse.gif)
|
|
Only makes sense for select-button. Append a node to the select-button's member list.
|
|
-attributeType(-atp)
|
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for attribute-button. Return the attribute type of the attribute button in query mode, possible values are "bool", "enum", "maya", which means "dummy bool attribute button", "dummy enum attribute button" and "maya attribute button". In creation and edit mode, this changes the attribute button's attribute type. In creation mode, if this flag is absent then by default the attribute button will be a dummy bool attribute button, which has a bool type attribue but doesn't control any maya attribute.
|
|
-attribute(-att)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for attribute-button. Return namespace:node.attribute in query mode if it is a maya attribute button, or else return empty string.
In creation / edit mode, you need to specify a node.attribute string as argument for a maya attribute button, for a dummy enum attribute button, you assign enum value strings connected with ":" character, "Proxy:LoRes:HiRes" for example. For a dummy bool attribute button this flag doesn't make any sense since a dummy bool attribute always have "on/off" value.
|
|
-attributeValue(-atv)
|
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for attribute-button. Return current attribute value as float in query mode, set the attribute value in creation / edit mode.
|
|
-bgHorizontalAlign(-bha)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for picker panel. The horizontal alignment of the background image as it is fill in the content area of picker panel.
Valid values are "center", "left", "right".
|
|
-backgroundImage(-bi)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for picker panel. The background image used in picker panel.
|
|
-bgKeepRatio(-bkr)
|
boolean
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for picker panel. When background image scale itself to fit in the picker panel content area, if this option is on, it will keep the width/height ratio while scaling.
|
|
-bgMargin(-bmg)
|
int int int int
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for picker panel. The left, right, top, bottom margin for the background image to the picker panel content area's corresponding edge.
Depending the background image alignment specified by -bgHorizontalAlign/-bha and -bgVerticalAlign/-bva, only 0~3 components of the margin may take effect.
|
|
-boolState(-bs)
|
boolean
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
For programming purpose only. Used to store a boolean state value with a certain picker item.
Usually you need it when toggle the state of a command-button. (Click to switch on, again to switch off, etc.)
A bool/float/int/string state value is not undoable, yet they are savable in the picker file/node.
|
|
-backgroundSVGElement(-bse)![v2_transparent](v2_transparent.png)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Query/Edit the background image element ID if it is a SVG image, only work for group and panel.
|
|
-bgScaleFit(-bsf)
|
boolean
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for picker panel. If background image should scale itself to fit in the picker panel content area.
|
|
-bevel(-bv)
|
boolean
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Whether the item should be drawn in bevel style.
|
|
-bgVerticalAlign(-bva)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for picker panel. The vertical alignment of the background image as it is fill in the content area of picker panel.
Valid values are "center", "top", "bottom".
|
|
-command(-c)
|
script
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for command-button. The mel / python codes been executed when the command-button is pressed and released.
|
|
-closeCurve(-ccv)
|
boolean
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense when the item uses a bezier shape. Determine if the bezier curve should be closed automatically or not.
|
|
-children(-chd)![v2_transparent](v2_transparent.png)
|
UnsignedInt
|
![query query](query.gif)
|
|
Query only flag to get all the children picker item ids, specify 0 to return direct children only, 1 to return all the descendents.
|
|
-clearSelectMembers(-csm)
|
|
![create create](create.gif) ![edit edit](edit.gif)
|
|
Only makes sense for select-button. Clear the select-button's member list.
|
|
-commandType(-ct)
|
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for command-button. Set the language type of the command-button command.
Valid values are "mel", "python".
|
|
-componentWidth(-cw)
|
int
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for attribute-button. This flag set / query the value field width, the component width only works when componentWidthPolicy set to "fixed".
|
|
-componentWidthPolicy(-cwp)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for attribute-button. It controls the value field width policy, valid values are "stretch" and "fixed". By default policy is "stretch", so value field will be as wide as possible as long as the label field could display all the label. Setting policy to "fixed" will force the value field be a fixed width, it is useful when you line up multiple attribute-buttons vertically, and wanna the separate lines of label & value field also be lined up vertically like Maya channelbox. All you need is just set their policies to "fixed", and use the same component width on all these attribute-buttons.
|
|
-drawBGRect(-dbr)
|
boolean
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for text item. If the background rectangle should be drawn as the text's background or not.
|
|
-drawBackgroundShape(-dbs)
|
boolean
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense when the item uses a image shape. Determine if the background rectange should be drawn as the background of the image or not.
|
|
-exist(-ex)
|
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Query only flag, test if the certain picker item id exists or not.
|
|
-fillColor(-fc)
|
float float float float
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
The fill color of the item. Arguments are red, green, blue, alpha float values range [0~1].
|
|
-flipImageHorizontally(-fih) ![v2_transparent](v2_transparent.png)
|
bool
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Flip the image horizontally, supports both bitmap or SVG vector images. When mirror duplicating item with image shape, the horizontal flip state will be reversed, too.
|
|
-forceImageMargin(-fim) ![v2_transparent](v2_transparent.png)
|
bool
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
When on, it will make sure image margins are taking effect regardless of label alignment.
This is usefully when you are using image for icon only buttons to have an accurate control on the margins.
|
|
-flipImageVertically(-fiv) ![v2_transparent](v2_transparent.png)
|
bool
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Flip the image vertically, supports both bitmap or SVG vector images.
|
|
-frameColor(-fmc)
|
float float float float
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for picker panel and slider.
The frame color of the items. Arguments are red, green, blue, alpha float values range [0~1].
|
|
-frameVisible(-fmv)
|
boolean
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for picker panel and slider.
Determine if the panel should draw its frame, or a slider should draw its background slot.
|
|
-fullNamespace(-fns)
|
|
![query query](query.gif)
|
|
Query only flag that only makes sense for select-button, command-button, attr-button and slider. it returns the full namespace of the maya nodes containes in the picker item, which is, "PickerNamespace:SubNamespace", if subNamespace is empty then only the picker view namespace will be returned, eg. "PickerNamespace".
Picker items like select-button, attr-button and slider only record maya node name without any namespace, the actual namespace will be composed of picker namespace of the picker view and sub-namespace of current picker item, which means,
the maya node actually be selected / manipulated is PickerNamespace:SubNamespace:nodeName.
|
|
-floatState(-fs)
|
float
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
For programming purpose only. Used to store a float data with a certain picker item.
A bool/float/int/string state value is not undoable, yet they are savable in the picker file/node.
|
|
-gradient(-gd)
|
boolean
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Determine if the item should be fill with slight gradient based on the fill color.
|
|
-gradientMode(-gdm)
|
int
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
The direction of the gradient fill. Valid values are 0 / 1.
For 0 the gradient will go from top to bottom, 1 will go from bottom to top.
|
|
-height(-h)
|
int
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
The height of the picker item in pixels.
|
|
-highlightImage(-hi)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense when it is a select-button uses a image shape. The image used when the select-button is highlight due to its members been partially or totally selected in maya scene.
|
|
-hoverLightness(-hl)
|
int
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Apply to all kinds of picker item, specify -10~10 int value for the argument, negative value means picker item become darker when mouse hover onto it, positive value means becoming lighter.
|
|
-highlightSvgElement(-hse) ![v2_transparent](v2_transparent.png)
|
String
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Query/Edit the selection highligted image element ID if it is a SVG image, only work for selection button.
|
|
-hoverSvgElement(-hve) ![v2_transparent](v2_transparent.png)
|
String
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Query/Edit the hover image element ID if it is a SVG image, support for all items that support image shape.
|
|
-hoverImage(-hvi)![v2_transparent](v2_transparent.png)
|
String
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Query/Edit the hover image path, support for all items that support image shape.
|
|
-image(-i)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense when the picker item uses a image shape. The image used by the item.
|
|
-interactive(-iac)
|
boolean
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Determine if a picker item should response to a mouse clicking.
A text item is by default not interactive.
|
|
-imageKeepRatio(-ikr)![v2_transparent](v2_transparent.png)
|
boolean
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense when a picker item uses a image shape. It determines if an image shape should keep the ratio when being scaled.
|
|
-imageMargin(-img)
|
int int int int
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense when a picker item uses a image shape. It determines how the image be placed in the item.
The left, right, top, bottom margin for the image to the item's corresponding edge.
Depending the label alignment specified by -labelHorizontalAlign/-lha and -labelVerticalAlign/-lva, only 0~3 components of the margin may take effect.
Since the formal release version of v2, you can use -forceImageMargin flag to force the image margin to take effect regardless of the label alignments.
|
|
-intState(-is)
|
int
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
For programming purpose only. Used to store an int data with a certain picker item.
A bool/float/int/string state value is not undoable, yet they are savable in the picker file/node.
|
|
-imageScaleFit(-isf)![v2_transparent](v2_transparent.png)
|
boolean
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense when a picker item uses a image shape. It determines if an image shape should scale its image to fit the button size when drawing.
|
|
-label(-l)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
The label of the picker item.
|
|
-labelBold(-lb)
|
boolean
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
If the label font should adopt the bold style.
|
|
-labelColor(-lc)
|
float float float float
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
The color of the label. Arguments are red, green, blue, alpha float values range [0~1].
|
|
-labelFont(-lf)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
-labelFontSize(-lfs)
|
int
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
The font size of the label in pixels.
|
|
-labelHorizontalAlign(-lha)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
The horizontal alignment of the label to its item.
Valid values are "center", "left", "right".
|
|
-labelItalic(-li)
|
boolean
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
If the label font should adopt the italic style.
|
|
-links(-lks)
|
|
![query query](query.gif)
|
|
This is a query only flag that can be used to get all the link ids related to current picker item.
|
|
-leftMenuPolicy(-lmp)![v2_transparent](v2_transparent.png)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
The left menu policy dictates when an item has no left clicking menu data, does it prevents the item underneath from popping up its left clicking menu instead. The valid values are "blockUnder" and "propagateUnder".
By default for group it is "propagateUnder", and "blockUnder" for all the other items.
|
|
-labelPosition(-lp)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for slider. How label be layout with the slider. Valid values are "top", "bottom", "left", "right".
|
|
-leftSlope(-lsp)
|
int
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense when a picker item uses a trapezoid shape.
The left slope value for the trapezoid, ranges [-10~10].
|
|
-labelVerticalAlign(-lva)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
The vertical alignment of the label to its item.
Valid values are "center", "top", "bottom".
|
|
-masterButtons(-mbs)
|
|
![query query](query.gif)
|
|
Query only flag to return the master buttons of this picker item, e.g. The attribute buttons that are controlling the visibility of current picker item, or parent select-buttons of current select-button.
|
|
-mirror(-mrr)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
In query mode this return the mirrored item id for current picker item.
In create / edit mode this set the item id as the mirrored item for current picker item.
|
|
-name(-n)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Query/edit the name of the picker item.
Name property is solely used to avoid hard-coding the id durning picker programming.
You can use "MGPicker -q -getIdFromName name" to get the id from this name, so further edit/query could be processed based on that id.
|
|
-opacity(-op)
|
float
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
The opacity of the picker item's fill color, value ranges [0~1], which will be mapped to [0~20] real opacity int value for the item.
|
|
-parent(-p)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
The parent picker panel id of current picker item.
In create / edit mode you should specify a valid picker panel id, specify a empty panel id to unparent the picker item from any parent panel.
|
|
-postAction(-pa)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for select-button. What tool should be switched to automatically after the select-button is pressed.
Valid values are "nothing", "translate", "rotate", "scale".
|
|
-panelContentPadding(-pcp)![v2_transparent](v2_transparent.png)
|
|
![query query](query.gif)
|
|
Query only flag to get the picker panel padding value, it is a list of integers: [left, top, right, bottom], for items that are not panel, [0,0,0,0] will be returned.
|
|
-pressedImage(-pi)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense when a picker item uses a image shape. The image used when the item is pressed by mouse button.
|
|
-postChangeCommand(-poc)
|
script
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for attribute-button. The mel / python command be executed after the attribute button value been changed in picker view.
|
|
-postChangeCommandType(-pot)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for attribute-button. The language type for the post change command of a attribute-button.
Valid values are "mel", "python".
|
|
-preChangeCommand(-prc)
|
script
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for attribute-button. The mel / python command be executed before the attribute button value be changed in picker view.
|
|
-preChangeCommandType(-prt)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for attribute-button. The language type for the pre change command of a attribute-button.
Valid values are "mel", "python".
|
|
-pressedSvgElement(-pse)![v2_transparent](v2_transparent.png)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Query/Edit the mouse presseed image element ID if it is a SVG image, support for all items that support image shape.
|
|
-queryObjects(-qos)![v2_transparent](v2_transparent.png)
|
|
![query query](query.gif)
|
|
Query only flag to query DCC related nodes/attributes name from a picker item, with the full namespace and possible sub-namespace applied.
e.g. The namespaced nodes from selection button, the namespaced attributes from attribute button, the namespaced horizontal and vertical attributes from slider. Note that the slider returns these attributes only if they are actually valid in DCC scene.
|
|
-rotation(-r)
|
int
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for select-button which uses shapes other than polygon and bezier shape.
The rotation value of the select-button, ranges [-180~180].
|
|
-roundness(-rd)
|
int
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for items which uses shapes that support this attribute.
The roundness of the shape. The value ranges [0~100].
|
|
-rightMenuPolicy(-rmp)![v2_transparent](v2_transparent.png)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
The right menu policy dictates when an item has no right clicking menu data, does it prevents the item underneath from popping up its right clicking menu instead. The valid values are "blockUnder" and "propagateUnder".
By default for group it is "propagateUnder", and "blockUnder" for all the other items.
|
|
-resizePreferSize(-rps)
|
|
![create create](create.gif) ![edit edit](edit.gif)
|
|
Resize the picker item to its proper size. If the -width/-w or -height/-h flags are specified, this flag will be ignored.
|
|
-removeSelectMember(-rsm)
|
string
|
![create create](create.gif) ![edit edit](edit.gif) ![multiuse](multiuse.gif)
|
|
Only makes sense for select-button. Remove a node from the select-button's member list.
|
|
-rightSlope(-rsp)
|
int
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense when a picker item uses a trapezoid shape.
The right slope value for the trapezoid, ranges [-10~10].
|
|
-shape(-s)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
The shape for the picker item. If you specify a shape type that the picker item doesn't support, this flag has no effect.
Valid values are "rectangle", "roundedRectangle", "ellipse", "circle", "triangle", "diamond", "trapezoid", "pentagon", "hexagon", "polygon", "bezier", "image", "widgetControl", "attributeButton", "roundedAttriuteButton", "slider".
Notice that different type of picker item support different range of shapes, refer to shape drop-down menu of attribute editor in MG-Picker Studio to know more.
|
|
-slaveButtons(-sbs)
|
|
![query query](query.gif)
|
|
Query only flag to return the slave buttons of this picker item, e.g. The picker items that are control but current attribute button, or child select-buttons of current select-button.
|
|
-strokeColor(-sc)
|
float float float float
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
The color of the stroke. Arguments are red, green, blue, alpha float values range [0~1].
|
|
-sliderChangeCommand(-scc)
|
script
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for slider.The command be executed when the slider value changed in picker view or by the attribute nudger.
|
|
-sliderChangeCommandType(-sct)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for slider. The language type for the change command of a slider.
|
|
-shapeDirection(-sd)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for items which uses shapes that support this attribute.
Valid values are "top", "bottom", "left", "right".
|
|
-svgElement(-se)![v2_transparent](v2_transparent.png)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Query/Edit the image element ID if it is a SVG image, support for all items that support image shape.
|
|
-select(-sel)
|
int
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
In edit mode this select the picker item. Specify a 0~3 int as the selection mode:
0 for replace selection,
1 for add selection,
2 for deselect,
3 for toggle selection
In query mode, this will return 0/1 indicates that the picker item is currently selected or not.
|
|
-sliderHandle(-sh)![v2_transparent](v2_transparent.png)
|
|
![query query](query.gif)
|
|
Query only flag to get the slider handle id if the item is a slider.
|
|
-sliderHAttribute(-sha)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for slider. The attribute controlled by slider in horizontal direction. Specify node.attribute in create / edit mode.
Notice that both the node and attribute should exist at the moment.
|
|
-sliderHMin(-shi)
|
float
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for slider. The software minimum value of the horizontal attribute. It is used by picker, does not affect maya attribute value range.
|
|
-sliderHRange(-shr)
|
boolean
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for slider. Decide whether or not we use the software range for horizontal attribute.
|
|
-sliderHSpeed(-shs)
|
float
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for slider. The speed float for the horizontal attribute. Ranges in [-1, 1], and can't be zero.
|
|
-sliderHValue(-shv)![v2_transparent](v2_transparent.png)
|
float
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Query / set the slider horizontal attribute value.
|
|
-sliderHMax(-shx)
|
float
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for slider. The software maximum value of the horizontal attribute. It is used by picker, does not affect maya attribute value range.
|
|
-showItemTip(-sit)
|
string
|
![edit edit](edit.gif)
|
|
Pop up a tip showing the specified text at the position of the item. If you specify empty string, then it will show the picker item's note string instead (MGPickerItem -q -annotation).
If note string is also empty, then it won't pop up anything.
|
|
-slider(-sld)![v2_transparent](v2_transparent.png)
|
|
![query query](query.gif)
|
|
Query the parent slider id if current item is slider handle.
|
|
-selectMembers(-sms)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for select-button. Set a string array as the select-button's member list.
In query mode this return a string array, in create / edit mode you should specify a string contains all the member nodes and joined using space character.
Specify empty string to clear the select member list.
|
|
-subNamespaceSeparator(-snp)![v2_transparent](v2_transparent.png)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Query/edit the separator characters used between sub-namespace and the DCC node. Check out here for more information.
|
|
-subNamespace(-sns)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Query/edit the sub-namespace of the picker item.
For now it only works to select-button, command-button, attr-button and slider, makes no sense for picker panel, text.
It is used to support the reference based rigging architecture, which contains layered namespace in nature. Check out here for more information.
|
|
-stringState(-ss)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
For programming purpose only. Used to store a string data with a certain picker item.
A bool/float/int/string state value is not undoable, yet they are savable in the picker file/node.
|
|
-supportShapeTypes(-sst) ![v2_transparent](v2_transparent.png)
|
|
![query query](query.gif)
|
|
Query only flag to get the supported shape types for this picker item.
|
|
-strictClick(-stc) ![v2_transparent](v2_transparent.png)
|
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Get if a command button is using strict click mode. A strict click mode means the command button only get triggered when you click and release on command button, no drag allowed.
By default it is False, meaning as long as you click on the command button, and eventually release within the same command button, the button will be triggered.
|
|
-sliderUseHAttribute(-suh)![v2_transparent](v2_transparent.png)
|
boolean
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Query/Edit the use of slider horizontal attribute.
|
|
-sliderUseVAttribute(-suv)![v2_transparent](v2_transparent.png)
|
boolean
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Query/Edit the use of slider vertical attribute.
|
|
-sliderVAttribute(-sva)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for slider. The attribute controlled by slider in vertical direction. Specify node.attribute in create / edit mode.
Notice that both the node and attribute should exist at the moment.
|
|
-sliderVMin(-svi)
|
float
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for slider. The software minimum value of the vertical attribute. It is used by picker, does not affect maya attribute value range.
|
|
-sliderVRange(-svr)
|
boolean
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for slider. Decide whether or not we use the software range for vertical attribute.
|
|
-sliderVSpeed(-svs)
|
float
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for slider. The speed float for the vertical attribute. Ranges in [-1, 1], and can't be zero.
|
|
-sliderVValue(-svv)![v2_transparent](v2_transparent.png)
|
float
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Query / set the slider vertical attribute value.
|
|
-sliderVMax(-svx)
|
float
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for slider. The software maximum value of the vertical attribute. It is used by picker, does not affect maya attribute value range.
|
|
-strokeWidth(-sw)
|
int
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
The width of the stroke in pixel, ranges [0~10], the value 0 means no stroke.
|
|
-type(-typ)
|
string
|
![create create](create.gif) ![query query](query.gif)
|
|
In query mode this flag returns the type string of the picker item.
You must specify this flag when you are in create mode to create a picker item.
Valid values are "selectButton", "commandButton", "attributeButton", "slider", "text", "group", "graphicItem", "panel", in a case-insensitive manner;
An error will be raised on invalid type. Note that the "sliderHandle" is not creatable alone thus it is not supported in API.
|
|
-useAutoAnnotation(-uan)
|
boolean
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
When user does not author note(the tooltip), by default MG-Picker generates the tooltip with some auto-generated information on mouse-hover event.
This flag is introduced so the user has a chance to disable the auto-tooltip.
|
|
-usePickerNamespace(-upn)
|
boolean
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
By default the property value is true. In query mode this flag returns whether or not the maya node name in this picker item will use picker's namespace when it comes evaluating. e.g. The node member of select-button, attribute button and slider. In edit mode this sets the property.
When user clicks on a select button, the final maya node it select is as follow (Same rules apply to attribute button and slider):
NodeName in Button
|
Picker Namespace
|
Button Sub-Namespace
|
Button uses Picker Namespace
|
Final Maya Node to Select
|
pCube
|
pickerNS
|
|
Yes
|
pickerNS:pCube
|
pCube
|
pickerNS
|
|
No
|
pCube
|
pCube
|
pickerNS
|
subNS
|
Yes
|
pickerNS:subNS:pCube
|
pCube
|
pickerNS
|
subNS
|
No
|
subNS:pCube
|
myChar:pCube
|
pickerNS
|
|
Yes
|
myChar:pCube
|
myChar:pCube
|
pickerNS
|
|
No
|
myChar:pCube
|
myChar:pCube
|
pickerNS
|
subNS
|
Yes
|
myChar:pCube
|
myChar:pCube
|
pickerNS
|
subNS
|
No
|
myChar:pCube
|
Starting from v2.3, user can also customise the separator between picker namespace and sub-namespace, as well as the separator between sub-namespace and node name.
|
|
-view(-v)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
This controls which picker view that the picker item belongs to, if this flag is not specified, then current view will be used by default. A picker view id string should be specified for this flag in query, create, edit mode.
The picker view id could be retrieved by MGPicker commands such as: (Please refer to MGPicker command manual for further details.)
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.
|
|
-viewAnchor(-vac)![v2_transparent](v2_transparent.png)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
This flag only works with group / panel that does not have a parent item, meaning they are at the scene level. When you set the flag to group/panel with a parent group/panel, it actually set the property, but the property won't take effect until the group/panel is unparented from its parent to scene.
It decides How the group / panel get pinned to the view, the possible values are "topLeft", "top", "topRight", "right", "bottomRight", "bottom", "bottomLeft", "left", "center" and empty string "".
By default it is empty string, meaning it is a normal group or panel, all the other anchors will make the item ignore view transformation, and get pinned to the certain corner/center of the viewport.
|
|
-valueColor(-vc)
|
float float float float
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only makes sense for attribute-button and slider. For attribute-button this is the color of the value text, for slider this is the color rectangle been drawn to show how current value be varied from its default value.Arguments are red, green, blue, alpha float values range [0~1].
|
|
-visible(-vis)
|
boolean
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
The visibility of the picker item.
|
|
-viewMargin(-vmg)![v2_transparent](v2_transparent.png)
|
int int int int
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
The margins of the group / panel when it is pinned to the viewport. Depending on the different view anchor modes specified by -viewAnchor flag, different margins will take effect.
|
|
-visibilityOperator(-vis)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
The visibility operator, when picker item is controlled by multiple attribute buttons.
Specify "and", means all attribute buttons should meet the values, then picker item is visible.
Specify "or" means any one of attribute buttons meet the value, then picker item is visible.
|
|
-viewStretch(-vst) ![v2_transparent](v2_transparent.png)
|
boolean
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
When a group / panel is having a viewAnchor and it does not have parent item, this flag specifies whether the group/panel should be stretched to fit the viewport size.
Depending on the different view anchor modes, it will stretch in width or height or both. e.g. for "left" and "right" anchors, group / panel will stretch to fit the viewport height, for "center", it will stretch to fit both, for other modes, it will stretch to fit the viewport width.
|
|
-width(-w)
|
int
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
The wdith of the picker item in pixels.
|
|
-widgetMargins(-wms) ![v2_transparent](v2_transparent.png)
|
int int int int
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Only works with attribute button with a widgetControl shape. You use the margins to offset the size on different direction, to make the control widget larger or smaller, e.g. the checkBox for boolean attribute, the comboBox for enum attribute, or the input box for integer or float attributes.
|
|
-widgetStretchPolicy(-wsp)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
Get or set the widget stretch policy, only works with attribute button with a widgetControl shape. The possible values are "stretch" and "fixed".
|
|
-xPosition(-x)
|
int
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
The x coordinate of the picker item in pixels.
|
|
-yPosition(-y)
|
int
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
The y coordinate of the picker item in pixels.
|
|
-zValue(-z)![v2_transparent](v2_transparent.png)
|
|
![query query](query.gif)
|
|
Query the z value of the picker item.
|
|
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 pCube1 if not exists:
if(!`objExists pCube1`)
{
polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1;
}
// create a new picker named "myPicker"
string $viewId = `MGPicker -e -createPicker "myPicker" "wrongNamespace" "" ""`; //it is a untitled picker, not refer to a picker file / node.
MGPickerView -e -namespace "" $viewId; //set the namespace to empty string.
//create picker panel first:
string $panel = `MGPickerItem -view $viewId -type "panel" -label "Panel1" -frameColor .2 .2 .22 1 -x 0 -y 0 -w 400 -h 300`;
//create other items:
string $selButton = `MGPickerItem -view $viewId -type "selectButton" -p $panel
-x 20 -y 20 -w 100 -h 20 -shape "roundedRectangle"
-l "Select Button"
-selectMembers "pCube1"`;
string $commandButton = `MGPickerItem -view $viewId -type "commandButton"
-p $panel
-x 20 -y 50 -w 100 -h 20
-l "Cmd Button"
-c ("print (\"Current button is: \\\"\"+`MGPicker -q -currentItem`+\"\\\".\\n\")")`;
string $slider = `MGPickerItem -view $viewId -type "slider" -p $panel
-sliderHAttribute "pCube1.translateX"
-sliderVAttribute "pCube1.translateY"
-l "pCube:tx-ty"
-x 23 -y 100 -w 100 -h 100`;
string $attributeButton = `MGPickerItem -view $viewId -type "attributeButton"
-attributeType "bool"
-l "Toggle"
-p $panel
-valueColor .1 .5 .5 1
-x 200 -y 35 -w 100 -h 20`;
string $text = `MGPickerItem -view $viewId -p $panel -type "text" -x 200 -y 80 -labelFontSize 11
-l "The attribute button\ncontrols the select-button,\ncommand-button and the slider."
-resizePreferSize`;
//link the visibilities of select-button and command-button to attribute "on":
string $link1 = `MGPickerLink -view $viewId -s $selButton -t $attributeButton -targetValues "on"`;
string $link2 = `MGPickerLink -view $viewId -s $commandButton -t $attributeButton -targetValues "on"`;
string $link3 = `MGPickerLink -view $viewId -s $slider -t $attributeButton -targetValues "on"`;
//turn the value of attribute-button to On to show the buttons:
MGPickerItem -e -view $viewId -attributeValue 1 $attributeButton;
MGPickerView -e -updateSceneBoundary $viewId; //update the scene boundary to show all the picker items.
MGPickerView -e -setClean $viewId; //set the picker we just created clean.
Python examples
from maya import cmds
from mgpicker import mgp
#create pCube1 if not exists:
if not cmds.objExists('pCube1'):
cmds.polyCube (w=1, h=1,d=1,sx=1,sy=1,sz=1,ax=(0,1,0), cuv=4,ch=1)
# 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="") #set the namespace to empty string.
#create picker panel first:
panel = mgp.MGPickerItem(view=viewId, type="panel",label="Panel1",frameColor=(.2,.2,.2,1), x=0,y=0,w=400,h=300)
#create other items:
selButton = mgp.MGPickerItem(view=viewId, type="selectButton",p=panel,
x=20,y=20,w=100,h=20,shape="roundedRectangle",
l="Select Button",
selectMembers="pCube1")
commandButton = mgp.MGPickerItem (view=viewId, type="commandButton",
p=panel,
x=20,y=50,w=100,h=20,
l="Cmd Button",
c=("print (\"Current button is: \\\"\"+`MGPicker -q -currentItem`+\"\\\".\\n\")"))
slider = mgp.MGPickerItem(view=viewId, type="slider",p=panel,
sliderHAttribute="pCube1.translateX",
sliderVAttribute="pCube1.translateY",
l="pCube:tx-ty",
x=23,y=100,w=100,h=100)
attributeButton = mgp.MGPickerItem (view=viewId, type="attributeButton",
attributeType="bool",
l="Toggle",
p=panel,
valueColor=(.1,.5,.5,1),
x=200,y=35,w=100,h=20)
text = mgp.MGPickerItem (view=viewId, p=panel, type="text",x=200,y=80,labelFontSize=11,
l="The attribute button\ncontrols the select-button,\ncommand-button and the slider.",
resizePreferSize=True)
#link the visibilities of select-button and command-button to attribute "on":
link1 = mgp.MGPickerLink (view=viewId, s=selButton,t=attributeButton,targetValues="on")
link2 = mgp.MGPickerLink (view=viewId, s=commandButton ,t=attributeButton,targetValues="on")
link3 = mgp.MGPickerLink (view=viewId, s=slider ,t=attributeButton,targetValues="on")
#turn the value of attribute-button to On to show the buttons:
mgp.MGPickerItem (attributeButton, edit=True, view=viewId, attributeValue=1)
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.
|