Fix #123560: Select by active material fails in multi-object-edit mode #123718

Merged
Philipp Oeser merged 2 commits from lichtwerk/blender:123560 into blender-v4.2-release 2024-06-28 13:53:30 +02:00
Member

This was the case when the slot index in the active object is greater
than the available slots of other selected objects.

Code was trying to avoid searching all materials by using
BKE_object_material_get to get an appropriate index (an addition to
D4441 added in 6b39dc7672). That function has the behavior of clamping
if a target index is greater than the available slots (for good
reasons), so we cant rely on the slot index being the same if
BKE_object_material_get finds a material. So in essence, this is not
what we want to use in this case.

Now use the much simpler BKE_object_material_index_get to get the
index [this might be less performant in certain scenarios, dont think
this is critical though and correctness should beat performance here]

NOTE: we might want to make BKE_object_material_index_get take a
const Material argument everywhere, but this is for another commit.

This was the case when the slot index in the active object is greater than the available slots of other selected objects. Code was trying to avoid searching all materials by using `BKE_object_material_get` to get an appropriate index (an addition to D4441 added in 6b39dc7672eb). That function has the behavior of clamping if a target index is greater than the available slots (for good reasons), so we cant rely on the slot index being the same if `BKE_object_material_get` finds a material. So in essence, this is not what we want to use in this case. Now use the much simpler `BKE_object_material_index_get` to get the index [this might be less performant in certain scenarios, dont think this is critical though and correctness should beat performance here] NOTE: we might want to make `BKE_object_material_index_get` take a `const` `Material` argument everywhere, but this is for another commit.
Philipp Oeser added 1 commit 2024-06-25 12:41:13 +02:00
Fix #123560: Select by active material fails in multi-object-edit mode
All checks were successful
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
7f640a2f2c
This was the case when the slot index in the active object is greater
than the available slots of other selected objects.

Code was trying to avoid searching all materials by using
`BKE_object_material_get` to get an appropriate index (an addition to
D4441 added in 6b39dc7672). That function has the behavior of clamping
if a target index is greater than the available slots (for good
reasons), so we cant rely on the slot index being the same if
`BKE_object_material_get` finds a material. So in essence, this is not
what we want to use in this case.

 Now use the much simpler `BKE_object_material_index_get` to get the
index [this might be less performant in certain scenarios, dont think
this is critical though and correctness should beat performance here]

NOTE: we might want to make `BKE_object_material_index_get` take a
`const` `Material` argument everywhere, but this is for another commit.
Philipp Oeser added this to the Modeling project 2024-06-25 12:41:40 +02:00
Philipp Oeser requested review from Campbell Barton 2024-06-25 12:41:48 +02:00
Philipp Oeser requested review from Hans Goudey 2024-06-25 12:42:06 +02:00
Author
Member

@blender-bot build

@blender-bot build

Does this sound like relative to #112408?

Does this sound like relative to #112408?
Campbell Barton approved these changes 2024-06-28 13:13:07 +02:00
@ -388,3 +388,3 @@
bool changed_multi = false;
Object *obact = CTX_data_active_object(C);
const Material *mat_active = obact ? BKE_object_material_get(obact, obact->actcol) : nullptr;
Material *mat_active = obact ? BKE_object_material_get(obact, obact->actcol) : nullptr;

Not directly related to this commit but think it's reasonable to make BKE_object_material_index_get take a const material instead of changing the type here.

Not directly related to this commit but think it's reasonable to make `BKE_object_material_index_get` take a `const` material instead of changing the type here.
Philipp Oeser added 1 commit 2024-06-28 13:38:08 +02:00
Philipp Oeser merged commit 296d05060d into blender-v4.2-release 2024-06-28 13:53:30 +02:00
Philipp Oeser deleted branch 123560 2024-06-28 13:53:39 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
Asset Browser Project
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
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#123718
No description provided.