Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2020-07-01 17:38:07 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2020-07-08 11:06:57 +0300
commit01c8aa12a17775cce03106a576f3c498d28131e4 (patch)
tree0ec11befa4e3444fd94256736ba0f09e0317dc92 /source/blender/modifiers
parent7fcb6bc59c85beab36dbfcec91d0cfaf5291f029 (diff)
Apply Modifier: support applying as shape key and keeping the modifier.
This can be useful to save the result of a cloth simulation as a shape key without destroying the simulation, so it's possible to e.g. re-run it to get other shapes, or simply use the new shape key to start the simulation already in a draped state. It also makes sense to allow applying as shape key even when the mesh is shared, because the operation itself just adds a shape key. To support this, split the apply operator into Apply and Apply As Shapekey so that they can have different poll callbacks. Differential Revision: https://developer.blender.org/D8173
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r--source/blender/modifiers/intern/MOD_ui_common.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/source/blender/modifiers/intern/MOD_ui_common.c b/source/blender/modifiers/intern/MOD_ui_common.c
index 137f52782a9..01b9e972086 100644
--- a/source/blender/modifiers/intern/MOD_ui_common.c
+++ b/source/blender/modifiers/intern/MOD_ui_common.c
@@ -231,12 +231,19 @@ static void modifier_ops_extra_draw(bContext *C, uiLayout *layout, void *md_v)
/* Apply as shapekey. */
if (BKE_modifier_is_same_topology(md) && !BKE_modifier_is_non_geometrical(md)) {
- uiItemEnumO(layout,
- "OBJECT_OT_modifier_apply",
- CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply As Shapekey"),
- ICON_SHAPEKEY_DATA,
- "apply_as",
- MODIFIER_APPLY_SHAPE);
+ uiItemBooleanO(layout,
+ CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply As Shapekey"),
+ ICON_SHAPEKEY_DATA,
+ "OBJECT_OT_modifier_apply_as_shapekey",
+ "keep_modifier",
+ false);
+
+ uiItemBooleanO(layout,
+ CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Save As Shapekey"),
+ ICON_SHAPEKEY_DATA,
+ "OBJECT_OT_modifier_apply_as_shapekey",
+ "keep_modifier",
+ true);
}
/* Duplicate. */