fix #99584: Outliner selection not working correctly after undoing object deletion #105903
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#105903
Loading…
Reference in New Issue
No description provided.
Delete Branch "Kaicheng-Zhou/blender:temp-fix-tree-add-elem"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
An object that is linked in another collection can usually be removed from just that collection by using unlink, while using delete removes it from both collections. But if you delete the object and undo, unlink does delete the object in both collections.
Renaming the cube or creating a new object "breaks" the cubes apart so they can be selected/unlinked individually again.
After some inspection, the problem is caused by two linked elements sharing the same
TreeStoreElem
. When adding elements to the treestore, newly created elements are marked as unused. Therefore the other linked object (with the same ID) will take up the same store element.Solution
Mark the new element as used.
Hi, thanks for the PR. As far as I understand,
used
indicates that the tree-element is new and is not used yet. This variable is being used during rebuilding the tree. Changing this to1
is a workaround but not a proper solution.Code block sits right above this change will be of no use if
used
is set to 1 by default.Requesting changes
Hey @PratikPB2123 thank you for your review! Actually I thought the same as you in the beginning. However, I could not find any other code setting
used
to 1 except for the code you quoted. But when cleaning up the tree, the code set theused
value of all elements on the tree to 0.Therefore my understanding is:
used
being 1 indicates thisTreeStoreElem
is now refering to an existing tree element. During the cleaning up, all theTreeStoreElem
will be unused. During the rebuilding, it will look for any unusedTreeStoreElem
refering to the same id and take it up (the function of the code block you quote). Whether there's any element to be "reused" or not, I think the outcome should be the same — the returnedTreeStoreElem
should be refering to an existing element and itsused
should be 1.Some weird behaviours I found helped me understand: If you have 4 objects linked together, after deleting and undoing, the first 2 objects will be "combined", the other two will also be "combined", but not the four all together. Ok, now if you undo again (or any other action to trigger the rebuilding process), you will find the first two objects separated, but the other two not. You have to undo the second time in order to separate all of them.
Hi, FYI Philipp found the commit that introduced this issue:
b077de086e
This might help you in finding the correct fix.
Checkout
From your project repository, check out a new branch and test the changes.