Ivan, This is just my test code from couple of days ago, as a proof of concept. I did a lot of stuff in my final script to apply selection filters, select all or none, and I eliminated the ModalDialog and hooked it up so that selecting views in the panel immediately sets the views to render in the Write node… In any case, this illustrates the concept.
Thanks immensely for pointing me in the direction of the SceneView_Knob. That did the trick! ----------------------------------------------------------------------------------------------------------------------------------------- import nuke, nukescripts class TestPanel( nukescripts.PythonPanel ): def __init__( self ): nukescripts.PythonPanel.__init__( self, 'TestPanel') #### Get the current Viewer object... self.active_viewer = nuke.activeViewer() #### Get the list of all possible views... self.all_views = nuke.views() #### Get the 'views' knob onject in the Write node... n = nuke.selectedNode() self.view_knob = n.knob("views") #### Define and add a new SceneView_Knob knob to the panel... self.view_selector_knob = nuke.SceneView_Knob('pick_a_view', 'Choose Views :', nuke.views()) self.addKnob(self.view_selector_knob) #### Get the current value (the selected views) from the Write node's view knob... self.SelectedViews_from_ViewKnob = self.view_knob.value() #### Get the items that are selected in the SceneView_Knob (after it has been created - see modified showModalDialog() method below)... self.SelectedViews_from_ViewSelectorKnob = ' '.join(self.view_selector_knob.getSelectedItems()) def knobChanged(self, knob): if nuke.thisKnob().name() == 'pick_a_view': self.SelectedViews_from_ViewSelectorKnob = ' '.join(self.view_selector_knob.getSelectedItems()) #### self.view_knob.setValue(self.SelectedViews_from_ViewSelectorKnob) def show(self): #### Update the selected items in the SceneView_Knob, from the Write node's views knob, before the SceneView_Knob gets displayed... self.view_selector_knob.setSelectedItems(self.SelectedViews_from_ViewKnob.split()) #### Override the showModalDialog() method via super()... super(TestPanel, self).showModalDialog() def start_TestPanel(): t = TestPanel() t.showModalDialog() ---------------------- #### To run... start_TestPanel() ----------------------------------------------------------------------------------------------------------------------------------------- Rich On Apr 30, 2013, at 9:58 AM, Richard Bobo <richb...@mac.com> wrote: > Interesting... Thanks, Ivan, I'm looking into it now! > > Rich > > > On Apr 29, 2013, at 10:04 PM, Ivan Busquets <ivanbusqu...@gmail.com> wrote: > >> If you're in Nuke 7, you could use the new SceneView knob (used for Alembic >> in ReadGeo). >> It has specialized methods to dynamically set items in the tree view, as >> well as getting the selected values. >> >> Ex: >> >> class TestPanel( nukescripts.PythonPanel): >> def __init__( self ): >> nukescripts.PythonPanel.__init__( self, 'TestPanel') >> self.sceneKnob = nuke.SceneView_Knob('selectViews', 'select views', >> nuke.views()) >> self.addKnob(self.sceneKnob) >> >> >> t = TestPanel() >> if t.showModalDialog(): >> print t.sceneKnob.getSelectedItems() >> >> >> >> On Mon, Apr 29, 2013 at 3:46 PM, Frank Rueter <fr...@beingfrank.info> wrote: >> There is nuke.CascadingEnumeration_Knob which gives you a an enumeration >> list with checkboxes, but I'm not sure how to make it accept multiple >> selection. Probably some kind of flag that needs to be set. >> >> >> On 30/04/13 00:34, Richard Bobo wrote: >>> Howard, >>> >>> Yes, I'm doing something similar with the view names. I filter a list in >>> various ways and populate a pull down, which can be used to further filter >>> the list, etc. The piece I'm missing is the multi-selection pulldown at the >>> end. I would love to see how you've done it! I'm using Python_Panel and I >>> just can't figure out how to make the multi-selection pulldown from the >>> list of built-in knob types... >>> >>> Thanks! >>> Rich >>> >>> Sent from my iPod >>> >>> On Apr 29, 2013, at 5:37 AM, Howard Jones <mrhowardjo...@yahoo.com> wrote: >>> >>>> How are you intending to filter? >>>> >>>> I built a script a while ago that gives you a drop down, this then is used >>>> to filter the next stage which is a list of episodes with check boxes, >>>> with multi selection allowed, >>>> this then creates a panel populated with the shots found from the selected >>>> episodes. This way I could select a project/episode/and shots and add data >>>> to the shots (such as approved etc). >>>> >>>> Would something like that be suitable >>>> >>>> All done with the simple panel >>>> >>>> Howard >>>> >>>> From: Richard Bobo <richb...@mac.com> >>>> To: Nuke-Users Mailing List Postings List Postings >>>> <nuke-us...@support.thefoundry.co.uk> >>>> Cc: Nuke Python discussion <nuke-python@support.thefoundry.co.uk> >>>> Sent: Monday, 29 April 2013, 5:36 >>>> Subject: [Nuke-python] Pulldown_Knob with multiple checkboxes…? >>>> >>>> Hi all, >>>> >>>> I am hoping someone might have a solution for this… (cross-posting again) >>>> >>>> I'm trying to create a pulldown menu that has the ability to check >>>> multiple boxes. Basically, I am trying to put the functionality of the >>>> special nuke.MultiView_Knob into a regular pulldown menu… Why, you ask? >>>> Because I want to *filter the list of views*, since right now it bleeds >>>> off my second monitor and into thin air… >>>> >>>> I can create a new MultiView_Knob in my own Python_Panel, but since it's a >>>> private menu type, I can't do anything with the list of views it holds. >>>> I've tried and it always gives me, essentially, nuke.views()... >>>> >>>> The Enumeration_Knob only allows one selected item at a time - same with >>>> the Pulldown_Knob. So, short of building my own panel with PySide or PyQt >>>> - which I have not gotten into, yet - is there any type of pulldown that >>>> would allow each item to have its own on/off checkbox - a multi-checkbox >>>> pulldown menu, if you will? >>>> >>>> I hope that's somewhat clear what I'm looking for! (8^\ >>>> >>>> Thanks for any help, >>>> >>>> Rich >>>> >>>> >>>> >>>> Rich Bobo >>>> Senior VFX Compositor >>>> Armstrong-White >>>> http://armstrong-white.com/ >>>> >>>> Email: richb...@mac.com >>>> Mobile: (248) 840-2665 >>>> Web: http://richbobo.com/ >>>> >>>> "The most beautiful thing we can experience is the mysterious. It is the >>>> source of all true art and science." >>>> - Albert Einstein (1879 - 1955) >>>> >>>> >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> Nuke-python mailing list >>>> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ >>>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python >>>> >>>> >>>> _______________________________________________ >>>> Nuke-python mailing list >>>> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ >>>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python >>> >>> >>> _______________________________________________ >>> Nuke-python mailing list >>> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ >>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python >> >> >> _______________________________________________ >> Nuke-python mailing list >> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ >> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python >> >> >> _______________________________________________ >> Nuke-python mailing list >> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ >> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > > _______________________________________________ > Nuke-python mailing list > Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________ Nuke-python mailing list Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python