Thanks for all your thoughts! The good thing about using the last knob of the node that is that all knobs that the user creates should be caught. As they would be id wise after that. What would be cool is either to have a #define in the api that tells me the number of knobs in the node tab ( so i can add that to my knobs and get to the user knobs securely ) or maybe even better introduce a "closing knob" for the node tab that is invisible. So you guys can add whatever knobs to the node tab and we check against this ivisible knob? Of course the best would be a flag on the node that tells me if the knob is user generated or plugin generated... either one would work ... my prerference would be.... 1 Flag ... 2 Invisible closing knob .... 3 #define for the number of knobs in the node tab.... maybe there is something smarter to be done already using the Knob_Callback in knobs() ? u see getLastMadeKnob() and getKnobCount() maybe that could be used / extended? Thanks! Jo
On Thu, Jan 22, 2015 at 3:22 AM, Lucy Wilkes <[email protected]> wrote: > Although your current solution doesn't use it, I just wanted to point out > another potential issue with looking for the "user" tab, in case it's > useful for the future... > > As well as the "Manage user knobs" interface, users can add new knobs via > python, and in this case they can create their own tabs to add them into, > none of which need be named "User". For instance, try this in Nuke's script > editor: > > b = nuke.createNode("Blur") > > tab1 = nuke.Tab_Knob("MyTab1") > > b.addKnob(tab1) > > k1 = nuke.Int_Knob("Param1") > > b.addKnob(k1) > > tab2 = nuke.Tab_Knob("MyTab2") > > b.addKnob(tab2) > > k2 = nuke.Double_Knob("Param2") > > b.addKnob(k2) > > > You can actually do the same thing via "manage user knobs", by adding a > Tab knob, giving it a name and then adding another knob... It will appear > on the tab you just made. Not sure how common this is in practice, just > thought it might be worth being aware of! > > > Lucy > > > -- > 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 > > > On Thu, Jan 22, 2015 at 9:25 AM, Frank Harrison <[email protected]> > wrote: > >> The lifetime knob is a new thing, as you mention, and it can also be >> renamed. Using the User tab may be better and more >> back-compatible; although it can be renamed it probably won't, but I do >> know of studios which do. >> >> I think the reason there isn't an API for this is, because of time >> constraints, no-one had time to ensure such an api would be robust in an >> add/remove/shuffle-whilst-iterating scenario. I did look at doing this a >> couple of years ago but there were a couple of other tricky (e.g. not >> solvable between builds) edge cases to address. >> >> Your solution is what I think ended up doing myself, in Python. >> >> F. >> >> On Wednesday, January 21, 2015, Johannes Saam <[email protected]> >> wrote: >> >>> for the record here is a way to get a list of all user knobs.... the if >>> statement starting the recording of knobs is stable for now but could >>> change in the future so watch out >>> >>> std::vector<DD::Image::Knob*> MyOp::getUserKnobs() const >>> { >>> // the output buffer >>> std::vector<DD::Image::Knob*> userKnobs; >>> >>> // flag if we start recording knobs yet as 'user' knobs >>> bool userStarted = false; >>> >>> // run over all knobs by index >>> for( int i = 0;; i++ ) >>> { >>> // candidate knob >>> DD::Image::Knob * k = DD::Image::Op::knob(i); >>> >>> // valid knob on i >>> if ( k ) >>> { >>> // do not record tab knobs at all >>> if ( strcmp( k->Class(), "Tab_Knob" ) == 0 ) >>> continue; >>> >>> // if we have identified the last knob >>> // in the node tab we start recording >>> // using the User label on a tab is not >>> // safe as the user knobs tab can be renamed >>> if ( userStarted ) >>> { >>> // add a this knob to the result list >>> userKnobs.push_back( k ); >>> } >>> else >>> { >>> // not recording yet, lets see if we reached the last >>> knob >>> // this might change with nuke changing works for nuke9v1 >>> if ( strcmp( k->Class(), "Boolean_Knob" ) == 0 && >>> k->name() == "useLifetime" ) >>> { >>> // from here onwards we record all knobs >>> userStarted = true; >>> } >>> } >>> } >>> else >>> { >>> break; >>> } >>> } // done iterating knobs >>> >>> return userKnobs; >>> } >>> >>> On Tue, Jan 20, 2015 at 3:45 PM, Johannes Saam <[email protected]> >>> wrote: >>> >>>> Damn thats sucking. What would you suggest then how to access all the >>>> user created knobs? Iterate though all of the knobs and cross the ones i >>>> know i added off the list?! Of course i create knobs via the API >>>> dynamically so tracking all this is quite a pain. >>>> >>>> I vote for a getUserKnobs function on DD::Image::Op . Anyone? >>>> >>>> Thanks >>>> jo >>>> >>>> On Tue, Jan 20, 2015 at 11:17 AM, Nathan Rusch < >>>> [email protected]> wrote: >>>> >>>>> If you're planning to look the tab up by name, it's worth keeping >>>>> in mind that the "User" tab can be renamed. >>>>> >>>>> -Nathan >>>>> >>>>> >>>>> *From:* Johannes Saam >>>>> *Sent:* Tuesday, January 20, 2015 10:25 AM >>>>> *To:* Nuke plug-in development discussion >>>>> *Subject:* Re: [Nuke-dev] Acessing user knobs >>>>> >>>>> Ok i will have another look. I had no idea i could get an ID for the >>>>> user tab... the NDK docs will help for sure. It would be awesome to have a >>>>> function on Op like std::vector<Knob*> & getUserKnobs(). >>>>> >>>>> again should i be able to get it done i might share it here so we have >>>>> it written down. >>>>> >>>>> Also the user knobs that nuke provides with the ( might need a >>>>> rework?? ) interface are not at all what nuke offers in terms of knobbage. >>>>> Is there a way to hack more into it? As in is it a python script we can >>>>> access and enlarge? I am on the fence now to write a c++ version so i can >>>>> have more Knobs and then just store them under the user tab myself.... i >>>>> keep yous posted. >>>>> >>>>> Thanks! >>>>> JO >>>>> >>>>> On Tue, Jan 20, 2015 at 12:42 AM, Frank Harrison < >>>>> [email protected]> wrote: >>>>> >>>>>> Hey, >>>>>> >>>>>> yes, that is a way. User-Knobs should always be on the "user" tab. >>>>>> >>>>>> This has come up before and I think we said that we'd add some >>>>>> pythonic getter for UserKnobs if we got a few more requests for it. >>>>>> >>>>>> I think, but don't quote me on this, that you can get the tab-idx and >>>>>> iterate from there. Perhaps there's something on Nukepedia >>>>>> <http://www.nukepedia.com/> to do this for you? >>>>>> >>>>>> F. >>>>>> >>>>>> On 20 January 2015 at 02:15, Johannes Saam <[email protected]> >>>>>> wrote: >>>>>> >>>>>>> Hey Gang, >>>>>>> >>>>>>> is there an easy way to access knobs that have been created by the >>>>>>> user with "manage user knobs" >>>>>>> i know they are all in the "user" tab is that a way? I was hoping i >>>>>>> could get all the user generated knobs and then act on them. >>>>>>> Thanks! >>>>>>> JO >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Nuke-dev mailing list >>>>>>> [email protected], http://forums.thefoundry.co.uk/ >>>>>>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Frank Harrison >>>>>> Senior Nuke Software Engineer >>>>>> The Foundry >>>>>> Tel: +44 (0)20 7968 6828 - Fax: +44 (0)20 7930 8906 >>>>>> Web: www.thefoundry.co.uk >>>>>> Email: [email protected] >>>>>> >>>>>> _______________________________________________ >>>>>> 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 >>>>> >>>>> >>>> >>> >> >> -- >> Frank Harrison >> Senior Nuke Software Engineer >> The Foundry >> Tel: +44 (0)20 7968 6828 - Fax: +44 (0)20 7930 8906 >> Web: www.thefoundry.co.uk >> Email: [email protected] >> >> >> _______________________________________________ >> 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
