Page MenuHome

View3D: Frame All if Frame Selected is called with no selection
AbandonedPublic

Authored by Paul Greveson (moppius) on Dec 11 2019, 1:17 AM.

Details

Reviewers
None
Group Reviewers
User Interface
EEVEE & Viewport
Summary

Currently, if the Frame Selected operator is called (bpy.ops.view3d.view_selected) with no selection, the result is that nothing changes.

However, it is more contextually-friendly to have Frame Selected zoom out to the equivalent of Frame All when there is nothing selected - this means users can have a single keyboard shortcut that works contextually, and still have the option to frame everything without losing their selection, using the existing Frame All operator.

It seems like it would be a rare case where someone pressed the keyboard shortcut for Frame Selected and expect it to do nothing. False positives seem like a much smaller issue here than having a hotkey that does nothing when it could logically be doing something! :)

In this change, I have extracted the logic for finding the min/max bounds of all the visible objects in the scene into a helper function minmax_all_objects, that is now called from both the view3d_all_exec, and also now for the fallback case of viewselected_exec, so instead of finishing and returning without doing anything, it finds the visible bounds and continues to frame them.

Diff Detail

Repository
rB Blender

Event Timeline

Paul Greveson (moppius) edited the summary of this revision. (Show Details)Dec 11 2019, 1:19 AM
Paul Greveson (moppius) retitled this revision from Frame All if Frame Selected is called with no selection to View3D: Frame All if Frame Selected is called with no selection.
Campbell Barton (campbellbarton) abandoned this revision.EditedDec 11 2019, 9:34 AM

Prefer not to introduce the convention of operating on everything when nothing is selected as users may then expect it to be applied more generally.

It means actions may not be predictable, some tools require selection, some don't & fallback to all objects. Exact behavior isn't obvious regarding selection locking.

We changed select-all not to toggle for this reason, so select all/none is always predictable.

Closing since this is more a design task than a patch.

Prefer not to introduce the convention of operating on everything when nothing is selected as users may then expect it to be applied more generally.
It means actions may not be predictable, some tools require selection, some don't & fallback to all objects. Exact behavior isn't obvious regarding selection locking.
We changed select-all not to toggle for this reason, so select all/none is always predictable.
Closing since this is more a design task than a patch.

Apologies if this is not the right flow, it's my first time contributing to Blender, I tried to follow the guides but I feel like I might have done this backwards!

I mainly wanted to add this since it's been a standard feature of Maya for a long time. Artists find it's more useful to work this way since they can have just a single keybind for doing everything, instead of multiple keybinds that aren't actually useful in most cases.

I understand that Blender wants actions to be predictable, but should that come at the cost of a more contextually-powerful user experience?
Maybe instead we could add a Preference to enable this behaviour, as it is industry-standard from other software, and having to write a Python addon to create this feels worse than having it as an option natively.

I'd be interested in pursuing this discussion more, should I create a Task for this so it can be discussed and triaged before I try making code changes?

No, you have gone about this the right way, regarding submission.

It's just that it's an opinionated change we could have made already fairly easily.

This is also timing, we have around 2000 open bugs, submitting changes that aren't on our roadmap which we have to ensure fit well with everything else (even as a preference), adds some overhead.

I've notified @William Reynish (billreynish) about this, if he wants to open a design task for this.

If you're interested to help, check on approved tasks on our module page: T63726: User Interface Module

T70803: Support Viewport roll - around the cursor position is a good entry level task, check on T67071: Rotate drawing canvas (viewport) although this looks like design may not be nailed down.

3dsmax work like the maya and if no visible object in viewport, view is reseted to center..

maybe a new operator (view_frame) with 3 possibilites... view_selected if some object selected.... view_all if nothing selected.... reset view to center or cursor if none object visible.

maybe a new operator (view_frame) with 3 possibilites... view_selected if some object selected.... view_all if nothing selected.... reset view to center or cursor if none object visible.

That's not a bad idea. Then the operators would still behave correctly, and the current View -> Frame Selected menu item could point to the new view_frame operator.

Also, just for reference, I posted this same issue for discussion / upvoting on rightclickselect too.