To get just the filename you can do something like:

Import os
print os.path.basename( nuke.Root().name() )

Or

nuke.Root().name().split('/')[-1]

You can replace the / for os.sep()

For the TypeError you can simply do int(version)+1 assuming the version 
variable is assigned to a numerical character. 

To use padded sequences just format your filename string correctly using either 
#### or %04d, I suggest you stick with %04d though. 

To sample RGBA data look into nuke.sample on the docs. 


Cheers,
Diogo

On 29/03/2012, at 11:14, Jon Wesström <[email protected]> wrote:

> I'm still very new to python/nuke scripting, so these questions might be 
> dumb, but I'm getting tired of not being able to solve them.
> 
> I'm working on a tool that makes it easy to make breakdowns of a script, you 
> basically select a node, press a button, and nuke renders out a frame.
> 
> That part of the tool is done, but I'm getting stuck on all the stuff that is 
> generating the filename
> 
> 1: When pressing the renderbutton, the script spawns a writenode, puts text 
> in the file knob, renders the frame and then is deleted 
> (      nuke.removeAfterFrameRender(nuke.delete(nuke.toNode('FrameRender'))) )
> 
> That works fine, but I would also like to add an increment to the filename, 
> so I figured this would work: nuke.removeAfterFrameRender(version = version + 
> 1), but it gives me this error: 
> TypeError: cannot concatenate 'str' and 'int' objects.
> I have tried a bunch of different ways to solve it, but nothing is working.
> 
> 2: Is there a way to force python/nuke to display number using a set amount 
> of increments?
> Ex: I would prefer the frame do be written as 0015 in the filename, and not 
> 15.
> 
> 3: Is there a way to access the name of the script?
> I know you can write nuke.root().knob('name').getValue(), but that outputs 
> not only the name, but also the entire filepath.
> 
> 4: Not related to this, but is there any way to access the rgba data that the 
> viewer sampler samples?
> Would like a stickynote that, when created writes down the currently sampled 
> colors in RGBA.
> 
> If you would like to take a look at the entire script: 
> http://slexy.org/view/s2gqT5q5Sq
> 
> Any help is greatly appreciated
> 
> /Jon Wesström
> _______________________________________________
> Nuke-users mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
_______________________________________________
Nuke-users mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

Reply via email to