Page MenuHome

Vertex Group control for the MeshCache modifier
ClosedPublic

Authored by Maxime Casas (troopy28) on Dec 18 2020, 5:35 PM.

Details

Summary

Hi!

This diff proposes a vertex group control for the MeshCache modifier, to allow blending the imported cache with the modifiers stack above the MeshCache modifier.

This is particularly useful for instance when dealing with cloth simulations performed in another software, where some parts of the cloth are completely pinned (non-simulated, following the armature). Indeed, this would allow modifying the animation in some areas without having to rebake the other parts or the cloth, resulting in a much more flexible workflow.

Little demo, with the default cube:

Diff Detail

Event Timeline

Maxime Casas (troopy28) requested review of this revision.Dec 18 2020, 5:35 PM
Maxime Casas (troopy28) created this revision.
Bastien Montagne (mont29) requested changes to this revision.Dec 18 2020, 6:21 PM

Generally looks good to me, let's give a bit more time to @Campbell Barton (campbellbarton) to react too if he wants. ;)

source/blender/modifiers/intern/MOD_meshcache.c
302–325

there's no reason to have two separate blocks here, this check about inverting vgroups only affects the initial value of fac, everything else is exact same code.

306

(1.0f - BKE_defvert_find_weight

(literal float, and spaces)

This revision now requires changes to proceed.Dec 18 2020, 6:21 PM
source/blender/modifiers/intern/MOD_meshcache.c
320–323

This can be replaced by interp_v3_v3v3 I think?

Applied Bastien's advice.
There is now only a single loop, and the interpolation is done using the existing interp_v3_v3v3 function.

Maxime Casas (troopy28) marked 3 inline comments as done.Dec 18 2020, 7:34 PM

LGTM (besides picky note below), not sure if @Campbell Barton (campbellbarton) also wants to check it...

source/blender/modifiers/intern/MOD_meshcache.c
268–294

Would switch those two conditions, that way you do not need to check for a valid vgroup in the second one and can just do else if (use_factor) instead.

This revision is now accepted and ready to land.Dec 21 2020, 2:10 PM

This patch has an approved status however it was not committed yet. So I'm assuming the other reviewers are blocking. Updating the reviewers list to reflect this. This way the patch status still show as Need Review.

This revision now requires review to proceed.Mar 26 2021, 5:31 PM

Code updated for the latest sources.
Swapped the condition as suggested by Bastien.

Maxime Casas (troopy28) marked an inline comment as done.Jun 12 2021, 8:39 AM
Campbell Barton (campbellbarton) requested changes to this revision.EditedJun 24 2021, 2:46 AM
  • This assumes meshes when mesh-cache can be used on non-mesh types (curves for example).
  • The object's mesh data is used, instead of the input mesh in the modifier stack.
  • The modifier may be running in edit-mode, where the Mesh object doesn't contain the currently edited mesh.

Check the simple-deform modifier which handles all these cases.

This revision now requires changes to proceed.Jun 24 2021, 2:46 AM

Addressed the issues raised in the last review.

Fixed a memory leak when deforming not in edit mode.

This revision is now accepted and ready to land.Sep 7 2021, 2:43 PM