hou.InterruptabeOperartion won`t display dialog box

   1644   2   1
User Avatar
Member
258 posts
Joined: July 2006
Offline
I have been trying to figure out why this won`t work. Its suppose to launch the progress bar, But it simply wont, any ideas. I tried on 18.5 , 19.0 python 2.7 and 3

it prints correct , but no UI ?

num_tasks = 100
files = []
for i in range(0,num_tasks):
    files.append("filename_" + str(i))
    
with hou.InterruptableOperation("Performing Tasks", open_interrupt_dialog=True) as op:
    for fi, filename in enumerate(files):
      op.updateLongProgress(fi / float(len(files)-1), filename)
      print ("Iteration_"+ str(fi) + " " + filename)
      
    '''
    for i in files:
        percent = float(i) / float(num_tasks)
        operation.updateProgress(percent)
    '''  

Attachments:
progressBar.png (186.9 KB)

Head of CG @ MPC
CG Supervisor/ Sr. FX TD /
https://gumroad.com/timvfx [gumroad.com]
www.timucinozger.com
User Avatar
Member
8532 posts
Joined: July 2007
Offline
you'd usually use it for operations that take a bit longer time
your finishes super quickly that the progress bar doesn't have time to show up
try this as a placeholder, it includes both progressbars for global and suboperation

import hou
import time

num_tasks = 100
files = []
for i in range(0,num_tasks):
    files.append("filename_" + str(i))
    
with hou.InterruptableOperation("Performing Tasks", long_operation_name = "Filenames", open_interrupt_dialog=True) as op:
    for fi, filename in enumerate(files):
      op.updateLongProgress(fi / float(len(files)-1), "Processing Files {}/{}".format(fi+1, len(files)) )
      with hou.InterruptableOperation(filename) as subop:
          for i in range(10):
            time.sleep(0.01)
            percent = float(i) / 9.0
            subop.updateProgress(percent) 
Edited by tamte - March 2, 2022 01:15:54
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
258 posts
Joined: July 2006
Offline
works just fine, lol, I feel defeated
I guess then my next question would be why does it take so long to show up. and if there is a flag to make it show up faster.

Thanks man
Edited by tricecold - March 2, 2022 06:52:31
Head of CG @ MPC
CG Supervisor/ Sr. FX TD /
https://gumroad.com/timvfx [gumroad.com]
www.timucinozger.com
  • Quick Links