Nice one Ben.
Am 27.01.2016 7:02 vorm. schrieb Ben Dickson <[email protected]>: > > You can get knobs in order by using the nuke.Node.knob(n) and the number > of knobs via nuke.Node.numKnobs > > Meaning you can iterate over the knobs, start removing knobs when you > get to the target tab, and stop at the next Tab_Knob: > > > def remove_user_knobs(node): > in_user_tab = False > to_remove = [] > for n in range(node.numKnobs()): > cur_knob = node.knob(n) > is_tab = isinstance(cur_knob, nuke.Tab_Knob) > > # Track is-in-tab state > if is_tab and cur_knob.name() == "User": # Tab name to remove > in_user_tab = True > elif is_tab and in_user_tab: > in_user_tab = False > > # Collect up knobs to remove later > if in_user_tab: > to_remove.append(cur_knob) > > # Remove in reverse order so tab is empty before removing Tab_Knob > for k in reversed(to_remove): > node.removeKnob(k) > > # Select first tab > node.knob(0).setFlag(0) > > > remove_user_knobs(nuke.selectedNode()) > > On 23/01/16 04:32, Daniel Stein wrote: > > I think Igor's suggestion would be the easiest workaround to implement > > moving forward. If you haven't already stored that information another > > option is get the output of node.writeKnobs with the > > nuke.WRITE_USER_KNOB_DEFS flag and parse it to find the tab knobs and > > the knobs nested inside them. > > > > Super dirty and would only work for user knobs but it would do the trick. > > > > On 22 January 2016 at 10:53, Igor Majdandzic <[email protected] > > <mailto:[email protected]>> wrote: > > > > nope, thats what he meant. He has to kill all the knobs on the tab > > before he can remove the tab itself > > > > > > Am 22.01.2016 um 17:46 schrieb Fredrik Averpil: > >> Not in front of a machine at the moment but... > >> > >> Does this work? > >> nuke.removeKnob( myknob ) > >> > >> // Fredrik > >> > >> > >> On Fri, Jan 22, 2016 at 12:20 PM Igor Majdandzic > >> <[email protected] <mailto:[email protected]>> > >> wrote: > >> > >> Hey Abraham, > >> I dont know if there is a nice fast fancy way of doing this. > >> But you could store a directory in a hidden knob, key could be > >> the tab and knobs are the values. > >> Work around I know, but it should do the trick. > >> > >> Cheers > >> > >> Igor > >> > >> > >> Am 21.01.2016 um 12:59 schrieb Schneider, Abraham: > >>> Hi there! > >>> > >>> I have some user knobs in my root node, that I want to get > >>> rid of. It's a 'tab_knob' at the root level (let's call it > >>> 'testtab'), that contains several different knobs (strings, > >>> etc.). Now I want to delete all the knobs inside this tab > >>> knob and the tab knob itself. > >>> > >>> I can get to the tab knob via "myknob = > >>> nuke.Root().knob('testtab')" and I can remove knobs like > >>> this: "nuke.Root().removeKnob(myknob)". This should work, if > >>> the tab is empty. But because the tab contains other knobs, > >>> it won't be deleted, as the removeKnob doesn't delete knobs > >>> recursively. > >>> > >>> So how would I find all the knobs of nuke.Root() that belong > >>> to my tab knob, so that I can delete them first before > >>> deleting the tab knob itself? > >>> > >>> Or is there an even better way to remove the tab and all the > >>> related knobs quickly? > >>> > >>> Thanks, Abraham > >>> > >>> > >>> > >>> *Abraham Schneider* > >>> Head of VFX pipeline / VFX Supervisor > >>> > >>> > >>> > >>> ARRI Media GmbH > >>> Türkenstr. 89, 80799 München > >>> Phone +49 89 3809-1096 <tel:%2B49%2089%203809-1096> > >>> > >>> EMail [email protected] <mailto:[email protected]> > >>> www.arri.de/arrimedia <http://www.arri.de/arrimedia> > >>> > >>> <http://www.facebook.com/arrimedia> Click here > >>> <http://www.facebook.com/arrimedia> to visit us on Facebook! > >>> > >>> > >>> > >>> _______________________________________________ > >>> Nuke-python mailing list > >>> [email protected] > >>><mailto:[email protected]>,http://forums.thefoundry.co.uk/ > >>> > >>> > >>>http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > >> > >> _______________________________________________ > >> Nuke-python mailing list > >> [email protected] > >> <mailto:[email protected]>, > >> <http://forums.thefoundry.co.uk/>http://forums.thefoundry.co.uk/ > >> > >>http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > >> > >> > >> > >> _______________________________________________ > >> Nuke-python mailing list > >> [email protected] > >><mailto:[email protected]>,http://forums.thefoundry.co.uk/ > >> > >> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > > > > -- > > > > CHIMNEY > > > > *Igor Majdandzic* > > Compositing Supervisor > > > > __CHIMNEY Deutschland GmbH & Co. KG__ > > __Hanauer Landstraße 196__ > > 60314 Frankfurt am Main > > __Direct: +49 69 989 56 431 <tel:%2B49%2069%20989%2056%20431> -*NEW > > PHONE NUMBER*- __ > > __Fax: +49__ 69 904 36 68 29 > > __Mobile: +49 176 321 375 72 <tel:%2B49%20176%20321%20375%2072>__ > > __Berlin, Frankfurt/Main, Stockholm, Malmö, ____Warsaw, Copenhagen, > > Sydney, Singapore__ > > > > www.chimneygroup.com <http://www.chimneygroup.com/> > > > > > > __AG Charlottenburg HRA 44507 B; Pers. haft. Gesellschafter: Chimney > > Deutschland GmbH__ > > __AG Charlottenburg HRB 130013 B; Geschäftsführer: ____Ralf > > Drechsler, __Michal Kalinowski,Carl Henric Larsson > > > > > > _______________________________________________ > > Nuke-python mailing list > > [email protected] > > <mailto:[email protected]>, > > http://forums.thefoundry.co.uk/ > > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > > > > > > > > > > _______________________________________________ > > Nuke-python mailing list > > [email protected], http://forums.thefoundry.co.uk/ > > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > > > > -- > ben dickson > 2D TD | [email protected] > rising sun pictures | www.rsp.com.au > _______________________________________________ > Nuke-python mailing list > [email protected], http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________ Nuke-python mailing list [email protected], http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
