Page MenuHome

Object: Switch Object operator
Needs ReviewPublic

Authored by Pablo Dobarro (pablodp606) on Apr 24 2020, 1:17 AM.
Tokens
"Love" token, awarded by Shimoon."Love" token, awarded by shablin_m."Love" token, awarded by Brandon777."Burninate" token, awarded by rpserge."Love" token, awarded by monio."Burninate" token, awarded by slowburn."Love" token, awarded by CobraA."Love" token, awarded by creamsurfer."Burninate" token, awarded by DiogoX2."Love" token, awarded by Tetone."Love" token, awarded by koloved."Love" token, awarded by juantxo."Love" token, awarded by kouza."Like" token, awarded by knightknight."Love" token, awarded by ReinhardK."Love" token, awarded by johnsyed."Burninate" token, awarded by andruxa696."Love" token, awarded by dilip."Love" token, awarded by Zino."Love" token, awarded by julperado."Love" token, awarded by xorrito."Love" token, awarded by Dangry."100" token, awarded by Frozen_Death_Knight.

Details

Reviewers
Jeroen Bakker (jbakker)
Group Reviewers
User Interface
Summary

This object operator exits and frees the edit data of the
current object and enters the same mode in another one in a single step,
without going through object mode or keeping multiple edit object data
active. There is still not keymap assigned.

This solves all conflicts that the right/click select keymap and the
emulate 3 button mouse produces for this operation and it is independent
of the state of Lock object modes.
Also, as the SculptSession is freed, when using Multires objects go
back to their preview resolution level, so it is possible to work on
high vertex count scenes without slowing down the viewport and other
performance problems.

In this example, I'm sculpting on a 96M vertices scene (1,5M vertices on
Multires per object) with an acceptable performance both in sculpting
and in switching between objects by using this operator.
For now it is compatible with Sculpt and Edit mode. More modes can be
added later once the final keymap is decided

Diff Detail

Repository
rB Blender
Branch
arcpatch-D7510 (branched from master)
Build Status
Buildable 8435
Build 8435: arc lint + arc unit

Event Timeline

Pablo Dobarro (pablodp606) requested review of this revision.Apr 24 2020, 1:17 AM
Pablo Dobarro (pablodp606) created this revision.

Faster, easier and better switching between objects during mode-sessions is really good to improve. But, I would prefer if this was done more holistically in a way that can work for switching objects while in Edit mode, or Armatures in Pose mode and so on. This convention of pressing the S-key in Sculpt mode doesn't seem like it would work in other contexts.

One idea would be to make use of the Outliner, so you could click on another object's data and then Blender would switch to that object, while still in the same mode.

Another idea, which could work alongside the Outliner, would be to use a consistent modifier key while simply left clicking in the viewport on an object, which could switch to editing that object.

IMO this needs a design that can work for Blender as a whole, not just Sculpt mode.

Could this automation be added to the Transform tools in Sculpt Mode as well? Currently it is possible to switch to different meshes by using the Transform tools inside Sculpt Mode when clicking on a mesh. I think this quality of life change could benefit them as well since they perform a similar operation as this new shortcut.

Faster, easier and better switching between objects during mode-sessions is really good to improve. But, I would prefer if this was done more holistically in a way that can work for switching objects while in Edit mode, or Armatures in Pose mode and so on. This convention of pressing the S-key in Sculpt mode doesn't seem like it would work in other contexts.

These are just opinions, but I would have to disagree. There's not a significant workflow bottleneck in performing this action in other modes like there is in sculpt mode. It's simply not done as frequently, and when it is, it's just not a pain point. If this was to be integrated in other modes, I'd actually want it as it is in sculpt mode right now - hover my mouse over something and press a hotkey to be in edit mode.

One idea would be to make use of the Outliner, so you could click on another object's data and then Blender would switch to that object, while still in the same mode.

This to me defeats the purpose, and will actually take longer than it currently does to perform this action. Virtually no one sculpts by picking objects from a list, and reading object names in a list that could be hundreds of lines long to try to pick something to sculpt on vs. just hovering over the object and firing a hotkey adds an unnecessary layer of obfuscation to something that should be straightforward and simple.

Another idea, which could work alongside the Outliner, would be to use a consistent modifier key while simply left clicking in the viewport on an object, which could switch to editing that object.

This will get in the way of how a large portion of the userbase moves/pans/rotates the viewport. The singular hotkey and mouse hover is the most straightforward and elegant solution. There isn't anything about the goal of this tool that should need to be used in the Outliner.

IMO this needs a design that can work for Blender as a whole, not just Sculpt mode.

While I can see where you're coming from, it's really just not needed anywhere else, and if it is, I'd argue that this implementation is good enough across the board. The goal is to switch objects in edit mode visually without looking at a list or taking a long time, and it already does that.

This to me defeats the purpose, and will actually take longer than it currently does to perform this action. Virtually no one sculpts by picking objects from a list, and reading object names in a list that could be hundreds of lines long to try to pick something to sculpt on vs. just hovering over the object and firing a hotkey adds an unnecessary layer of obfuscation to something that should be straightforward and simple.

That's not true though. I switch to other mesh objects in the Outliner while sculpting all the time. I don't see why this operation shouldn't work in both the viewport and the Outliner window. Just because a project can have hundreds of objects doesn't mean that such a feature isn't useful. Don't underestimate the power of good scene management by properly naming and using collections.

This to me defeats the purpose, and will actually take longer than it currently does to perform this action. Virtually no one sculpts by picking objects from a list, and reading object names in a list that could be hundreds of lines long to try to pick something to sculpt on vs. just hovering over the object and firing a hotkey adds an unnecessary layer of obfuscation to something that should be straightforward and simple.

That's not true though. I switch to other mesh objects in the Outliner while sculpting all the time. I don't see why this operation shouldn't work in both the viewport and the Outliner window. Just because a project can have hundreds of objects doesn't mean that such a feature isn't useful. Don't underestimate the power of good scene management by properly naming and using collections.

I didn't say no one did or ever does, I said almost no one does as their primary way of switching objects while sculpting. I also didn't say you shouldn't, it's just not the point of this specific tool. The point is to provide a fast visual way to switch objects in the viewport.

For the Outliner specifically, you can already click this green triangle to go directly into edit mode from being in edit mode of another object.


If we're talking about consistency, this should be extended to do the same in Sculpt mode as well (while keeping you in sculpt mode).

I don't see a point in making a viewport based visual object switching tool work for a list of objects where this functionality already halfway exists anyway. If anything, making this work there too will add a layer of confusion (since this is already there in the form of the green triangle). Catering to edge cases/attempting to make this universal will ultimately water down the initial point and power of the tool.

  • Fix crash when switching to a no mesh object

Yeah this should work in a general way instead of just in sculpting, Piemenus should get this feature where you can hover over the objects & switch to the other modes but this might clash with Blender's concept of Select first then operate.

I think this feature would work well in any of the 6 editing modes, the way Pablo is doing it in sculpt mode (hover and click). The only issue is that there isn't a convenient shortcut that is empty in all different modes. So I think it would be best to add it as a menu item without a shortcut and leave it up to the individual users to decide what shortcut to use, or if they need this feature at all in a specific mode. Blender is really flexible in this aspect, because you can use different shortcuts in different modes for the same action.

Selecting in Outliner would also be worthwhile to implement because there are cases when finding an object there is easier than in the 3D viewport.

  • Update navigation rotation center when switching objects
  • Make the operator work with edit mode and sculpt mode

Pablo Dobarro (pablodp606) retitled this revision from Sculpt: Switch Sculpt Object operator to Object: Switch Object operator.Apr 24 2020, 9:32 PM
Pablo Dobarro (pablodp606) edited the summary of this revision. (Show Details)

So for the keymap ... what about something close to what already exists. With Ctrl + Select you can select another object even if you are in any mode other than object mode. In every one except for edit mode it even switches the active object and switches to the mode that was last used for that object (You need to disable "Lock Object Modes" though).
The big issue right now is that the user still needs to set up the mode manually for each object after switching.

EDIT: There's a bit of ambiguity there between keymaps since you can switch in the painting and sculpt mode with just Right Click in RMB Select. But when using selection based masks in the painting modes it's Ctrl + RMB again.

So what if Ctrl + Select (Double Click) universally is to set the other object as the active one and copy the mode from the previous one? That could be the most convenient way and no key on the keymap is wasted.

I'm also hoping that the overlay could return from 2.79 where the active object that is being sculpted on is slightly brighter (or the other way around where all others get slightly darker) as an indicator of which one is active.

@Julien Kaspar (JulienKaspar) The issue I'm finding with the keymap is: Single click events don't work in sculpt mode (conflict with the stroke operator), double click events don't work on edit mode (conflict with selection). So maybe we need to remove and change some other things or assign this operator to a keyboard only shortcut. (tapping Ctrl, shift + X...)
The other thing you mentioned is implemented in D7516

Pablo, this is super neat!

Could the operator be flexible enough for extending objects as well? In other words if I'm in an edit/sculpt mode sometimes I'd really like to add a non-selected object to that mode instead of switching to that object. (Similar to how view3d.select can Set or can Extend.)

@Pablo Dobarro (pablodp606) What if the behavior of the Tab key changes to 'on release' instead of 'on press'.
Then the Tab key could be held down as a modifier key and Selecting another object (LMB/RMB) will switch the object and copy the mode.
Just throwing around ideas.

Yeah I think this might need more discussion & a design though because the way this operator is accessed should be universally consistent like @William Reynish (billreynish) said and there are already similar operators in place that could be adjusted to work similarly to this one or the other way around.

@Julien Kaspar (JulienKaspar) I think that was used in the "pie menu on drag option".
To me, the ideal solution would be to switch the paint_stroke operator from press to drag (more info about that here T71951), that way we could use click events on sculpt and paint modes for this operator and other functionality (setting the transform pivot point to a particular area, controlling the visibility of face sets by clicking on them...). But I'm not sure if the event/keymap code is compatible with this.

serge (rpserge) awarded a token.

Tab + mouse click should work fine, because pie menu is triggered only if the mouse is moved a certain amount. If a drag threshold is set high enough it shouldn't be a problem.
But whatever the default shortcut ends up being, it should be editable in the keymap and not hardcoded in some way.

kouza (kouza) added a comment.EditedMay 1 2020, 5:50 PM

For some reason, I can't apply this patch anymore on clean build, something changed?
i mean it's committed successfully but I can't find the hotkey and if I try to create shortcut with "sculpt.switch sculpt object" nothing happen.