Outliner: New context menu building design #101007
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#101007
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
Motivation
The way we build context menus in
outliner_tools.cc
is known to be quite a mess. Basic problems:"(undocumented operator)"
, or the undo push name would differ from the operator name. Often menu entries were added that didn't make sense for the current selection, because hiding them requires special attention. With regular operators this is less likely to happen, since developers are used to implement them properly.Proposed Design
TL;DR: Add batch editing operators outside of Outliner code, they can act on context set by the Outliner. Tree elements are asked to add context menu entries themselves.
Main idea is:
outliner_tools.cc
), ask the active element to expand the context menu. For this, element types can overrideAbstractTreeElement::expandContextMenu()
.OUTLINER_MT_context_menu
. This is already the case in master.Further Considerations
The context system has some limitations still:
"selected_ids"
) can be inefficient. The Outliner context callback iterates over the entire tree to find the selection, and then allocates list elements for each.There are ideas to solve each, but they don't seem like a blocker for the design above. For now it's still fine to leave some menu entries as callbacks rather than operators, where context doesn't allow us to broadcast the necessary information. The actual logic should still be moved to the dedicated code modules. Performance impact is probably minor in practice.
Also:
OUTLINER_MT_modifier_context_menu
). But for as long as some entries may have to stick to a callback based approach, keeping things in C++ mostly seems better.Added subscribers: @mont29, @JulianEisel
Added subscriber: @brecht
I think all menu entries being proper operators makes sense. I'm less sure about asking the active element to expand the context menu, and broadcasting information through context.
The purpose of context is that operators can run in different editors. If the information is outliner specific (hierarchy etc), it's an unnecessary layer of abstraction only adding complexity, and I would just let operators access outliner data structures directly.
Letting the elements fill the menu is unclear to me, not sure how that works when you have multiple selected elements, mixed types. There might be some logic there that's much more easily expressed in a central function to fill the menu. Maybe it's not an issue, but I vaguely remember some logic that would prioritize e.g. objects over other data types in mixed selections. If it can be made to work then the extensibility is nice though.
Right the situation gets tricky with hierarchies and such. I see some options, but I wouldn't even mind outliner specific operators here, for as long as these are just thin wrappers calling into BKE code or such. My main concern is to get data-management code (even things like user counting) out of the Outliner, which should be "just a UI".
For other cases like batch deleting objects, I see no reason to keep this in the Outliner code at all. Broadcasting via context would be simple here and not require further abstractions.
I think this used to be the case, but for a while we've only been building the context menu from the active element now. In fact I've just cleaned up
get_element_operation_type()
, which seems to have been designed to support this, but wasn't used that way anymore (which I checked carefully):8f6a38ed7e
.Added subscriber: @DuarteRamos
Just to note, for library overrides it was/is quite a problem that only the Outliner has a good enough understanding of the necessary relations. I think it's worth thinking about ways to better define scene hierarchies throughout in Blender, for a whole bunch of reasons. Of course this is a bigger discussion, just noting as another way this could go. All in all I'm not too concerned, I'm glad about any gradual improvement here, and I wasn't planning to spend much time on these cases.
Would the "operatorification" of the outliner menus finally open up the possibility of more things working on selection rather than active object?
I'm thinking of things like (visibility or selectability) toggles working on all selection rather than just clicked item, or the possibility of keyframing toggles renderability toggles for multiple objects.
This is a design task so moving it out of the triaging queue