Jump to content
emnrdl

Python therading on hyton gives Qt warning

Recommended Posts

I am trying to render 2 hda simultaneously and I decide to using python threading it works on the houduni's python shell but it don't work on hyton. What is the problem here? How can I solve this?

PythonShell

thrte.PNG.7d89320a3cec19f4c5e15c477c4936cb.PNG

hyton

eror.PNG.5c34820ea349cfe743320c8dbf37438f.PNG

Code 

import hou
import time
import threading

def nodeRender(nodeName,path,fileName,nodeCnt):

    start_node_time = time.time()
    node = hou.node("/obj")
    sp_name = "{}{}".format(nodeName, nodeCnt)
    file_save_name = "{}{}.png".format(fileName, nodeCnt)
    node.createNode(nodeName, sp_name)
    nodepic = hou.node("/obj/{}".format(sp_name))
    nodepic.parm("output").set("{}/{}".format(path, file_save_name))
    nodepic.parm("render").pressButton()
    nodepic.destroy()
    ex_time = '{:.2f}'.format((time.time() - start_node_time))
    print("--- %s seconds ---" % ex_time) 

def renderThread():
    start_time = time.time()
    
    t1 = threading.Thread(target = nodeRender, args=["Masa", "C:/Users/emnrdl/Desktop/New Folder (13)", "MasaTest" , "1"])
    t2 = threading.Thread(target = nodeRender, args=["Masa", "C:/Users/emnrdl/Desktop/New Folder (13)", "MasaTest" , "2"])

    t1.start()
    t2.start()

    t1.join()
    t2.join()
    total_ex_time = '{:.2f}'.format((time.time() - start_time))
    print("--- Total execution time: %s seconds ---" % total_ex_time)

 

render thread.PNG

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×