rig_namespace = "rig" # or whatever you call it
control_grp = "control_grp") # name of the object you want
cmds.select(rig_namespace + ":" + control_grp)
controls = set(cmds.ls("*control_grp*", type = transform)) # wildcards in
case maya has added numbers or prefixes
imported_controls = controls & imported # this gets only controls just added
cmds.select(*imported_controls) # you need the asterisk to unpack the set
大多数情况下,引用文件内容将作为名称空间的一部分(在名称前面用名称和冒号标识,例如'参考号:pCube1`. 如果在引用中的文件时控制命名空间,则可以在命名空间内搜索而不是创建集,但是,根据您或您的用户在“引用”对话框中设置选项的方式,您可能无法提前知道名称空间。在
如果有名称空间,则很容易:
如果不确定要搜索哪个名称空间,可以在将引用加载到python
set()
之前保存场景的内容,然后在引用传入后从内容中生成一个新的set()
。使用setdifference()
函数,您可以从后加载集中减去预加载集,从而获得引用文件附带的所有内容。然后可以使用cmds.select
从文件中获取要查找的项。在获取导入的文件内容
^{pr2}$从导入的文件中获取控制装备
相关问题 更多 >
编程相关推荐