Nuke Panel Scripting: Dynamic pullDown Knob

Nuke Panel: Dynamic pullDown Knob????

Hey Guys, got a SERIOUS problem:confused: I’ve asked this in another Thread but guess no-one’s noticing…
While creating dynamic drop-down menu in nuke, I am creating a panel this way: :niceone:

Code:

def panel_example():
  sequenceList = ['A B C']
  splitShotA = ['A A A']
  splitShotB = ['B B B']
  splitShotC = ['C C C']
  p = nuke.Panel("Browser Panel")
  p.addEnumerationPulldown("Select Sequence:", ''.join(sequenceList))
  p.addEnumerationPulldown("Select Shot:", ' '.join(splitShotA))
  p.addMultilineTextInput("Add Notes:", multilineTextInput)
  p.addBooleanCheckBox("Save Local:", booleanCheckBox)
 
  p.addButton("Cancel")
  p.addButton("Create")

  result = p.show()

  enumVal = p.value("Select Sequence:")
  if enumVal is not None:
    print "Select Sequence: ", enumVal

  boolVal = p.value("Save Local:")
  if boolVal is not None:
    print "Save Local:", boolVal

panel_example()


Here, am calling a list in Pull Down "Select Sequence"
What I want to do now is when user selects B in "Sequence List", "Shot List" should be recreated and be populated with splitShotB list….

Any help ‘d be greately appreciated…:radar: OR i’ll pull my hairs off!!! :scorching::splat:

scriptSave() versus scriptSaveAs() error ?!

Hi guys,

I’m pretty new to Nuke and I hit a roadblock with a script that I am writing. Basically what the script does is pop up a panel with a multiline text input and 2 buttons, one to save and one to save as.

In the example below, if you click on Save it will print the text entered in the text box but when pressing Save As it won’t…

Code:

multilineTextInput = ''

p = nuke.Panel("test")
p.addMultilineTextInput("add text:", multilineTextInput)
p.addButton("          Save As          ")
p.addButton("          Save          ")

result = p.show()

if result == 0:
    multilineTextVal= p.value("add text:")
    print multilineTextVal
    nuke.scriptSaveAs(filename=None, overwrite=1)

elif result == 1:
    multilineTextVal= p.value("add text:")
    print multilineTextVal
    nuke.scriptSave()


Any help is really appreciated as this drove me nuts for few good hours!!!

Thanks,
Anton

Autoload script

Hi,

Is there a way of automatically loading a python script whenever a nuke script is loaded?

I would like to set up a path mapping system for our mixed operating system renderfarm.

Many thanks in advance,
Andreas

merge setInput in python

Hi everyone,

I’m having an issue trying to figure out how to connect the mask input on a merge node to connect to a rotopaint node in python.

I want the A input of the merge attached to a read node. B input connected to nothing. Mask connected to roto.

Right now I have this:

#create merge
mergeroto = nuke.createNode(‘Merge’, inpanel=False)

#create roto
roto1 = nuke.createNode(‘RotoPaint’, inpanel=False)

#input roto as a mask into merge
mergeroto.setInput(0, roto1)

With this, the bg input of the roto gets connected to the merge. It seems like the input wants another index number. Is there a way to set empy inputs? So the bg gets connected to nothing?
I’ve have been searching around here, tutorials and the Python documentation to try and find the answer to this. I know the answer is close.

Thanks so much,
Jackie

Write node file knob gives error

I’m trying to learn some basics in Python, and it’s slowly moving ahead by searching this forum. But now I’ve run into a problem. I’m trying to create a write node and set the file knob to the correct path, but it gives me an error. This is the code:

Code:

def autoWrite():

path = "[python {'/'.join(nuke.root()['name'].value().split('/')[0:-3])}]/renders/nuke/[string trim [file tail [value root.name]] .nk]/[string trim [file tail [value root.name]] .nk]_####.exr"
nuke.createNode("Write").knob('file').setValue(path)


If I run this code I get an error saying "IndentationError: expected an indented block". Although, if I remove the "def autoWrite" in the beginning the code works. Problem is that I need to def autoWrite for it to work with my menu.py file.

The path takes the current position of the nuke script and automatically creates render locations for the script.

set value question

How can I return and set the value of a checkbox please? I can easily find lots of examples on other values, read paths etc but not this one.. I’ve tried:

import nuke

def checkIfPremultOn():
nodes = nuke.allNodes()

for node in nodes:
if node.Class() == "Read":
node.premultipled(1)
node.knob(‘premultipled’).setValue( ‘true’ )
node.knob(‘premultipled’).setValue(1)
node[‘premultipled’].setValue("true")

One can probably tell I’m fresh to this game.. thanks!

RotoPaint script in c++

hi
I need advice to get the number of points RotoPaint in c++
thank you 🙂

Two steps back in folder structure?

I’m putting together a write node template for our studio, and like the Auto Write script at Nukepedia, I add expressions together to create a path. I would like to take the location of the Nuke script file (value root.name), and go two steps back into the folder structure using expressions. For example, if [value.root.name] would give me "show01/shot01/nuke/shot01.nk", I would like it go give me only "show01/shot01". A way to tell the expression to look in the file path for a folder called "nuke" and then deliver the path "before that"? In Javascripting I would play around with lastIndexOf to get to the location. Anyone know of a way?

Import script and replace all I/O paths – script help

Hi, I’m trying to figure out how to create a button that does this:

Opens up a window asking what shot number you are working on.

Once that’s done, import a script from path X or even if it’s a nuke script inside the python script that just gets created, doesn’t matter.

Replaces all write node paths according to what shot number you mentioned earlier, so if the script by default loads in X:\projectA\shot01\projectA_shot01.%04d.tga it should replace all those shot01’s with whatever you put into the window.

And that’s it. If anyone has tips or can put me in the right direction it’d be great. Thanks!

Optical Flares plugins?

Is there any plugin such as this>
http://www.videocopilot.net/products/opticalflares/
for NUKE
Thanks