This commit is contained in:
dongchangxi committed 2025-05-13 17:29:01 +08:00
1 parent 2951906785
commit 9297d3c0f1
11 files changed
+225 -30

No files matched your search

BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+30 -1
View File
@@ -1,4 +1,4 @@
import os, sys, time, bpy, math, requests, bmesh, json, shutil
import os, sys, time, bpy, math, requests, bmesh, json, shutil,oss2
from PIL import Image
import platform,redis
if platform.system() == 'Windows':
@@ -44,6 +44,35 @@ def find_pid_objname(pid):
return obj.name
def down_obj_from_oss(workdir, pid, action):
if os.path.exists(os.path.join(workdir, action, pid)):
print(f'目录{os.path.join(workdir, action, pid)}已存在,跳过')
return
else:
os.makedirs(os.path.join(workdir, action, pid))
# 根据前缀获取文件列表
prefix = f'objs/print/{pid}/base/model/'
filelist = oss2.ObjectIteratorV2(config.oss_bucket, prefix=prefix)
print('正在下载:', prefix)
obj_filename = ""
for file in filelist:
filename = file.key.split('/')[-1]
if filename.endswith(".exr"):
continue
if filename.endswith("_1.jpg") or filename.endswith("_8.jpg"):
continue
if filename.endswith('.obj'):
obj_filename = filename
# print('正在下载:', file.key)
localfile = os.path.join(workdir, action, pid, filename)
config.oss_bucket.get_object_to_file(file.key, localfile)
return obj_filename
#加载obj文件
def reload_obj(pid):