Fix #119384: Outliner crash extend mode toggle on objects sharing data #119416
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
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#119416
Loading…
Reference in New Issue
No description provided.
Delete Branch "lichtwerk/blender:119384"
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?
This builds upon
8e060b44da
Above commit also checked shared data against the active object,
however objects not being active can also share data with other objects
in multi-object-editing. This is now checked, so the shared icon is used
for them as well as disabeling "extend" (same as in
8e060b44da
).Noticed other issues with this feature:
(
outliner_item_mode_toggle
ignores other modes for extending)not work well/at all.
@blender-bot build
FYI: linting fails because of some other commit (probably
0b19f1f4a0
)@ -2145,0 +2146,4 @@
Object *ob,
Object *ob_active)
{
bool object_data_shared = (ob->data == ob_active->data);
Looks like this can be changed to
if (ob->data == ob_active->data) { return true; }
@ -2145,0 +2149,4 @@
bool object_data_shared = (ob->data == ob_active->data);
/* If the ID has multiple users, also check if any object using it is in the same mode as the
* active object. */
if (static_cast<const ID *>(ob->data)->us > 1) {
Flip the condition and return early in this case
@ -2145,0 +2155,4 @@
Vector<Object *> objects_in_mode = BKE_view_layer_array_from_objects_in_mode_params(
tvc->scene, tvc->view_layer, nullptr, ¶ms);
for (Object *object : objects_in_mode) {
object_data_shared |= object->data == ob->data;
Return true in this case rather than changing a boolean, then return false at the end.
@ -2142,6 +2142,26 @@ static void outliner_buttons(const bContext *C,
}
}
static bool outliner_mode_toggle_object_data_shared(TreeViewContext *tvc,
This name is not clear to me. It reads like it's toggling some shared state of the object-data. How about
outliner_is_object_data_shared_in_mode()
?@ -2144,1 +2144,4 @@
static bool outliner_mode_toggle_object_data_shared(TreeViewContext *tvc,
Object *ob,
Object *ob_active)
Both these can be
const
I think.@ -2145,0 +2146,4 @@
Object *ob,
Object *ob_active)
{
bool object_data_shared = (ob->data == ob_active->data);
This
object_data_shared
variable seems to just make things more confusing (and less efficient), I don't see a need for it. Just return once you have found an object sharing the data. LikeThis makes the function flow much easier to follow, there's no local "state" variable to keep track of.
@ -2145,0 +2152,4 @@
if (static_cast<const ID *>(ob->data)->us > 1) {
ObjectsInModeParams params = {0};
params.object_mode = ob_active->mode;
Vector<Object *> objects_in_mode = BKE_view_layer_array_from_objects_in_mode_params(
I'm not sure if it's a great idea to call this here, since it gets called for every object in every redraw. You could store this in
TreeViewContext
. What do you think @HooglyBoogly?Also I guess this will contain both
ob
andob_active
, so the function will always return true?I wonder if the original
ob->data == tvc.obact->data
check also had that issue, I guess it did.@ -2145,0 +2154,4 @@
params.object_mode = ob_active->mode;
Vector<Object *> objects_in_mode = BKE_view_layer_array_from_objects_in_mode_params(
tvc->scene, tvc->view_layer, nullptr, ¶ms);
for (Object *object : objects_in_mode) {
It's easy to confuse
ob
andobject
. Better name thisiter_object
or something clearer. Also,const
.Will target main branch (since running out of time for 4.1)
I think it is apparent that some other solution needs to be found, will step down from this one for now
Pull request closed