def process_meshes(zip_file): gltf = json.loads(zip_file.read("scene.gltf")) buffer = zip_file.read("scene.bin") drone_obj_data = dump_obj_data(gltf, buffer, 0, with_skin=True, with_tangent=True) drone_filepath = os.path.join(DST_DIRECTORY, "drone.obj") with open(drone_filepath, "w") as f: f.write(drone_obj_data) for mesh_index in range(1, len(gltf["meshes"])): fire_obj_data = dump_obj_data(gltf, buffer, mesh_index) fire_filename = "fire{}.obj".format(mesh_index - 1) fire_filepath = os.path.join(DST_DIRECTORY, fire_filename) with open(fire_filepath, "w") as f: f.write(fire_obj_data) drone_ani_data = dump_skin_ani_data(gltf, buffer) drone_ani_filepath = os.path.join(DST_DIRECTORY, "drone.ani") with open(drone_ani_filepath, "w") as f: f.write(drone_ani_data) fire_ani_data, _ = dump_node_ani_data(gltf, buffer) fire_ani_filepath = os.path.join(DST_DIRECTORY, "fire.ani") with open(fire_ani_filepath, "w") as f: f.write(fire_ani_data)
def process_meshes(zip_file): gltf = json.loads(zip_file.read("scene.gltf")) buffer = zip_file.read("scene.bin") for mesh_index, obj_filename in enumerate(OBJ_FILENAMES): obj_data = dump_obj_data(gltf, buffer, mesh_index, with_skin=True) obj_filepath = os.path.join(DST_DIRECTORY, obj_filename) with open(obj_filepath, "w") as f: f.write(obj_data) ani_data = dump_skin_ani_data(gltf, buffer) ani_filepath = os.path.join(DST_DIRECTORY, "phoenix.ani") with open(ani_filepath, "w") as f: f.write(ani_data)
def process_meshes(zip_file): gltf = json.loads(zip_file.read("scene.gltf")) buffer = zip_file.read("scene.bin") for mesh_index in range(len(gltf["meshes"])): obj_data = dump_obj_data(gltf, buffer, mesh_index, with_tangent=True) obj_filename = "horse{}.obj".format(mesh_index) obj_filepath = os.path.join(DST_DIRECTORY, obj_filename) with open(obj_filepath, "w") as f: f.write(obj_data) ani_data = dump_skin_ani_data(gltf, buffer, animation_index=3) ani_filepath = os.path.join(DST_DIRECTORY, "horse.ani") with open(ani_filepath, "w") as f: f.write(ani_data)
def process_meshes(zip_file): gltf = json.loads(zip_file.read("scene.gltf")) buffer = zip_file.read("scene.bin") obj_data = dump_obj_data(gltf, buffer, 0, with_skin=True, with_tangent=True) obj_filepath = os.path.join(DST_DIRECTORY, "crab.obj") with open(obj_filepath, "w") as f: f.write(obj_data) ani_data = dump_skin_ani_data(gltf, buffer) ani_filepath = os.path.join(DST_DIRECTORY, "crab.ani") with open(ani_filepath, "w") as f: f.write(ani_data)