Jump to content

hou.hipFileLoad in multiple threads


holycause

Recommended Posts

I have my thread Class that loads a hipfile

 

class GetNodesThread(QtCore.QThread):
    
    send_node = QtCore.pyqtSignal(object)
    
    def __init__(self, file, parent, v):
        self.m_file = file
        .....


    def run(self):
        hou.hipFile.load(self.m_file)

and then in my main script create 1 thread for each file

 

#Thread 1
thread1 = HThreads.GetNodesThread(self.m_file1, self, 1)
#thread1.send_node.connect(lambda x: self.getObjLists(1, x))
self.m_threads.append(thread1)


#Thread 2
thread2 = HThreads.GetNodesThread(self.m_file2, self, 2)
#thread2.send_node.connect(lambda y: self.getObjLists(2, y))
self.m_threads.append(thread2)


#Start threads
for thread in self.m_threads:
    thread.start()

I have some additional debugging code writing out information regarding the loaded files and this is what happens

 

/path/to/the/hipfile - loaded_hipefile

 

Thread 1:

Pre load
Z:/devel/python/hipfile_diff_check/hip/sphere_v1.hip - untitled.hip


Loaded
Z:/devel/python/hipfile_diff_check/hip/sphere_v1.hip - sphere_v2.hip
Wrong file

Thread 2:

Pre load
Z:/devel/python/hipfile_diff_check/hip/sphere_v2.hip - untitled.hip


Loaded
Z:/devel/python/hipfile_diff_check/hip/sphere_v2.hip - sphere_v2.hip
Correct file
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...