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
This commit is contained in:
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user