#1 is the way I would go, as it’s the simplest to implement, and has the lowest potential for human (or Nuke-induced) error, since you’re still using Nuke to make your changes.
You basically need 2 things: 1) A Python script that accepts a Nuke script path as an argument and does the opening, editing, and saving of said script; and 2) Something to loop over your list of script files. For this, you could either use a shell script, or another Python script that launches Nuke subprocesses. Then you basically just run this over and over again: Nuke -t -- /path/to/python/script.py /path/to/nuke/script_XX.nk This approach also has the greatest potential for future flexibility and reusability if batch script editing is something you’re going to need to do regularly, as you can continue to add arbitrarily complex combinations of flags and arguments for things like node/knob names/patterns, knob values, etc. #2 isn’t possible the way you’ve described it, since as soon as you have a script open, subsequent calls to nuke.scriptOpen (even from a saved state) will spawn a new Nuke process. You could potentially use a combination of script importing/exporting/clearing to do something similar, but I wouldn’t trust that approach to get you very far. For #3, if you have a name-, class-, or knob-based method of identifying the specific nodes you need to make changes to, it’s not *too* tough to do, though you’ll want to be sure you have a good grasp of file I/O and error handling in Python, and a good scheme for creating copies/backups before editing scripts. I would definitely try #1 first though. -Nathan From: chrissowa Sent: Wednesday, November 07, 2012 11:07 PM To: nuke-python@support.thefoundry.co.uk Subject: [Nuke-python] Experience: Batch editing of many Nuke-Scripts I just wanted to ask what is the best way to batch edit nodes in many nuke-scripts. Just a simplified theoretical example.: You got a project (1000 Shots) and every shot has a final nuke script. This nuke script consists of: read -> blur -> write The Blur-size is set to 10. Now i want to increase the blur for all shots on 20. Possible ways i see to achieve this by scripting: * open every nuke script in "terminal mode" with python parameters that change the value * run a function in GUI nuke that opens the first script, changes the value, saves it and goes on with the next script. all in one nuke window * edit the *.nk-files like with an texteditor programmatically and change the values in the nuke file itself So my questions are: * Are there any other (better) ways to do batch editing? * What speaks against or for my different possibilities? What way would you prefer? * I ve never used way 1 or 3 but the idea of way 3 seems to be the coolest (fastest) way to me? * Would HIERO change the way to do this? Actually im still new to NUKE and Python and it s difficult to get help on practical application of all these possibilities. So i really would be glad on any hint. Thanks in advance. -------------------------------------------------------------------------------- _______________________________________________ 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
_______________________________________________ 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