Fix #112767: Outliner unlink operation fails to unlink from scene #112955
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#112955
Loading…
Reference in New Issue
No description provided.
Delete Branch "PratikPB2123/blender:112767-outliner-scene-unlink"
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?
When in scene mode, operation searches the object in master collection
to unlink. But object can be in any collection. So iterate through all
collections present in scene to unlink the object
Fix #112767: Outliner unlink operation fails to unlink from sceneto Fix #112767: Outliner unlink operation fails to unlink from sceneFix #112767: Outliner unlink operation fails to unlink from sceneto Fix #112767: Outliner unlink operation fails to unlink from sceneReminder, bugfixes like this should go to the 4.0 branch. But just switching in Gitea isn't enough as the commit needs to be rebased also.
@brecht , sure. I'll rebase the branch once PR is approved :)
Maintaining working branch with "main" seems handy
Seems correct, but would like somebody like Bastien or Brecht to double check.
@ -467,3 +467,2 @@
Scene *scene = (Scene *)tsep->id;
Collection *parent = scene->master_collection;
BKE_collection_object_remove(bmain, parent, ob, true);
FOREACH_SCENE_COLLECTION_BEGIN (scene, collection) {
Would need a comment here, since this only works because the only case when the parent item is a Scene is in the
Scene
view of the Outliner. inViewLayer
view, the parent of an object item is always a collection (normal one, or the Scene's master collection).In fact, would also be good to have an assert that this branch is only executed from an Outliner in
Scene
view...@mont29 , I think the condition
else if (GS(tsep->id->name) == ID_SCE) {
itself suggests we're in outlinerscene
view.Because in scene view, parent of selected data references to
scene
itself.If object is child of some object then we're finding parent scene/collection to unlink the object from: see
What I am saying is that this code makes certain assumptions about the context in which it is executed, and that these assumptions should be both documented as a comment, and preferably validated with some
assert
That is exactly what I am asking you to explain in the comment. Because there is nothing 'obvious' about that assumption, and while correct in current code, it may very well become wrong in the future, causing the code to have an unexpected/buggy behavior.
Ok, thanks for clarifying 😅
Updated, I hope this one liner comment is sufficient :)
Thanks, yes it's essentially good to go now.
Following points can be addressed before final commit, no need for extra review for them.
@ -473,9 +473,17 @@ static void unlink_object_fn(bContext *C,
DEG_relations_tag_update(bmain);
}
else if (GS(tsep->id->name) == ID_SCE) {
/* Following execution is expected to happen in outliner scene view. */
to happen exclusively in the Outliner Scene view
@ -474,2 +474,4 @@
}
else if (GS(tsep->id->name) == ID_SCE) {
/* Following execution is expected to happen in outliner scene view. */
SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
These two lines should be inside a
#ifndef NDEBUG
block.Merged, thanks for reviewing :)