Exemplo n.º 1
0
Arquivo: io.py Projeto: galou/phobos
 def execute(self, context):
     startLog(self)
     objs = context.selected_objects
     root = sUtils.getRoot(context.selected_objects[0])
     model = robotdictionary.buildModelDictionary(root)
     sUtils.selectObjects(objs)
     if bpy.data.worlds[0].relativePath:
         outpath = exporter.securepath(os.path.expanduser(os.path.join(bpy.path.abspath("//"), bpy.data.worlds[0].path)))
     else:
         outpath = exporter.securepath(os.path.expanduser(bpy.data.worlds[0].path))
     exporter.bakeModel(objs, outpath, model["modelname"])
     with open(os.path.join(outpath, "info.bake"), "w") as f:
         f.write(yaml.dump({"name": model["modelname"]}))
     endLog()
     return {'FINISHED'}
Exemplo n.º 2
0
 def execute(self, context):
     startLog(self)
     objs = context.selected_objects
     robot = robotdictionary.buildRobotDictionary()
     selectionUtils.selectObjects(objs)
     outpath = ""
     if bpy.data.worlds[0].relativePath:
         outpath = exporter.securepath(os.path.expanduser(os.path.join(bpy.path.abspath("//"), bpy.data.worlds[0].path)))
     else:
         outpath = exporter.securepath(os.path.expanduser(bpy.data.worlds[0].path))
     #expPath = os.path.join(outpath, robot["modelname"] + "_bake")
     #exporter.export(path=expPath, robotmodel=robot)
     exporter.bakeModel(objs, outpath, robot["modelname"])
     with open(os.path.join(outpath, "info.bake"), "w") as f:
         f.write(yaml.dump({"name": robot["modelname"]}))
     endLog()
     return {'FINISHED'}
Exemplo n.º 3
0
 def execute(self, context):
     startLog(self)
     objs = context.selected_objects
     root = sUtils.getRoot(context.selected_objects[0])
     model = robotdictionary.buildModelDictionary(root)
     sUtils.selectObjects(objs)
     if bpy.data.worlds[0].relativePath:
         outpath = exporter.securepath(
             os.path.expanduser(
                 os.path.join(bpy.path.abspath("//"),
                              bpy.data.worlds[0].path)))
     else:
         outpath = exporter.securepath(
             os.path.expanduser(bpy.data.worlds[0].path))
     exporter.bakeModel(objs, outpath, model["modelname"])
     with open(os.path.join(outpath, "info.bake"), "w") as f:
         f.write(yaml.dump({"name": model["modelname"]}))
     endLog()
     return {'FINISHED'}
Exemplo n.º 4
0
 def execute(self, context):
     startLog(self)
     objs = context.selected_objects
     robot = robotdictionary.buildRobotDictionary()
     selectionUtils.selectObjects(objs)
     outpath = ""
     if bpy.data.worlds[0].relativePath:
         outpath = exporter.securepath(
             os.path.expanduser(
                 os.path.join(bpy.path.abspath("//"),
                              bpy.data.worlds[0].path)))
     else:
         outpath = exporter.securepath(
             os.path.expanduser(bpy.data.worlds[0].path))
     #expPath = os.path.join(outpath, robot["modelname"] + "_bake")
     #exporter.export(path=expPath, robotmodel=robot)
     exporter.bakeModel(objs, outpath, robot["modelname"])
     with open(os.path.join(outpath, "info.bake"), "w") as f:
         f.write(yaml.dump({"name": robot["modelname"]}))
     endLog()
     return {'FINISHED'}
Exemplo n.º 5
0
Arquivo: io.py Projeto: bmagyar/phobos
 def execute(self, context):
     startLog(self)
     objs = context.selected_objects
     robot = robotdictionary.buildRobotDictionary()
     selectionUtils.selectObjects(objs)
     tmpdir = tempfile.gettempdir()
     expPath = os.path.join(tmpdir, robot["modelname"] + "_bake")
     exporter.export(path=expPath, robotmodel=robot)
     exporter.bakeModel(objs, expPath, robot["modelname"])
     zipfilename = os.path.join(tmpdir, robot["modelname"] + ".bake")
     file = zipfile.ZipFile(zipfilename, mode="w")
     for filename in os.listdir(expPath):
         file.write(os.path.join(expPath, filename), arcname=filename)
     file.close()
     shutil.rmtree(expPath)
     outpath = ""
     if bpy.data.worlds[0].relativePath:
         outpath = exporter.securepath(os.path.expanduser(os.path.join(bpy.path.abspath("//"), bpy.data.worlds[0].path)))
     else:
         outpath = exporter.securepath(os.path.expanduser(bpy.data.worlds[0].path))
     shutil.copy(zipfilename, outpath)
     endLog()
     return {'FINISHED'}