david-cattermole / mayaMatchMoveSolver

A Bundle Adjustment solver for MatchMove related tasks.
https://david-cattermole.github.io/mayaMatchMoveSolver/
Other
101 stars 29 forks source link

Making BaseWindow class "dockable" #211

Closed ktonegawa closed 3 years ago

ktonegawa commented 3 years ago

This is some what related to https://github.com/david-cattermole/mayaMatchMoveSolver/issues/197, but not really. Just changing the base class of BaseWindow so that it at least allows for docking. Also made the Solver UI dockable as a default (this can change as maybe a user preference could be implemented).

david-cattermole commented 3 years ago

This is simple and cool! You've made the right decision to make this new feature off by default.

It's probably ready to merge now.

I wondered what the other arguments to "setDockableParameters" were, just for clarity, here they are (from the docs):

    :Parameters:
        dockable (bool)
            Specify if the window is dockable (default=False)
        floating (bool)
            Should the window be floating or docked (default=True)
        area (string)
            Default area to dock into (default='left')
            Options: 'top', 'left', 'right', 'bottom'
        allowedArea (string)
            Allowed dock areas (default='all')
            Options: 'top', 'left', 'right', 'bottom', 'all'
        width (int)
            Width of the window
        height (int)
            Height of the window
        x (int)
            left edge of the window
        y (int)
            top edge of the window

I'm not sure if any of the other arguments need to be exposed, I don't think they do.

@ktonegawa how would you like to continue with this? Shall I merge this and then add a user preference?

I think the next steps are to add buttons to the Solver Window UI so it can be set as "horizontal" or "vertical". We can do that in a new issue, and I think I'd be better to tackle that stuff because the Solver UI is way-over-complicated - it's my mess and I think I should deal with my own mess.

ktonegawa commented 3 years ago

Haha thank you! And yes I was aware of the other parameters of setDockableParameters but I just left all of that to default for now just making everything ready for that.

For the next steps I still feel the need to be able to "adjust" the layout via presets or some kind of interactive change by the user like the mockup you described in https://github.com/david-cattermole/mayaMatchMoveSolver/issues/197#issuecomment-757546329

I was playing around with that change you pushed with the "minimal view" and realized that only works WHILE solving, I am sure that adresses what @bpatchasaheb was describing but I just feel it might be nice to have a constant view that is always minimal when you know you don't really need to mess with the input/output bundles or other nodes but that is just me.

david-cattermole commented 3 years ago

For the next steps I still feel the need to be able to "adjust" the layout via presets or some kind of interactive change by the user like the mockup you described in #197 (comment)

I think it might be fairly easy to implement a preset to adjust the layouts using presets.

We can swap out the underlying UI layouts in mmSolver.tools.solver.ui.solver_layout and change the widget parents around. So we'd have a few copies of solver_layout.ui, each one would be a different "preset".

Then we'd need to add buttons to the UI (that will always be visible in any preset) that can be used to change the preset.

Do you want me to move ahead with that as a separate issue, or do you want to do it as part of #197?

I was playing around with that change you pushed with the "minimal view" and realized that only works WHILE solving, I am sure that adresses what @bpatchasaheb was describing but I just feel it might be nice to have a constant view that is always minimal when you know you don't really need to mess with the input/output bundles or other nodes but that is just me.

You should be able to manually set the "minimal" UI using the method mmSolver.tools.solver.ui.solver_window.SolverWindow.setMinimalUI(True) (after you get an instance of the SolverWindow class), if you want to test it out. It's a pretty ugly hack, but it works. The tricky part with #195 was getting the UI to update while the Solver initialises, that's why there are so many "QtWidgets.QApplication.processEvents()" calls.

ktonegawa commented 3 years ago

Hmmm I was more thinking of foldable/resizeable widgets/layouts or something like how you illustrated where a user can potentially drag and move around a widget or something (probably not worth implementing but a cool idea).

As a way to keep learning, I preferably would like to take this all the way through the end, but since I only put so much time into this per week it probably will take some time (plus I want to prioritize that 2d Center Offset issue). If you feel that you can deliver this quicker then you taking care of the rest would be best.

But I think this PR itself is good to merge since all I did was just change the main Solver UI to be dockable, not much more to expand on that.

david-cattermole commented 3 years ago

I've finally gotten around to actually merging this.

Thanks @ktonegawa!