command (MEL/Python)
|
MGPickerLink
|
Go to: Synopsis. MEL examples. Python examples.
Synopsis
MGPickerLink (linkIDString, [exist=boolean] [remove=boolean] [source=string] [target=string] [targetValues=string] [type=boolean]) [view=string])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
MGPickerLink is NOT undoable, queryable, and editable.
This command create / queries / edit picker links.
Long name (short name)
|
Argument types
|
Properties
|
-exist(-ex)
|
|
![query query](query.gif)
|
|
This is a query only flag that can be used to query for the existence of a specific link.
|
|
-remove(-rm)
|
|
![edit edit](edit.gif)
|
|
This is a edit only flag that can be used to remove a specific link.
|
|
-source(-s)
|
string
|
![create create](create.gif) ![query query](query.gif)
|
|
If queried this flag will return the source picker item id.
The flag can't be used in edit mode, and you must use it with -target flag to both assign a source & target picker item id.
|
|
-target(-t)
|
|
![create create](create.gif) ![query query](query.gif)
|
|
If queried this flag will return the target picker item id.
The flag can't be used in edit mode, and you must use it with -source flag to both assign a source & target picker item id.
|
|
-targetValues(-tvs)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
If queried this flag will return all the target values as string array.
In creation / edit mode, you must assign a string value as the argument, the string is all the target value strings join by "," character.
|
|
-type(-typ)
|
|
![query query](query.gif)
|
|
This is a query only flag that can be used to query for the type of a specific link.
You can't edit the type of the link using this flag, since the type is auto-decided by the source & target picker items.
The possible type string are "parentLink" or "attributeLink".
|
|
-view(-v)
|
string
|
![create create](create.gif) ![query query](query.gif) ![edit edit](edit.gif)
|
|
This controls which picker view that the link 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.
|
|
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
//You must make sure the picker item: selectButton1, selectButton2, attributeButton1 are already in scene in order to test these codes.
//link two select-buttons with parent link.
//for select-button, the target attribute value flag makes no sense.
//you don't want to assign a custom link name here, since it is always sourcePickerItemName>targetPickerItemName.
string $newParentLink = `MGPickerLink -s selectButton1 -t selectButton2`;
print ("The type for the link \""+$newParentLink+"\" is: "+`MGPickerLink -q -type $newParentLink` + ".\n");
//link seelct-button to a attribute button, a attribute-link will be created.
string $newAttrLink = `MGPickerLink -s "selectButton1" -t "attributeButton1" -targetValues "Green,Red"`;
print "The item selectButton1 is linked and controlled by the item attributeButton1 at values: \n";
print `MGPickerLink -q -targetValues $newAttrLink`;
Python examples
from mgpicker import mgp
#You must make sure the picker item: selectButton1, selectButton2, attributeButton1 are already in scene in order to test these codes.
#link two select-buttons with parent link.
#for select-button, the target attribute value flag makes no sense.
#you don't want to assign a custom link name here, since it is always sourcePickerItemName>targetPickerItemName.
newParentLink = mgp.MGPickerLink(s='selectButton1',t='selectButton2')
print ("The type for the link \""+newParentLink+"\" is: "+ mgp.MGPickerLink(newParentLink, q=True,type=True) + ".\n")
#link seelct-button to a attribute button, a attribute-link will be created.
newAttrLink = mgp.MGPickerLink(s='selectButton1',t='attributeButton1',targetValues='Green,Red')
print ("The item selectButton1 is linked and controlled by the item attributeButton1 at values: \n")
print (mgp.MGPickerLink(newAttrLink,q=True,targetValues=True))
|