__init__.py 文件源码

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

项目:bpy_lambda 作者: bcongdon 项目源码 文件源码
def save(self):
    scn = bpy.context.scene
    cats = set([cat.name for cat in self.cats])
    libpath = bpy.context.scene.matlib.current_library.path

    cmd = """
print(30*"+")
import bpy
if not hasattr(bpy.context.scene, "matlib_categories"):
  class EmptyProps(bpy.types.PropertyGroup):
    pass
  bpy.utils.register_class(EmptyProps)
  bpy.types.Scene.matlib_categories = bpy.props.CollectionProperty(type=EmptyProps)
cats = bpy.context.scene.matlib_categories
for cat in cats:
  cats.remove(0)
"""
    for cat in cats:
      cmd += """
cat = cats.add()
cat.name = "%s" """ % cat.capitalize()
    cmd +='''
bpy.ops.wm.save_mainfile(filepath="%s", check_existing=False, compress=True)''' % winpath(libpath)

    return send_command(cmd, "save_categories.py")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号