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 CLOSED
 
Thread Tools Search this Thread Display Modes
  08 August 2011
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"

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.
 
  08 August 2011
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)
 
  08 August 2011
thanks - I'll look into that.
 
  08 August 2011
PyScript knobs have a .execute() method that can be called in terminal mode.
 
  08 August 2011
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
 
  08 August 2011
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()
 
  08 August 2011
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.
 
  08 August 2011
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.
 
  08 August 2011
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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 03:17 PM.


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