push a Nuke button in a shell script?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
Old 08 August 2011   #1
push a Nuke button in a shell script?

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"


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.
Old 08 August 2011   #2
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)
Old 08 August 2011   #3
thanks - I'll look into that.
Old 08 August 2011   #4
PyScript knobs have a .execute() method that can be called in terminal mode.
Old 08 August 2011   #5
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
Old 08 August 2011   #6
This will generate the node in your linked image (minus an identical path).

g = nuke.nodes.GenerateLUT()
g['bitdepth_id'].setValue('16 bit')
Old 08 August 2011   #7
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.

Last edited by cgbeige : 08 August 2011 at 06:17 PM.
Old 08 August 2011   #8
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['bitdepth_id'].setValue('16 bit')

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.
Old 08 August 2011   #9
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 07:52 PM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.