Python 将多个模型上载到sketchfab

Python 将多个模型上载到sketchfab,python,subprocess,call,blender,Python,Subprocess,Call,Blender,下面是用blender python编写的代码 import bpy import os import subprocess import time bpy.data.materials["Material"].use_face_texture = True customer_id = "john33" image1 = "orangeskin.jpg" # define image 1 from folder imagepath1 = "C:\\Users\\mrryan\\Desktop\\

下面是用blender python编写的代码

import bpy
import os
import subprocess
import time
bpy.data.materials["Material"].use_face_texture = True
customer_id = "john33"
image1 = "orangeskin.jpg" # define image 1 from folder
imagepath1 = "C:\\Users\\mrryan\\Desktop\\models\\materialsjpeg\\" 
image2 = "elec.jpg"
imagepath2 = "C:\\Users\\mrryan\\Desktop\\models\\materialsjpeg\\" 

#Step 1 go to Edit Mode
bpy.ops.object.editmode_toggle()

#step 2 insert image in the Image Editor
bpy.context.area.type = 'IMAGE_EDITOR'
bpy.ops.uv.smart_project()
bpy.ops.image.open(filepath = image1, directory= imagepath1 , 
files=[{"name":image1, "name":image1}])

#Step 3 back to Object Mode TRY AND CHANGE TITLE TO `CUSTOMER_ID AND FILE`
bpy.ops.object.editmode_toggle()
bpy.data.window_managers["WinMan"].sketchfab.title = "orangetube"



#Step 4 save new.blend   
filepath = os.path.join(r"C:\Users\mrryan\Desktop", customer_id + "orangytube.blend")
bpy.ops.wm.save_as_mainfile(filepath = filepath)
toggleedit = bpy.ops.object.editmode_toggle()
#here is the problem!!!!
subprocess.call(["bpy.ops.export.sketchfab()"], shell = True)



#new texture
#Step 1 go to Edit Mode


#step 2 insert image in the Image Editor
bpy.context.area.type = 'IMAGE_EDITOR'

bpy.ops.image.open(filepath= image2, directory= imagepath2, 
files= [{"name":image2,"name":image2}])    
bpy.ops.uv.smart_project()

#Step 3 back to Object Mode
bpy.ops.object.editmode_toggle()
bpy.data.window_managers["WinMan"].sketchfab.title = "elec-tube"
#Step 4 save new.blend
filepath = os.path.join(r"C:\Users\mrryan\Desktop", customer_id + "elec-tube.blend")
bpy.ops.wm.save_as_mainfile(filepath = filepath)
bpy.ops.export.sketchfab()
其想法是,最终以编程方式更改活动对象(已组合但未与另一个对象连接)以具有不同的材质和更改形状等。每个单独的模型组合将分别上载到sketchfab并保存为混合器文件

在这个阶段,我的问题是,在上载时,脚本不会等到第一次上载完成。这会生成一个错误,表示请等待当前上载完成。因此,只上传了一个模型。 子进程Popen 已经试过了,但我没法让它工作。 也许返回值是错误的? 如何让脚本上载第一个模型,等待完成,然后继续进行调整并上载第二个模型?

(我在Sketchfab工作,但我在Blender脚本方面没有太多经验)

问题是Sketchfab Blender导出器使用一个线程进行上载,这意味着子进程将返回,并且一个线程仍在后台运行

我将尝试使用一个新线程和
join()
来启动
bpy.ops.export.sketchfab()
,而不仅仅是子进程

以下资源可能会有所帮助:

让我们知道进展如何