Fix #126074: Sculping on a non-basis shape key modifies mesh #126107

Merged
Sean Kim merged 2 commits from Sean-Kim/blender:fix-126074 into main 2024-08-09 22:34:49 +02:00
Member

This commit prevents writing to the mesh when sculpting on a non-basis
shape key. Prior to this, we incorrectly were applying changes to the
base mesh, even though those changes were not visible with the shape
keys still active, causing new shape keys to have a copy of the deformed
mesh data.

This commit prevents writing to the mesh when sculpting on a non-basis shape key. Prior to this, we incorrectly were applying changes to the base mesh, even though those changes were not visible with the shape keys still active, causing new shape keys to have a copy of the deformed mesh data.
Sean Kim added this to the 4.3 milestone 2024-08-08 22:09:08 +02:00
Sean Kim added 1 commit 2024-08-08 22:09:19 +02:00
Fix #126074: Sculping on a non-basis shape key modifies mesh
All checks were successful
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
a6509addfb
This commit prevents writing to the mesh when sculpting on a non-basis
shape key. Prior to this, we incorrectly were applying changes to the
base mesh, even though those changes were not visible with the shape
keys still active, causing new shape keys to have a copy of the deformed
mesh data.
Sean Kim added this to the Module: Sculpt, Paint & Texture project 2024-08-08 22:09:26 +02:00
Sean Kim requested review from Hans Goudey 2024-08-08 22:09:39 +02:00
Sean Kim requested review from Sergey Sharybin 2024-08-08 22:09:45 +02:00
Iliya Katushenock reviewed 2024-08-08 22:10:47 +02:00
@ -7316,3 +7316,3 @@
}
apply_translations(translations, verts, positions_orig);
Mesh &mesh = *static_cast<Mesh *>(object.data);

Can be const/
Same for key

Can be const/ Same for key
Sean-Kim marked this conversation as resolved
Author
Member

@blender-bot build

@blender-bot build
Sergey Sharybin approved these changes 2024-08-09 09:37:03 +02:00
Hans Goudey reviewed 2024-08-09 17:33:43 +02:00
@ -7319,0 +7319,4 @@
KeyBlock *active_key = BKE_keyblock_from_object(&object);
const bool relative_shapekey_active = active_key != nullptr && active_key != mesh.key->refkey;
if (!relative_shapekey_active) {
/* If a relative shapekey is active, we do not want to write any data to the original mesh. */
Member

This comment says exactly what the code says (due to your helpful variable name); I don't think it's helpful. Generally this sort of comment makes it feel like the code is brittle, and code should document itself, making this sort of "what is happening" comment generally unnecessary.

This comment says exactly what the code says (due to your helpful variable name); I don't think it's helpful. Generally this sort of comment makes it feel like the code is brittle, and code should document itself, making this sort of "what is happening" comment generally unnecessary.
Author
Member

Yeah, that's fair. I was trying to think of more descriptive / "why" things to put here since this did cause a bug, but I agree that as is this is just duplicated info.

Yeah, that's fair. I was trying to think of more descriptive / "why" things to put here since this did cause a bug, but I agree that as is this is just duplicated info.
Sean-Kim marked this conversation as resolved
@ -7319,1 +7323,4 @@
apply_translations(translations, verts, positions_orig);
}
apply_translations_to_shape_keys(object, verts, translations, positions_orig);
Member

The apply_translations_to_shape_keys abstraction breaks down a bit now. I don't have a strong opinion for whether to do this now or later, but I'd probably remove the function and put it in here.

The `apply_translations_to_shape_keys` abstraction breaks down a bit now. I don't have a strong opinion for whether to do this now or later, but I'd probably remove the function and put it in here.
Author
Member

I'll follow up on this afterwards; there's another place that apply_translations_to_shape_keys is used in the undo code, so I don't want to clutter this fix with that cleanup.

I'll follow up on this afterwards; there's another place that `apply_translations_to_shape_keys` is used in the undo code, so I don't want to clutter this fix with that cleanup.
Member

Sounds good, thanks!

Sounds good, thanks!
Hans Goudey approved these changes 2024-08-09 20:41:15 +02:00
Sean Kim added 1 commit 2024-08-09 22:32:21 +02:00
Sean Kim merged commit 810fee35f3 into main 2024-08-09 22:34:49 +02:00
Sean Kim deleted branch fix-126074 2024-08-09 22:34:52 +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
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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 & 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
Viewport & EEVEE
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
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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 Assignees
4 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#126107
No description provided.