Jump to content

Python therading on hyton gives Qt warning


emnrdl

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...