用mel编写自定义节点的属性编辑器界面比较麻烦,而且网上例子又少,下面给出一个范例,说明基本的格式
  1. // 初始化节点时调用
  2. global proc initControl(string $attrName)
  3. {
  4. // 传进来的参数是节点属性名,使用这个方法获得节点名称
  5. string $nodeName = `plugNode $attrName`;
  6. setUITemplate -pst "attributeEditorTemplate";
  7. button -label "Compute Weight" -c ("cageDeform -init -name " + $nodeName) computeWeightButton;
  8. setUITemplate -ppt;
  9. }
  10. // 修改节点时(例如点击另一个同类节点)调用
  11. // 此函数的目的是对按钮绑定的命令做相应修改,使其能应用于相应节点
  12. global proc modifyControl(string $attrName)
  13. {
  14.   // 当attrName = “cageDeformer1.noAttr”
  15. // plugNode 命令能够提取节点名字cageDeformer1
  16. string $nodeName = `plugNode $attrName`;
  17. print $nodeName;
  18. button -e -c ("meshControl -init -name " + $nodeName) computeWeightButton;
  19. }
  20. // 函数名同文件名一样,同节点名cageDeformer对应
  21. global proc AEcageDeformerTemplate(string $nodeName)
  22. {
  23. editorTemplate -beginScrollLayout;
  24.         // 新建一个卷展栏
  25. editorTemplate -beginLayout "Weight Scheme" -collapse false;
  26. // addControl自动指定合适类型的控件
  27. editorTemplate -addControl "maxNeighbourNum";
  28. editorTemplate -addControl "weightPower";
  29.          // 在指定的时机调用前面的函数
  30. editorTemplate -callCustom "initControl" "modifyControl" "noAttr";
  31. editorTemplate -endLayout;
  32. editorTemplate -suppress "outMesh";
  33. editorTemplate -suppress "inControlMesh";
  34. editorTemplate -suppress "refMesh";
  35. editorTemplate -suppress "refControlMesh";
  36. editorTemplate -beginLayout "Node Behavior" -collapse true;
  37. editorTemplate -addControl "nodeState";
  38. editorTemplate -addControl "caching";
  39. editorTemplate -endLayout;
  40. editorTemplate -addExtraControls;
  41. editorTemplate -endScrollLayout;
  42. }


下面是-callCustom的文档解释

Specifies that at this point in the template when building the dialog, the procedure specified by the first argument is to be called to create some UI objects when a new node type is edited. The procedure specified by the second argument is to be called if an attribute editor already exists and another node of the same type is now to be edited. The replacing procedure should connect any controls created by the creating procedure to the equivalent attributes in the new node. A list of zero or more attributes specifies the attributes which the two procedures will involve. The procedures should have the signature:
proc AEcustomNew(string attributeName1, string attributeName2)

The number of attributes specified in the call should correspond to the number of attributes in the procedure signature.

用mel编写自定义节点的属性编辑器界面的更多相关文章

  1. 流程图GGEditor 之 自定义节点相关属性

    自定义节点 注册 -- registerNode 我们通过以下接口往 G6 全局注册节点: // 注册节点 G6.registerNode(name, { // 绘制 draw(item) {   r ...

  2. [翻译] Writing Property Editors 编写属性编辑器

    Writing Property Editors 编写属性编辑器   When you select a component in the designer its properties are di ...

  3. (spring-第13回【IoC基础篇】)PropertyEditor(属性编辑器)--实例化Bean的第五大利器

    上一篇讲到JavaBeans的属性编辑器,编写自己的属性编辑器,需要继承PropertyEditorSupport,编写自己的BeanInfo,需要继承SimpleBeanInfo,然后在BeanIn ...

  4. django “如何”系列4:如何编写自定义模板标签和过滤器

    django的模板系统自带了一系列的内建标签和过滤器,一般情况下可以满足你的要求,如果觉得需更精准的模板标签或者过滤器,你可以自己编写模板标签和过滤器,然后使用{% load %}标签使用他们. 代码 ...

  5. SpringBoot编写自定义的starter 专题

    What’s in a name All official starters follow a similar naming pattern; spring-boot-starter-*, where ...

  6. Fabric Engine2.0的自定义节点功能

    Fabric Engine是一个多用途的引擎,针对maya等软件写节点写功能很方便.尤其是canvas节点编辑面板,提供了大量现有的功能供用户调用,当然这些节点功能都是可被用户编辑修改的,除此之外还提 ...

  7. SpringMVC源码阅读:属性编辑器、数据绑定

    1.前言 SpringMVC是目前J2EE平台的主流Web框架,不熟悉的园友可以看SpringMVC源码阅读入门,它交代了SpringMVC的基础知识和源码阅读的技巧 本文将通过源码(基于Spring ...

  8. 属性编辑器,即PropertyEditor-->Spring IoC

    在Spring配置文件里,我们往往通过字面值为Bean各种类型的属性提供设置值:不管是double类型还是int类型,在配置文件中都对应字符串类型的字面值.BeanWrapper填充Bean属性时如何 ...

  9. Spring经常使用属性的注入及属性编辑器

    对于对象的注入,我们使用ref方式,能够指定注入的对象.以下看下对于基本类型的注入.以及当spring无法转换基本类型进行注入时,怎样编写一个相似转换器的东西来完毕注入. 一.基本类型的注入 以下写一 ...

随机推荐

  1. 公司outing选项

    Sign up:  2014 Summer Outing   请您从以下三个方案中选择您最感兴趣的一个项目, 如果您不能参加此次summer outing, 请选择"遗憾放弃"- ...

  2. iOS小游戏打地鼠

    #import "ViewController.h" #import <AudioToolbox/AudioToolbox.h> @interface ViewCont ...

  3. 【原】PSD图标素材的全自动切图方法,适用于IOS、安卓、web前端等领域

    屌丝个人开发者经常遇到的尴尬问题是,自己不会设计UI素材又请不起专业的美工.最好的方式是去网上下载符合自己需求的素材修修改改直接用上.但是,在这个过程中会发现很多下载下来的素材是PSD格式的,很多图标 ...

  4. 如何轻松实现iOS9多任务管理器效果(iCarousel高级教程)

    前言 iOS9系统下 为了我司APP的兼容性问题 特意把手上的iOS Mac XCode都升级到了最新的beta版 然后发现iOS9的多任务管理器风格大变 变成了下面这种样子 我忽然想起来之前的文章提 ...

  5. 我的android学习经历11

    让TextViews实现跑马灯效果 有时候用文本控件时,文本只能在一行显示,而且文本很长的话,后面的文本就会隐藏 一.假如你只需要一个TextView,那个可以添加三个属性实现跑马灯效果,也就是让文字 ...

  6. 项目管理工具之Git使用说明

    1.下载Git客户端工具 http://msysgit.github.com/ 2.安装msysgit 下一步 同意GNU协议 选择安装位置 选择TrueType  Front,下一步 不创建启动文件 ...

  7. Effective Java 42 Use varargs judiciously

    Implementation theory The varargs facility works by first creating an array whose size is the number ...

  8. 安装SQL Server2008,要重启机器,解决办法

    安装SQL Server2008时,总提示有挂起,要重启机器:重启之后还是有相应的提示,该怎么办呢? 其实只要删除一个注册表项就可以了: 1.  打开注册表编辑器 开始菜单—>运行->re ...

  9. Linux基础问答

    1.简述TCP三次握手四次挥手过程及各过程中客户端和服务器端的状态. 1 2 3 4 5 6 7 8 9 10 11 12 13 #三次握手 客户端向服务器端发送SYN包,客户端进入SYN_SEND状 ...

  10. 虚拟机Linux----Ubuntu1204----root登录设置

    说明:装好的ubuntu12.04登录时,默认是看不到root用户的,需要设置一下. 1.先用普通用户登录,打开终端,切换为root用户,如下: su root 2.修改 sudo gedit /et ...