LumaPictures / usd-qt

Reusable Qt Components for Pixar's USD
Other
153 stars 41 forks source link

Ability to instantiate a model-less OutlinerTreeView #11

Closed csaez closed 5 years ago

csaez commented 6 years ago

Hi there,

Is there any chance to modify the default init arguments so we don't need to pass a model right away in order to instantiate a view? (i.e. removing it or making it an optional argument?)

https://github.com/LumaPictures/usd-qt/blob/35b01eaf71c5ebaf6262892ddc5584a5cae45184/pxr/usdQtEditors/outliner.py#L575-L580

We don't always create/destroy our widgets per stage as our artists usually prefer to use our tools docked into host applications (i.e. Maya or in-house applications, this means the same dialog stays opened during the whole session). At the moment we workaround this by creating new instances into a QTabWidget on demand, but it would be much nicer if we were able to instantiate an empty view to reuse and just set the desired model when required (seems a good fit for Qt's view-model paradigm).

I realize I could subclass and re-implement the init method by copying/pasting the bits that work for us, or even passing a placeholder, but I have the feeling that our use case is not that special and perhaps it is something the open source project can benefit from.

Is this something you would be interested on? How can we help?

nrusch commented 6 years ago

Just to make sure I don't assume too much, would this still be necessary if the outliner was a widget instead of a dialog? Or would you still be using the outliner's tree view directly regardless?

csaez commented 6 years ago

Hi Nathan, I would happily use the most convenient option available for embedded views, the less duplicated code on our side the better! Said that, I think keeping models and views as decoupled as possible is a good thing, for instance I would love to be able to swap models (1 per stage) on an existing view.

nrusch commented 5 years ago

Hey @csaez, this should be addressed by 128614d082e8da9b17c3e588252edbb4c3ff8cc7 (just pushed to dev).