def execute(self, context): apps = join(verge3d.get_root(), 'applications') for root, dirs, files in os.walk(apps): for name in files: if fnmatch.fnmatch(name, '*.blend'): blendpath = norm(join(root, name)) # use file utility to check .blend version if sys.platform.startswith('linux'): fileinfo = subprocess.check_output( ['file', '--uncompress', blendpath]).decode() ver = re.search('\d\.\d\d', fileinfo).group(0) verMaj, verMin = [int(n) for n in ver.split('.')] # ignore uncompatible blender 2.80 files if bpy.app.version < (2, 80, 0) and (verMaj > 2 or verMin >= 80): continue gltfpath = os.path.splitext(blendpath)[0] + '.gltf' if os.path.exists(gltfpath): self.__class__.exported.append((blendpath, gltfpath)) self.__class__.reexportNext() return {"FINISHED"}
def execute(self, context): prev_dir = join(verge3d.get_root(), "player", "preview") if os.path.exists(prev_dir): shutil.rmtree(prev_dir) os.mkdir(prev_dir) bpy.ops.export_scene.v3d_gltf( filepath=join(prev_dir, "sneak_peek.gltf"), export_sneak_peek = True) exec_browser(APP_MANAGER_HOST + "player/player.html?load=preview/sneak_peek.gltf") return {"FINISHED"}
def execute(self, context): apps = join(verge3d.get_root(), 'applications') for root, dirs, files in os.walk(apps): for name in files: if fnmatch.fnmatch(name, '*.blend'): blendpath = norm(join(root, name)) gltfpath = os.path.splitext(blendpath)[0] + '.gltf' if os.path.exists(gltfpath): self.__class__.exported.append((blendpath, gltfpath)) self.__class__.reexportNext() return {"FINISHED"}