Maya:在培育节点时查询约束信息

时间:2018-10-12 21:40:39

标签: python-2.7 maya

在Maya中,有一种方法可以查询约束的来源和目标,而该约束是培育节点?

我正在尝试诊断成为寄养父母后失去连接的问题,因此我需要中介信息与有效的约束条件进行比较。

我遇到的所有方法都需要建立连接,但是尽管它是一个寄养节点,但并不存在。 Maya能够恢复连接,以便信息必须存在于某处。

1 个答案:

答案 0 :(得分:1)

您可以尝试通过参考的编辑来确定约束。打开参考编辑器,然后运行“文件”->“列表参考编辑”。这将弹出一个新窗口,其中将显示其在参考之外进行的所有编辑。该列表可能很大,因此您可以键入约束的名称以过滤结果。

现在,如果您尝试通过脚本访问此文件,则可以使用cmds.referenceQuery

将参考节点(而不是寄养父级)传递给以下命令:

edit_strings = cmds.referenceQuery("YOUR-REF-NODE", editStrings=True)
edit_nodes = cmds.referenceQuery("YOUR-REF-NODE", editNodes=True)
edit_attrs = cmds.referenceQuery("YOUR-REF-NODE", editAttrs=True)

for line, node, attr in zip(edit_strings, edit_nodes, edit_attrs):
    print line, " ::: ", node, ":::", attr

打印出的结果将如下所示:

parent -s -r "|CHR_alienB001_001RNfosterParent1|globalSRT_CTRL_parentConstraint1" "|CHR_alienB001_001:ROOT_NUL|CHR_alienB001_001:RIG_NUL|CHR_alienB001_001:globalSRT_NUL|CHR_alienB001_001:globalSRT_CTRL"  :::  |CHR_alienB001_001RNfosterParent1|globalSRT_CTRL_parentConstraint1 ::: constraintTranslateX
connectAttr "|CHR_alienB001_001RNfosterParent1|globalSRT_CTRL_parentConstraint1.constraintTranslateX" "|CHR_alienB001_001:ROOT_NUL|CHR_alienB001_001:RIG_NUL|CHR_alienB001_001:globalSRT_NUL|CHR_alienB001_001:globalSRT_CTRL.translateX"  :::  |CHR_alienB001_001:ROOT_NUL|CHR_alienB001_001:RIG_NUL|CHR_alienB001_001:globalSRT_NUL|CHR_alienB001_001:globalSRT_CTRL ::: translateX
connectAttr "|CHR_alienB001_001RNfosterParent1|globalSRT_CTRL_parentConstraint1.constraintTranslateY" "|CHR_alienB001_001:ROOT_NUL|CHR_alienB001_001:RIG_NUL|CHR_alienB001_001:globalSRT_NUL|CHR_alienB001_001:globalSRT_CTRL.translateY"  :::  |CHR_alienB001_001RNfosterParent1|globalSRT_CTRL_parentConstraint1 ::: constraintTranslateY
connectAttr "|CHR_alienB001_001RNfosterParent1|globalSRT_CTRL_parentConstraint1.constraintTranslateZ" "|CHR_alienB001_001:ROOT_NUL|CHR_alienB001_001:RIG_NUL|CHR_alienB001_001:globalSRT_NUL|CHR_alienB001_001:globalSRT_CTRL.translateZ"  :::  |CHR_alienB001_001:ROOT_NUL|CHR_alienB001_001:RIG_NUL|CHR_alienB001_001:globalSRT_NUL|CHR_alienB001_001:globalSRT_CTRL ::: translateY
connectAttr "|CHR_alienB001_001RNfosterParent1|globalSRT_CTRL_parentConstraint1.constraintRotateX" "|CHR_alienB001_001:ROOT_NUL|CHR_alienB001_001:RIG_NUL|CHR_alienB001_001:globalSRT_NUL|CHR_alienB001_001:globalSRT_CTRL.rotateX"  :::  |CHR_alienB001_001RNfosterParent1|globalSRT_CTRL_parentConstraint1 ::: constraintTranslateZ
connectAttr "|CHR_alienB001_001RNfosterParent1|globalSRT_CTRL_parentConstraint1.constraintRotateY" "|CHR_alienB001_001:ROOT_NUL|CHR_alienB001_001:RIG_NUL|CHR_alienB001_001:globalSRT_NUL|CHR_alienB001_001:globalSRT_CTRL.rotateY"  :::  |CHR_alienB001_001:ROOT_NUL|CHR_alienB001_001:RIG_NUL|CHR_alienB001_001:globalSRT_NUL|CHR_alienB001_001:globalSRT_CTRL ::: translateZ
connectAttr "|CHR_alienB001_001RNfosterParent1|globalSRT_CTRL_parentConstraint1.constraintRotateZ" "|CHR_alienB001_001:ROOT_NUL|CHR_alienB001_001:RIG_NUL|CHR_alienB001_001:globalSRT_NUL|CHR_alienB001_001:globalSRT_CTRL.rotateZ"  :::  |CHR_alienB001_001RNfosterParent1|globalSRT_CTRL_parentConstraint1 ::: constraintRotateX
connectAttr "|CHR_alienB001_001:ROOT_NUL|CHR_alienB001_001:RIG_NUL|CHR_alienB001_001:globalSRT_NUL|CHR_alienB001_001:globalSRT_CTRL.rotateOrder" "|CHR_alienB001_001RNfosterParent1|globalSRT_CTRL_parentConstraint1.constraintRotateOrder"  :::  |CHR_alienB001_001:ROOT_NUL|CHR_alienB001_001:RIG_NUL|CHR_alienB001_001:globalSRT_NUL|CHR_alienB001_001:globalSRT_CTRL ::: rotateX
connectAttr "|CHR_alienB001_001:ROOT_NUL|CHR_alienB001_001:RIG_NUL|CHR_alienB001_001:globalSRT_NUL|CHR_alienB001_001:globalSRT_CTRL.parentInverseMatrix" "|CHR_alienB001_001RNfosterParent1|globalSRT_CTRL_parentConstraint1.constraintParentInverseMatrix"  :::  |CHR_alienB001_001RNfosterParent1|globalSRT_CTRL_parentConstraint1 ::: constraintRotateY
connectAttr "|CHR_alienB001_001:ROOT_NUL|CHR_alienB001_001:RIG_NUL|CHR_alienB001_001:globalSRT_NUL|CHR_alienB001_001:globalSRT_CTRL.rotatePivot" "|CHR_alienB001_001RNfosterParent1|globalSRT_CTRL_parentConstraint1.constraintRotatePivot"  :::  |CHR_alienB001_001:ROOT_NUL|CHR_alienB001_001:RIG_NUL|CHR_alienB001_001:globalSRT_NUL|CHR_alienB001_001:globalSRT_CTRL ::: rotateY
connectAttr "|CHR_alienB001_001:ROOT_NUL|CHR_alienB001_001:RIG_NUL|CHR_alienB001_001:globalSRT_NUL|CHR_alienB001_001:globalSRT_CTRL.rotatePivotTranslate" "|CHR_alienB001_001RNfosterParent1|globalSRT_CTRL_parentConstraint1.constraintRotateTranslate"  :::  |CHR_alienB001_001RNfosterParent1|globalSRT_CTRL_parentConstraint1 ::: constraintRotateZ

希望有帮助!