From 6117a5f49db5b144aad7ec0a2e4aa7db9c7d369f Mon Sep 17 00:00:00 2001 From: dongchangxi <458593490@qq.com> Date: Tue, 1 Jul 2025 10:01:35 +0800 Subject: [PATCH] aa --- .gitignore | 5 +++++ apps/auto_convert3d_new.py | 20 ++++++++++---------- timer/external_order_glbV2.py | 2 +- tools/pic_for_obj/image_rander_small.py | 6 +++--- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index d788368..afd3f09 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,8 @@ test/test1.py timer/29.zip yj_local_build/main_step1.spec yj_local_build/建模source_code.zip +apps/__pycache__/fix_up_color_two_a.cpython-310.pyc +.gitignore +apps/__pycache__/ps_image_shadow_up_ag_two_a.cpython-310.pyc +apps/__pycache__/white_purification_v3.cpython-310.pyc +apps/__pycache__/white_purification_v4.cpython-310.pyc diff --git a/apps/auto_convert3d_new.py b/apps/auto_convert3d_new.py index fe450bb..411d552 100644 --- a/apps/auto_convert3d_new.py +++ b/apps/auto_convert3d_new.py @@ -36,13 +36,13 @@ def down_obj_fromoss(pid,order_id): print("AAAAAAAAA",ossPath) - path = os.path.join(workdir, 'print', pid) + path = os.path.join(workdir, 'print', pid,order_id) if not os.path.exists(path): os.makedirs(path) # 根据前缀获取文件列表 prefix = f'objs/print/{pid}/' if ossPath != "": - prefix = os.path.join("objs","print",pid,ossPath,order_id) + prefix = os.path.join("objs","print",pid,ossPath) if "base/" in ossPath: prefix = os.path.join("objs","print",pid,ossPath) prefix = prefix.replace("\\","/") @@ -122,34 +122,34 @@ def team_check(r): pid = str(pid) orderId = str(orderId) - print(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()), f'pid:{pid} repair_id:{repair_id} 生成团队审核模型 start model:IndependentRepairTeamcheckGLBQueue', ) + #print(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()), f'pid:{pid} repair_id:{repair_id} 生成团队审核模型 start model:IndependentRepairTeamcheckGLBQueue', ) ossPath = down_obj_fromoss(pid,orderId) obj_filename = f'{pid}.obj' glb_filename = f'{orderId}.glb' print('开始转换obj文件为glb文件...') - os.system(f'gltfpack -c -i {os.path.join(workdir, "print", pid, obj_filename)} -o {os.path.join(workdir, "print", pid, glb_filename)} -vt 16 -vc 16') + os.system(f'gltfpack -c -i {os.path.join(workdir, "print", pid,orderId, obj_filename)} -o {os.path.join(workdir, "print", pid,orderId, glb_filename)} -vt 16 -vc 16') #处理封面图 #执行获取obj缩略图 print("执行获取obj全身缩略图脚本1111111111") - os.system(f'python d:\\make2\\tools\pic_for_obj\image_rander_small.py -pid {pid} -i D://print/{pid} -o D://print/{pid}') + os.system(f'python d:\\make2\\tools\pic_for_obj\image_rander_small.py -pid {pid} -i D://print/{pid}/{orderId} -o D://print/{pid}/{orderId}') print("判断是否存在封面图") #判断文件是否存在,存在则上传到oss, 更新数据库内容 - if os.path.exists(f'D://print/{pid}/{pid}_pic.png'): + if os.path.exists(f'D://print/{pid}/{orderId}/{pid}_pic.png'): #获取拍照订单的信息,从中得到拍照订单的信息 uuid = get_p3d_info(str(pid)) if uuid != 0 and uuid != None and uuid != "": print("uuid",uuid) - config.oss_bucket_3d_view.put_object_from_file(f'{uuid}/3d_view.png', f'D://print/{pid}/{pid}_pic.png') + config.oss_bucket_3d_view.put_object_from_file(f'{uuid}/3d_view.png', f'D://print/{pid}/{orderId}/{pid}_pic.png') - oss_client.put_object_from_file(f'glbs/print/order_id/{glb_filename}', os.path.join(workdir, "print", pid, glb_filename)) + oss_client.put_object_from_file(f'glbs/print/order_id/{glb_filename}', os.path.join(workdir, "print", pid,orderId, glb_filename)) #对文件进行白色提纯处理 - imagePath = os.path.join(workdir, 'print', pid,pid+"Tex1.jpg") + imagePath = os.path.join(workdir, 'print', pid,orderId,pid+"Tex1.jpg") print("开始处理白色提纯") #white_purification.white_purification_utils(imagePath) os.system(f'python D:\\make2\\apps\white_purification_v4.py -i {imagePath}') @@ -165,7 +165,7 @@ def team_check(r): print(f'{update_repair_status_url}?id={repair_id}') res = requests.get(f'{update_repair_status_url}?id={repair_id}') print('更新团队审核状态:', res.text) - shutil.rmtree(os.path.join(workdir, 'print', pid), ignore_errors=True) + #shutil.rmtree(os.path.join(workdir, 'print', pid,orderId), ignore_errors=True) print(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()), f'pid:{pid} 生成团队审核模型 end') def get_p3d_info(pid): diff --git a/timer/external_order_glbV2.py b/timer/external_order_glbV2.py index e71aace..1cd99bc 100644 --- a/timer/external_order_glbV2.py +++ b/timer/external_order_glbV2.py @@ -235,7 +235,7 @@ def export_and_update_glbs(pid,order_ids): print(res.text) #执行获取obj缩略图 print("执行获取obj全身缩略图脚本") - os.system(f'python d:\\make2\\tools\pic_for_obj\image_rander_small.py -pid {pid} -i D://print -o D://print/{pid}') + os.system(f'python d:\\make2\\tools\pic_for_obj\image_rander_small.py -pid {pid} -i D://print/{pid} -o D://print/{pid}') print("判断获取封面图是否存在0") #判断文件是否存在,存在则上传到oss, 更新数据库内容 if os.path.exists(f'D://print/{pid}/{pid}_pic.png'): diff --git a/tools/pic_for_obj/image_rander_small.py b/tools/pic_for_obj/image_rander_small.py index 9a9cfb5..4dc2670 100644 --- a/tools/pic_for_obj/image_rander_small.py +++ b/tools/pic_for_obj/image_rander_small.py @@ -86,7 +86,7 @@ def rander_image_and_check(args): """渲染图片""" # 列出obj列表 pid = args.pid - pid_file_dir = os.path.join(args.input,pid) + pid_file_dir = os.path.join(args.input) if not os.path.exists(pid_file_dir): print(f"不存在{pid_file_dir}") return @@ -125,10 +125,10 @@ def rander_image_and_check(args): start_import = time.time() print("===============", os.path.join(args.input, pid, obj_file)) with stdout_redirected(to=os.devnull): - bpy.ops.import_scene.obj(filepath=os.path.join(args.input, pid, obj_file)) + bpy.ops.import_scene.obj(filepath=os.path.join(args.input, obj_file)) print( f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())}: import pid: {pid} done in {time.time() - start_import:.2f}s') - texture_path = os.path.join(args.input, pid, texture_file) + texture_path = os.path.join(args.input,texture_file) materials = bpy.data.materials for material in materials: # 确保材质使用节点树