在Maya中,有没有办法在约束是寄生节点时查询约束的源和目标?
我正在尝试诊断成为养父母后连接丢失的问题,因此我需要中间信息来与有效的约束进行比较。
我遇到的所有方法都需要建立连接,但是虽然它是一个寄养节点,但这些方法并不存在。 Maya 能够恢复连接,以便信息必须存在于某处。
您可以尝试通过编辑引用来识别约束。打开参考编辑器,然后运行文件>列表参考编辑。这将弹出一个新窗口,该窗口将显示在引用之外进行的所有编辑。此列表可能很大,因此您可以键入约束的名称来筛选结果。
现在,如果您尝试通过脚本访问它,则可以使用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
希望对您有所帮助!