validate_encapsulation.py 文件源码

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

项目:pyblish-starter 作者: pyblish 项目源码 文件源码
def process(self, instance):
        import os
        from maya import cmds

        # Resources are optional
        if "resources_SEL" not in instance:
            return

        resources = dict()
        for resource in cmds.sets("resources_SEL", query=True):
            if cmds.nodeType(resource) == "reference":
                path = cmds.referenceQuery(resource,
                                           filename=True,
                                           unresolvedName=True)

            elif cmds.nodeType(resource) == "AlembicNode":
                path = cmds.getAttr(resource + ".abc_File")

            else:
                # Unsupported
                path = None

            resources[resource] = path

        # All resources were resolved
        assert all(resources.values()), (
            "Unsupported resource(s): " +
            ", ".join("'%s': '%s'" % (resource, path)
                      for resource, path in resources.items()
                      if path is not None)
        )

        # No resource contains an absolute path
        assert not any(os.path.isabs(fname) for fname in resources), (
            "Some resources are absolute: " +
            ", ".join(resources)
        )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号