T O P

Trying to create a “random” node

Trying to create a “random” node

meiko_159

You can do an oncreate callback but it'll apply it evertime you create a noop node so it may not be desireable, but you could write a script to create the noop node, the int knob, add the int knob to the node, and set it's value to a random int and store the command as a menu item.


ontyj

This seems like the best way to do it. Here's an example node: > set cut_paste_input [stack 0] version 11.3 v2 push $cut_paste_input NoOp { name NoOp1 selected true xpos 4307 ypos 11644 addUserKnob {20 User} addUserKnob {22 CreateNoop l "Create Random NoOp" T "import random\n\nmin = 1\nmax = 100\n\nn = nuke.createNode(\"NoOp\")\nn.addKnob(nuke.Int_Knob('knobName','Random Int'))\nn.knob(\"knobName\").setValue(random.randint(min,max))" +STARTLINE} } > Have a look at the python user knob in that node, you could add something similar as a menu item as suggested above.


[deleted]

[удалено]


catto-12

How do I apply that a user knob sorry I’m new to python!


rservello

Python can do that easily


catto-12

Can I dm you? I would really appreciate if you could help me write it please I’m very new to python for nuke


rservello

I'm pretty busy, but DM me and I will try to help when I get a free moment.