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:
authorSybren A. Stüvel <sybren@blender.org>2021-07-06 18:21:21 +0300
committerSybren A. Stüvel <sybren@blender.org>2021-07-06 19:20:26 +0300
commit1364f1e35c2078658447493c05c937d93a3fe35f (patch)
treeaa5efa0c8c70e419639756450d94cb1bf972a16d
parent563ef943c741eebd2fc7eaecd3984a0f5a17b7b2 (diff)
Fix T89592: Can't remove keyframes without active keying set
Partially revert 7fc220517f87a2c40a4f438a50485233ae6ed62f, as it introduced two issues: - Deleting keys without active keying set was no longer possible, and - there was no more confirmation popup. Pressing {key Alt I} in the 3D Viewport now executes `ANIM_OT_keyframe_delete_v3d`, adjusted to suit both T88068 and T89592: - If there is an active keying set, delete keys according to that keying set. - Otherwise, behave as `ANIM_OT_keyframe_delete_v3d` did before, that is, delete all keyframes of the selected object and in pose-mode also of selected bones.
-rw-r--r--release/scripts/presets/keyconfig/keymap_data/blender_default.py4
-rw-r--r--release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py4
-rw-r--r--source/blender/editors/animation/keyframing.c35
3 files changed, 29 insertions, 14 deletions
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 7f1039a975b..4319e3a962b 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -4113,7 +4113,7 @@ def km_pose(params):
("pose.bone_layers", {"type": 'M', "value": 'PRESS'}, None),
("transform.bbone_resize", {"type": 'S', "value": 'PRESS', "ctrl": True, "alt": True}, None),
("anim.keyframe_insert_menu", {"type": 'I', "value": 'PRESS'}, None),
- ("anim.keyframe_delete", {"type": 'I', "value": 'PRESS', "alt": True}, None),
+ ("anim.keyframe_delete_v3d", {"type": 'I', "value": 'PRESS', "alt": True}, None),
("anim.keying_set_active_set", {"type": 'I', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, None),
("poselib.browse_interactive", {"type": 'L', "value": 'PRESS', "alt": True}, None),
("poselib.pose_add", {"type": 'L', "value": 'PRESS', "shift": True}, None),
@@ -4185,7 +4185,7 @@ def km_object_mode(params):
("wm.context_toggle", {"type": 'PERIOD', "value": 'PRESS', "ctrl": True},
{"properties": [("data_path", 'tool_settings.use_transform_data_origin')]}),
("anim.keyframe_insert_menu", {"type": 'I', "value": 'PRESS'}, None),
- ("anim.keyframe_delete", {"type": 'I', "value": 'PRESS', "alt": True}, None),
+ ("anim.keyframe_delete_v3d", {"type": 'I', "value": 'PRESS', "alt": True}, None),
("anim.keying_set_active_set", {"type": 'I', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, None),
("collection.create", {"type": 'G', "value": 'PRESS', "ctrl": True}, None),
("collection.objects_remove", {"type": 'G', "value": 'PRESS', "ctrl": True, "alt": True}, None),
diff --git a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
index b0144672745..714126903d8 100644
--- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
+++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
@@ -3015,7 +3015,7 @@ def km_pose(params):
("anim.keyframe_insert_by_name", {"type": 'R', "value": 'PRESS', "shift": True},
{"properties": [("type", 'Scaling')]}),
- ("anim.keyframe_delete", {"type": 'S', "value": 'PRESS', "alt": True}, None),
+ ("anim.keyframe_delete_v3d", {"type": 'S', "value": 'PRESS', "alt": True}, None),
("anim.keying_set_active_set", {"type": 'S', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, None),
*_template_items_context_menu("VIEW3D_MT_pose_context_menu", {"type": 'RIGHTMOUSE', "value": 'PRESS'}),
# Tools
@@ -3086,7 +3086,7 @@ def km_object_mode(params):
{"properties": [("type", 'Rotation')]}),
("anim.keyframe_insert_by_name", {"type": 'R', "value": 'PRESS', "shift": True},
{"properties": [("type", 'Scaling')]}),
- ("anim.keyframe_delete", {"type": 'S', "value": 'PRESS', "alt": True}, None),
+ ("anim.keyframe_delete_v3d", {"type": 'S', "value": 'PRESS', "alt": True}, None),
("anim.keying_set_active_set", {"type": 'S', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, None),
*_template_items_context_menu("VIEW3D_MT_object_context_menu", {"type": 'RIGHTMOUSE', "value": 'PRESS'}),
("object.move_to_collection", {"type": 'G', "value": 'PRESS', "ctrl": True}, None),
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 08756252001..864d97c9ea9 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -85,6 +85,8 @@ static KeyingSet *keyingset_get_from_op_with_error(wmOperator *op,
PropertyRNA *prop,
Scene *scene);
+static int delete_key_using_keying_set(bContext *C, wmOperator *op, KeyingSet *ks);
+
/* ************************************************** */
/* Keyframing Setting Wrangling */
@@ -2079,19 +2081,19 @@ void ANIM_OT_keyframe_insert_menu(wmOperatorType *ot)
static int delete_key_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
- float cfra = (float)CFRA; /* XXX for now, don't bother about all the yucky offset crap */
- int num_channels;
-
KeyingSet *ks = keyingset_get_from_op_with_error(op, op->type->prop, scene);
if (ks == NULL) {
return OPERATOR_CANCELLED;
}
- /* report failure */
- if (ks == NULL) {
- BKE_report(op->reports, RPT_ERROR, "No active Keying Set");
- return OPERATOR_CANCELLED;
- }
+ return delete_key_using_keying_set(C, op, ks);
+}
+
+static int delete_key_using_keying_set(bContext *C, wmOperator *op, KeyingSet *ks)
+{
+ Scene *scene = CTX_data_scene(C);
+ float cfra = (float)CFRA; /* XXX for now, don't bother about all the yucky offset crap */
+ int num_channels;
/* try to delete keyframes for the channels specified by KeyingSet */
num_channels = ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_DELETE, cfra);
@@ -2107,7 +2109,8 @@ static int delete_key_exec(bContext *C, wmOperator *op)
if (num_channels > 0) {
/* if the appropriate properties have been set, make a note that we've inserted something */
- if (RNA_boolean_get(op->ptr, "confirm_success")) {
+ PropertyRNA *prop = RNA_struct_find_property(op->ptr, "confirm_success");
+ if (prop != NULL && RNA_property_boolean_get(op->ptr, prop)) {
BKE_reportf(op->reports,
RPT_INFO,
"Successfully removed %d keyframes for keying set '%s'",
@@ -2278,7 +2281,7 @@ void ANIM_OT_keyframe_clear_v3d(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-static int delete_key_v3d_exec(bContext *C, wmOperator *op)
+static int delete_key_v3d_without_keying_set(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
float cfra = (float)CFRA;
@@ -2385,6 +2388,18 @@ static int delete_key_v3d_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
+static int delete_key_v3d_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene = CTX_data_scene(C);
+ KeyingSet *ks = ANIM_scene_get_active_keyingset(scene);
+
+ if (ks == NULL) {
+ return delete_key_v3d_without_keying_set(C, op);
+ }
+
+ return delete_key_using_keying_set(C, op, ks);
+}
+
void ANIM_OT_keyframe_delete_v3d(wmOperatorType *ot)
{
/* identifiers */