Is there any way to get tile_color to change based on something in _validate?
Nuke only seems to update the colour of the node in the graph if I do
Op::knob("tile_color")->set_value() from in knob_changed. It will, however,
change the colour of the swatch in the properties panel when called from
_validate.
I've tried setting up dummy knobs and calling set_value(), changed() and
updateWidgets() on them to force a knob_changed() evaluation but nothing seems
to work.
-----------------------
Anders Langlands
x8382/+447789206593
________________________________
From: Ivan Busquets [[email protected]]
Sent: 23 May 2012 17:05
To: Nuke plug-in development discussion
Subject: Re: [Nuke-dev] tile_color?
Hi Jordan,
My suggestion to do so within knob_changed() was under the assumption that you
wanted to change the node's color dynamically (based on the selection of
certain parameters).
Also keep in mind that knob_changed() works the same way as in Python; it will
be called for any knobChanged event, so it's up to you to filter the knob
you're interested in. Otherwise it will be called for any knob you change, or
every time you move the node in the DAG, etc.
If you want to set a predefined tile color for your node, but allow the user to
change it afterwards, I think this would be best handled as a knobDefault in
your menu.py
Ex:
nuke.knobDefault('Your_node_class.tile_color', '0x00ffff00')
On Mon, May 21, 2012 at 4:22 PM, Jordan Olson
<[email protected]<mailto:[email protected]>> wrote:
That seems to work!
By adding this method to my node's class:
int PointSample::knob_changed(Knob* k)
{
knob("tile_color")->set_value(0x00ff0000);
return 1;
}
the node is now green straight-away upon creation. The only downside
is the moment you touch any knob, it's going to pop right back to
green again! haha, a great prank to be sure, but probably not the
ideal solution.
I wonder though, would it be possible to implement it in the build function?
Currently it is:
static Iop* build(Node *node)
{
return (new NukeWrapper(new PointSample(node)));
}
But could we do something like this? This will break, because I'm not
sure how to correctly code it.
static Iop* build(Node *node)
{
new NukeWrapper b = (new PointSample(node));
b.knob("tile_color")->set_value(0x00ff0000);
return b;
}
On Mon, May 21, 2012 at 7:11 PM, Ivan Busquets
<[email protected]<mailto:[email protected]>> wrote:
> There's node_color() -- defined in Op.h --, but I think that one has been
> broken for some time.
>
> Depending on when you need your tile color to change, you should be able to
> change it like any other knob, with the exception that you'll need to call
> node_redraw() to force it to be redrawn with the new color in the DAG.
>
> knob("tile_color")->set_value(0x00ff0000); // green
> node_redraw();
>
> I'm not sure it's safe to do that anywhere other than within a
> knob_changed(), though. But you can give it a try.
>
>
>
> On Sun, May 20, 2012 at 10:39 PM, Jordan Olson
> <[email protected]<mailto:[email protected]>> wrote:
>>
>> hey guys!
>> Despite searching the docs (even with an external Google) I can't
>> figure out how to set a node's tile_color in the nodegraph- it's easy
>> as with python, but how would you do this on a compiled node? I don't
>> even know what class to look at, Iop doesn't seem to have it.
>> cheers,
>> Jordan
>> _______________________________________________
>> Nuke-dev mailing list
>> [email protected]<mailto:[email protected]>,
>> http://forums.thefoundry.co.uk/
>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev
>
>
>
> _______________________________________________
> Nuke-dev mailing list
> [email protected]<mailto:[email protected]>,
> http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev
>
_______________________________________________
Nuke-dev mailing list
[email protected]<mailto:[email protected]>,
http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev
_______________________________________________
Nuke-dev mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev