|
|
|
@ -62,7 +62,7 @@ def fix_link_texture(pid): |
|
|
|
if os.path.exists(texture_file): |
|
|
|
if os.path.exists(texture_file): |
|
|
|
img = Image.open(texture_file) |
|
|
|
img = Image.open(texture_file) |
|
|
|
img = img.resize((int(img.size[0] * 0.5), int(img.size[1] * 0.5))) |
|
|
|
img = img.resize((int(img.size[0] * 0.5), int(img.size[1] * 0.5))) |
|
|
|
img.save(texture_file, quality=90, optimize=True) |
|
|
|
img.save(texture_file, quality=100, optimize=True) |
|
|
|
print('resize texture file to 50% success') |
|
|
|
print('resize texture file to 50% success') |
|
|
|
# 修改pid_original.mtl文件中的贴图为pid_old.jpg |
|
|
|
# 修改pid_original.mtl文件中的贴图为pid_old.jpg |
|
|
|
with open(os.path.join(path, f'{pid}_original.mtl'), 'r') as f: |
|
|
|
with open(os.path.join(path, f'{pid}_original.mtl'), 'r') as f: |
|
|
|
@ -175,7 +175,7 @@ def main(): |
|
|
|
bpy.ops.object.transform_apply(location=True, rotation=True, scale=True) |
|
|
|
bpy.ops.object.transform_apply(location=True, rotation=True, scale=True) |
|
|
|
|
|
|
|
|
|
|
|
bpy.ops.export_scene.obj(filepath=os.path.join(path, f'{pid}_decimate.obj')) |
|
|
|
bpy.ops.export_scene.obj(filepath=os.path.join(path, f'{pid}_decimate.obj')) |
|
|
|
bpy.ops.export_scene.gltf(filepath=os.path.join(path, f'{pid}_decimate.glb'), export_format='GLB', export_apply=True, export_jpeg_quality=95) |
|
|
|
bpy.ops.export_scene.gltf(filepath=os.path.join(path, f'{pid}_decimate.glb'), export_format='GLB', export_apply=True, export_jpeg_quality=100) |
|
|
|
config.oss_bucket.put_object_from_file(f'glbs/3d/{pid}.glb', os.path.join(path, f'{pid}_decimate.glb')) |
|
|
|
config.oss_bucket.put_object_from_file(f'glbs/3d/{pid}.glb', os.path.join(path, f'{pid}_decimate.glb')) |
|
|
|
bpy.ops.wm.quit_blender() |
|
|
|
bpy.ops.wm.quit_blender() |
|
|
|
|
|
|
|
|
|
|
|
|