Shape Key editing: propagate updates through basis chains #105422
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
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#105422
Loading…
Reference in New Issue
No description provided.
Delete Branch "angavrilov:pr-shapekey-propagate"
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?
It is possible to organize shape keys into a tree through the
reference key setting. Mesh editing and sculpting a reference
key is supposed to update all its children, but this was only
done for one level of dependencies.
This adds a function that finds all dependent keys through
a breadth first search (this avoids any issues with cycles),
and updates the relevant code to use it.
The attached file can be used for testing: it has an object with three shape keys that form a dependency chain.
Without this patch editing the Basis (though sculpt or edit mode) and then enabling the third key cancels out the new changes because the modifications were not propagated.
Shape Key editing: propagate updates through basis chains.to Shape Key editing: propagate updates through basis chainsNot really active in the Mesh/Modelling area nowadays, so will remove myself from here.
Also in general it's better to assign a project to a PR, than directly reviewers, unless you have already talked about the patch with them and they agreed to review it.
Also removing myself. Might want to ping @howardt about it.
I have no idea about the logic of this shape key stuff, but maybe I can help get some of the typical code cleanup stuff out of the way.
@ -182,2 +182,4 @@
bool BKE_keyblock_is_basis(const struct Key *key, int index);
/**
* Returns an array containing true for every key that has this one as basis.
an array
->an allocated array
Would just help to write down that it's supposed to be freed
@ -2594,2 +2594,4 @@
return false;
}
bool *BKE_keyblock_get_dependent_keys(const struct Key *key, int index)
const struct Key *key, int index
->const Key *key, const int index
@ -2596,0 +2596,4 @@
bool *BKE_keyblock_get_dependent_keys(const struct Key *key, int index)
{
/* Simple checks. */
I don't think this
Simple checks.
comment is adding anything here. Such early return condition checking is not exactly out of the ordinary, and the fact that they're "simple" is already obvious from looking at the code.@ -2596,0 +2608,4 @@
}
/* Seed the table with the specified key. */
bool *marked = static_cast<bool *>(MEM_callocN(sizeof(bool) * count, __func__));
This is a C++ file, might as well use
Array
orBitVector
hereIt's returned to the function caller, which still includes C code.
@ -2596,0 +2621,4 @@
updated = 0;
for (i = 0, kb = static_cast<const KeyBlock *>(key->block.first); kb; i++, kb = kb->next) {
Use the
LISTBASE_FOREACH_INDEX
macro@ -2596,0 +2634,4 @@
MEM_freeN(marked);
return nullptr;
}
else {
else after return
@ -852,2 +855,3 @@
LISTBASE_FOREACH (KeyBlock *, currkey, &key->block) {
int currkey_i;
I think this newline between the index declaration and the loop is just wasting space, it doesn't really help readability
@ -951,6 +955,7 @@ static void bm_to_mesh_shape(BMesh *bm,
if (ofs) {
MEM_freeN(ofs);
MEM_freeN(dependent);
Are
ofs
anddependent
always allocated together? That doesn't seem obvious looking at the code (though it totally might be the case!). A simpleMEM_SAFE_FREE(dependent);
at the end would be a little simpler though.7cfa71a2ff
todca49a5bff
Looks good to me.
Forgot to add the Pull Request line to
d32748cdf4
.Pull request closed