Hi Ben, Thanks for helping out with this. Thorsten also posted his question in the NUKE Dev forum <http://community.thefoundry.co.uk/discussion/topic.aspx?f=191&t=121325> on our community pages; would you mind if I copied your response there, so that others who find the thread will be able to see the solution?
Regards, Lucy On Tue, Mar 29, 2016 at 2:07 PM, Ben Dickson <[email protected]> wrote: > Probably easier using the knob_changed on the XY position knob as Lucy > describes, but.. you could maybe do something with the > NDK/examples/Handle.cpp "Glue_knob": > > In your handle(...) method, check if a "pick" boolean-knob next to your > Axis-knob is enabled and, if so, sample the input to get the pixel value > from whatever channel you wish. Would function quite similarly, except for > the pretty colour-swatch icon, and some probably a lot of subtly like the > red box showing the selected area etc.. > > A quickly-shoved-together untested example: > > bool MyPlugin::handle(ViewerContext* ctx, int index) > { > switch (ctx->event()) { // DRAG/PUSH etc > case RELEASE: > if(ctx->state(SHIFT) && index == 0){ > Pixel p(Mask_RGB); > input0().sample( > /* x */ ctx->x(), > /* y */ ctx->y(), > /* w, h */ 1, 1, > /* pixel */ p); > knob("value")->set_value(p[Chan_Red], 0); > knob("value")->set_value(p[Chan_Green], 1); > knob("value")->set_value(p[Chan_Blue], 2); > } > break; > > default: > break; > } > > return true; > } > > > > On 29/03/16 22:04, Lucy Wilkes wrote: > >> Hi Thorsten, >> >> You can certainly do the sampling you describe, though you won't get a >> "pick" control with other knob types. See for example the ZDefocus >> node's "focal point" XY_Knob, which picks from the depth channel when >> the point is moved in the UI (or changed manually). Would this type of >> sampling be sufficient for what you require? Or did you specifically >> want a pick mode? >> >> Thanks, >> Lucy >> >> On Tue, Mar 29, 2016 at 12:21 PM, Thorsten Kaufmann >> <[email protected] >> <mailto:[email protected]>> wrote: >> >> Hey there,____ >> >> __ __ >> >> I want to give users the possibility to pick AOV values (namely Vec3 >> positions in this case). So the only way to allow for picking would >> be using a Color_Knob. Ideally i would prefer to store in an >> Axis_Knob or similar. But i want to be able to hit "pick" and have >> the user pick a value in the viewer.____ >> >> __ __ >> >> Is that possible using the current set of built-in knobs? And if not >> (that is if i have to resort to just using the Color_Knob) is there >> a way to force the picker to work on a specific ChannelSet? Ideally >> the user would look at RGB to see where he wants to pick and sample >> from the world position channels.____ >> >> Would that be possible?____ >> >> __ __ >> >> Cheers and thanks,____ >> >> Thorsten____ >> >> --- >> Thorsten Kaufmann >> Production Pipeline Architect >> >> Mackevision Medien Design GmbH >> Forststraße 7 >> 70174 Stuttgart >> >> T +49 711 93 30 48 661 <tel:%2B49%20711%2093%2030%2048%20661> >> F +49 711 93 30 48 90 <tel:%2B49%20711%2093%2030%2048%2090> >> M +49 151 19 55 55 02 <tel:%2B49%20151%2019%2055%2055%2002> >> >> [email protected] >> <mailto:[email protected]> >> www.mackevision.com <http://www.mackevision.com> >> >> Geschäftsführer: Armin Pohl, Joachim Lincke, Jens Pohl >> HRB 243735 Amtsgericht Stuttgart >> >> --- >> *VFX:* Game of Thrones, Season 5 – VFX making of reel >> <https://vimeo.com/133433110>. >> *TWITTER | ADOBE BEHANCE:* Follow us on Twitter >> <https://twitter.com/Mackevision> and Adobe Behance >> <https://www.behance.net/mackevision>. >> >> >> _______________________________________________ >> 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 >> >> >> >> >> -- >> Lucy Wilkes >> | >> | >> Senior Software Engineer >> The Foundry >> 5 Golden Square, London, W1F 9HT >> Tel: +44 (0)20 7479 4350 >> Web: www.thefoundry.co.uk <http://www.thefoundry.co.uk/> >> Email: [email protected] >> >> >> The Foundry Visionmongers Ltd. >> Registered in England and Wales No: 4642027 >> >> >> >> _______________________________________________ >> Nuke-dev mailing list >> [email protected], http://forums.thefoundry.co.uk/ >> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev >> >> > -- > ben dickson > 2D TD | [email protected] > rising sun pictures | www.rsp.com.au > _______________________________________________ > Nuke-dev mailing list > [email protected], http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev > -- Lucy Wilkes Senior Software Engineer The Foundry 5 Golden Square, London, W1F 9HT Tel: +44 (0)20 7479 4350 Web: www.thefoundry.co.uk Email: [email protected] The Foundry Visionmongers Ltd. Registered in England and Wales No: 4642027
_______________________________________________ Nuke-dev mailing list [email protected], http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev
