Page MenuHome

Collections: Exclude From ViewLayer toggle will leave the object in multiple modes (e.g. unable to set as active object)
Closed, ResolvedPublicBUG

Description

Blender Version
Broken: version: 2.83 (sub 17), branch: master, commit date: 2020-05-25 17:35, hash: rB39aa122a0e6d
Worked: Never

Short description of error
Setting a mesh to either texture paint or particle edit mode (when the mesh is an emitter) and then excluding and including the collection prevents the object from being set as active, and so further interaction with the object is not possible.

Exact steps for others to reproduce the error

  • Set the default cube to texture paint mode or create a particle system (leave it as an emitter) and set to particle edit mode.
  • Toggle exclude collection from view layer.
  • Toggle exclude collection from view layer again to turn it back on.
  • Click on the default cube.
  • The default cube can no longer be set as active or interacted with.

Workaround
Set the active object as you would normally do (e.g., click on the camera) then save and re-open the file.

Event Timeline

This seems like a somewhat serious issue, so I'm tagging with 2.83. I hope this is alright.

This is also potentially related to T72490 and T77074

Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Confirmed.May 26 2020, 11:47 AM
Philipp Oeser (lichtwerk) changed the subtype of this task from "Report" to "Bug".

Can confirm.
This one (same as T77074) has been around for some time though, and considering how late we are in the release cycle, I'll remove 2.83 as a tag.

Not exactly sure which module is responsible for collection-related bugs? (for the time being, I'll put this on the UI desk)

CC @Brecht Van Lommel (brecht)
CC @Dalai Felinto (dfelinto)

Philipp Oeser (lichtwerk) renamed this task from Unable to set mesh as active object after excluding collection in texture paint and particle edit mode to Collections: Exclude From ViewLayer toggle will leave the object in multiple modes (e.g. unable to set as active object).May 26 2020, 11:48 AM
Philipp Oeser (lichtwerk) triaged this task as High priority.May 26 2020, 3:10 PM

Switching to High prio (since getting into this mode-limbo is pretty hard to recover from -- not sure if there is any tbh)

Actually I just found a couple of ways to recover from this. You can reset the active object using the python console, save and reopen the blend file, or (the easiest way) you can just click the green mesh data icon for the object in the outliner which sends you to the object's edit mode and from there everything works again.

I noticed during my testing that grease pencil objects are also affected, but not as strongly. When toggling exclude collection with a grease pencil object not in object mode it causes the selection outline not to display and, when it was in vertex paint mode, it's drawn as if it's still in vertex paint even though it's now in object mode. The outliner recovery method from above fixes the drawing.

Dalai Felinto (dfelinto) lowered the priority of this task from High to Normal.May 28 2020, 12:05 PM

The workaround is simpler actually: you can set the active object as you would normally do (e.g., click on the camera) then saving and re-opening the file and things work. Which also means priority is a bit lower.

The issue is that the object is still stuck with mode 'TEXTURE_PAINT' even though it is no longer the active object. The same happens for 'EDIT', yet this one doesn't stop the object from being selected again to be active.

For the records, if using python to set the object as active it works. bpy.context.view_layer.objects.active = bpy.data.objects['Cube'].

So the issue is with the outliner / viewport "set to active" code.

@Campbell Barton (campbellbarton) just to refresh my mind, we are ok with objects lingering in modes that are not object mode, right? If I remember correctly at some point we gave up on their syncing, moving the sanity check elsewhere.

Campbell said that indeed we can't make strong assumptions about this, there is only the editing option not to change modes when selecting.

@Nathan Craddock (Zachman) can you look at this issue? It should be straightforward, but, but it has to be done well to work for both the outliner AND the viewport.

@Dalai Felinto (dfelinto) Sorry, my last post wasn't clear. There's an easier way to recover from this than saving and re-opening the blend file, just click the data icon that's beside the object in the outliner (the green triangle in the default blender theme). This takes you to edit mode and then you can switch back to object mode and everything will be fine.

Hello, is this task unassigned? I would like to try it out since it's in Good First Issue

Hey @xiwei (xiweizhou123), it's been assigned (to me) and there is a revision awaiting review already (D7886: Fix T77073: Objects cannot be activated after collection exclude), sorry about that! You can find the information about task assignment in the right column next to the task description, and the revisions are listed below the description.

@Nathan Craddock (Zachman) Don't worry still thx. imma just give a look to your commit :)