Logo

Get started

  • Installation

For Animator

  • Animator Mode
  • Load Pickers
  • Picker Namespace
  • Picker view manipulation
  • Animator interactivity
  • Simple Edit in Animator Mode
  • MG-Select Helper
  • Hotkeys
  • Tips

For Designer

  • Designer Mode
  • Quick Design Workflow
  • The SVG-based Workflow
  • Design Principles
  • Namespace in MG-Picker Studio
  • Picker Item Types
  • Item shapes
  • Links
  • View Region
  • Animation in MG-Picker
  • Relationship panel
  • Outliner Panel
  • Picker Menu
  • Picker Edit
  • Style Library
  • Picker File Distribution
  • Picker Image Portability
  • Picker Tool Integration
  • Publish Picker To Internet
  • Hotkyes in Designer Mode
  • MG-Picker Studio as Standalone App
  • Tips

For Programmer

  • Scripting In MG-Picker Studio
  • MGPicker
  • MGPickerView
  • MGPickerItem
  • MGPickerLink
  • MGPickerViewRegion
  • MGPickerAnimation
  • MGPickerMenu
  • MGPickerMenuItem
  • MGPickerUserPanel
  • MGPickerLicence
  • MGSvgExport
  • MGSvgImport
  • Command button presets
  • Converters
  • Code snippets
  • Sync Values With Maya
  • Loader & Lister
  • Tips
  • Q & A

Miscellaneous

  • Configuration
  • MG-Picker Studio & Qt
  • More Resources
Download 中文版帮助
MG-Picker Studio
  • Scripting In MG-Picker Studio
  • MGPickerLink

MGPickerLink

MGPickerLink is NOT undoable, queryable, and editable.

This command creates / queries / edits picker links.

Go to: [MEL Examples] [Python Examples]

Synopsis

MGPickerLink( exist=boolean, remove=boolean, source=string, target=string, targetValues=string, type=boolean, view=string, )

MGPickerLink

-exist(-ex)   Q

This is a query only flag that can be used to query for the existence of a specific link.

-remove(-rm)   E

This is a edit only flag that can be used to remove a specific link.

-source(-s)   string   C Q

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)   string   C Q

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   C Q E

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)   Q

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   C Q E

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

   // Get current script execution view id, 
   // eg. picker load command, picker mouse enter command. 

   // This is only set during the script being executed.
   MGPicker -q -currentPickerView;
   // Get current active view id.
   MGPicker -q -activePickerView;

   // Find picker view id via picker node name or picker file name and namespace.
   MGPicker -q -findPickerView  "pickerNodeOrFileName"  1 "namespace";
   // List ids of all opened picker views.
   MGPicker -q -listAllPickerViews;
   // Create a temporary picker view and return its id.
   MGPicker -e -createTempPicker;

   // Create a picker view and return its id.
   MGPicker -e -createPicker "pickerName" "namespace" "filePath" "nodeName";
   // Read in-scene picker node 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 a picker file and return its id.
   MGPicker -e -readPickerFile "pickerFilePath" 1;

C Flag can appear in Create mode   E Flag can appear in Edit mode
Q Flag can appear in Query mode   M Flag can be used more than once.

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")
linkType = mgp.MGPickerLink(newParentLink, q=True, type=True)
print('The type for the link "{}" is: {}.\n'.format(newParentLink, linkType))

# 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 controlled by the item attributeButton1 at values: \n")
print(mgp.MGPickerLink(newAttrLink, q=True, targetValues=True))
Previous Next

© Copyright 2026, MGLAND.

Built with Sphinx using a theme provided by Read the Docs.