Hi everybody, I am working on a python script that creates more than 25 read nodes with approximately 30 timeOffset nodes connected to each of them. So I end up with a script containing something like 1000 nodes. This could be extended later, depending on the needs.
This is quite compute intensive to run. The main nuke thread/window freezes and you don’t know how long you have to wait until it’s finished. I am trying to put this in a separate thread with a status bar. The problem is that the threaded way is even slower than without putting it in a separate thread. To make it a bit clear, I wrote some python lines to demonstrate what I am trying to do: -------------------------------------------------------------------------------------------- import threading ### option 1: even slower than option 2 ### def createBlurNodes(): task = nuke.ProgressTask("Create") task.setMessage("Creating blur nodes") for i in range(1000): nuke.executeInMainThreadWithResult(nuke.createNode, args = ('Blur', '', False)) task.setProgress(i/10) threading.Thread(None, createBlurNodes).start() ### option 2: slow and I don't have visible feedback about the estimated calculation time. Plus nuke is freezing for a couple of seconds, depending on your machine specs. ### for i in range(1000): nuke.createNode('Blur', '', False) -------------------------------------------------------------------------------------------- Maybe it’s slow because nuke.createNode is always running in the main thread? Is this the correct way, or is there a better way to script this? Thanks for the help in advance! Bram Buddingh_______________________________________________ Nuke-python mailing list Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python