View Full Version : push a Nuke button in a shell script?
cgbeige 08-21-2011, 05:13 PM I'm making a template for generating .cube files and want to avoid using the GUI so I'm making a bash shell script. I have the part that filters the input to generate the scene but I can't just render the scene to generate the cube file. I need to hit "Generate and Write LUT file"
http://sht.tl/b90
Is there a way to do that from the command line? I don't know if Nuke lets you do stuff like this. In Maya, I could do a MEL or Python pre-render script with the command line render app.
|
|
nookie
08-22-2011, 10:57 AM
in command line mode you can use the -X flag to execute a node (if you want to render for example you write -X writeNodeName) or you can try to use the .execute() python command (but I have never done that trough command line)
cgbeige
08-22-2011, 10:34 PM
thanks - I'll look into that.
alkali22
08-25-2011, 06:35 AM
PyScript knobs have a .execute() method that can be called in terminal mode.
cgbeige
08-25-2011, 09:56 PM
would you know what the python call is for Generate LUT? I have zero experience with scripting Nuke so I don't know where to look for this stuff or feedback from GUI operations, if there is any
alkali22
08-26-2011, 04:36 AM
This will generate the node in your linked image (minus an identical path).
g = nuke.nodes.GenerateLUT()
g['file'].setValue('/path/you/want/to/write/your/lut/to/lutFile.cube')
g['file_type'].setValue('.cube')
g['bitdepth_id'].setValue('16 bit')
g['generate'].execute()
cgbeige
08-26-2011, 06:10 PM
ok - so I understand how to execute that with -t in bash but how do I tell it where to look for the Read source that it needs for the input? I'm sorry if this seems obvious but I'm not familiar with Python.
cgbeige
08-27-2011, 10:52 PM
ok - after reading a bit of the docs and wrapping my head around Python a bit, I figured it out:
import sys
r = nuke.nodes.Read(file = '/Volumes/HOME_RAID/STOCK/cube_3D_luts/template_files/test.tif')
g = nuke.nodes.GenerateLUT()
g.setInput( 0, r )
g['file'].setValue('/Users/beige/Desktop/lutFile.cube')
g['file_type'].setValue('.cube')
g['bitdepth_id'].setValue('16 bit')
g['generate'].execute()
Now I'll just make the file into a variable sys.argv[1]. Thanks for the help. I'll be putting an auto-3DLUT shell script up on Nukepedia soon.
CGTalk Moderation
08-27-2011, 10:52 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.