Hey Ivan,
knob_changed() may come in handy, I'll remember that!
I suppose with no alternatives, I could have it change the colour
once, then not again, (so presumably when the node is created and not
when knobs are changed afterwards).
You're right that setting a python default would be ideal- but at this
point I'm not sure how these plugins will be deployed and so it may be
preferable to set the inherent start colour within the code itself.

Scott, I tried the attach() method- and it didn't seem to do anything,
though I should spend more time exploring it.

thanks heaps for the help guys!
-Jordan

On Thu, May 24, 2012 at 4:05 AM, Ivan Busquets <[email protected]> wrote:
> 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]> 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]>
>> 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]>
>> > 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], 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
>> >
>> _______________________________________________
>> Nuke-dev mailing list
>> [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
>
_______________________________________________
Nuke-dev mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev

Reply via email to