validate_rig_members.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:config 作者: mindbender-studio 项目源码 文件源码
def process(self, instance):
        from maya import cmds

        missing = list()

        for member in ("controls_SET",
                       "out_SET"):
            if member not in instance:
                missing.append(member)

        assert not missing, "\"%s\" is missing members: %s" % (
            instance, ", ".join("\"" + member + "\"" for member in missing))

        # Ensure all output has IDs.
        # As user may inadvertently add to the out_SET without
        # realising, and some of the new members may be non-meshes,
        # or meshes without and ID
        missing = list()

        for node in cmds.sets("out_SET", query=True) or list():

            # Only check transforms with shapes that are meshes
            shapes = cmds.listRelatives(node, shapes=True) or list()
            meshes = cmds.ls(shapes, type="mesh")

            if not meshes:
                continue

            try:
                self.log.info("Checking '%s'" % node)
                cmds.getAttr(node + ".mbID")
            except ValueError:
                missing.append(node)

        assert not missing, ("Missing ID attribute on: %s"
                             % ", ".join(missing))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号