Logo

开始使用

  • 安装

动画师帮助

  • 动画师模式
  • 加载Picker
  • Picker命名空间
  • Picker视图操作
  • 动画师Picker交互
  • 简单编辑功能
  • MG-选择辅助器
  • 快捷键
  • 提示

设计师帮助

  • 设计师模式
  • Picker设计快速流程
  • 基于SVG流程
  • 设计原则
  • 命名空间
  • Picker对象类型
  • 对象形状
  • Picker连接
  • 视图区域
  • 动画
  • 关系视图
  • 大纲视图
  • Picker菜单
  • Picker Edit
  • 样式库
  • Picker文件分发
  • Picker图片便携性
  • Picker工具整合
  • 发布到网络
  • 设计师模式快捷键
  • MG-Picker独立程序
  • 提示

程序员帮助

  • MG-Picker工作室编程
  • MGPicker命令
  • MGPickerView命令
  • MGPickerItem命令
  • MGPickerLink命令
  • MGPickerViewRegion命令
  • MGPickerAnimation命令
  • MGPickerMenu命令
  • MGPickerMenuItem命令
  • MGPickerUserPanel命令
  • MGPickerLicence命令
  • MGSvgExport命令
  • MGSvgImport命令
  • 命令按钮预设
  • 转换器
  • 代码片段
  • 跟Maya同步数值
  • Loader和Lister
  • 提示
  • 问 & 答

其它

  • 配置
  • MG-Picker工作室和Qt
  • 更多资源
下载 English
MG-Picker Studio
  • MG-Picker工作室编程
  • MGPickerLink命令

MGPickerLink命令

MGPickerLink不可撤消, 可以查询且可以编辑。

这个命令创建, 查询或编辑一个picker连接。

跳转到: [MEL例子] [Python例子]

概要

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

MGPickerLink命令

-exist(-ex)   Q

这个标签只能用于查询模式,用来获取该连接是否存在。

-remove(-rm)   E

这个标签只能用于编辑模式,用来删除某个连接。

-source(-s)   string   C Q

这个标签用于查询模式来获取该连接的源picker对象的id。

用在创建模式时,并必须同时指定-target标签来指定目标picker对象的id。这个标签不能用于编辑模式。

-target(-t)   string   C Q

这个标签用于查询模式来获取该连接的目标picker对象的id。

用在创建模式时,并必须同时指定-source标签来指定源picker对象的id。这个标签不能用于编辑模式。

-targetValues(-tvs)   string   C Q E

这个标签用于查询模式来获取该连接的目标属性值,是一个字符窜数组。以决定什么样的值情况下,源picker对象才该被显示。

在创建 / 编辑模式,您必须指定一个字符窜数组作为参数,这个字符窜由多个数值用字符"," 连接而成。

-type(-typ)   Q

这个标签只能用于查询模式,用来获取该连接的类别。

你不能再编辑一个连接的类型,因为它的连接类似是由目标picker对象决定的。

可能的数值有:parentLink 或 attributeLink。

-view(-v)   string   C Q E

控制要查询,编辑或创建在哪个picker视图的连接,在未使用该标签的情况下,默认是在当前激活的picker视图。

该标签需要您指定一个picker视图id字符窜。该id可以通过下方式来获取(具体请查询MGPicker命令参考文档):

   // 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 标签可以在创建模式中使用; E 标签可以在编辑模式中使用
Q 标签可以在查询模式中使用   M 标签可以在一条命令中多次使用.

MEL例子

//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例子

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))
上一页 下一页

© 版权所有 2026, MGLAND。

利用 Sphinx 构建,使用的 主题 由 Read the Docs 开发.