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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2014-04-25 20:44:55 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2014-04-28 11:46:06 +0400
commit2aa9d33404ca96e6bd42224ebac19696e03550f8 (patch)
treeebaf3912a1b8802cf479a345a7708ad86f2eef9b /source/blender/editors/animation/keyframing.c
parente44018220ab0b0bf63970861b0a718144afc2a56 (diff)
Fix T39902: Keyframe insertion by a Keying Set fails in the edit mode when keyframing object data properties.
Reviewers: aligorith Reviewed By: aligorith Differential Revision: https://developer.blender.org/D484
Diffstat (limited to 'source/blender/editors/animation/keyframing.c')
-rw-r--r--source/blender/editors/animation/keyframing.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index a17fec52a1c..9008d330c21 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -72,6 +72,7 @@
#include "ED_keyframing.h"
#include "ED_keyframes_edit.h"
#include "ED_screen.h"
+#include "ED_object.h"
#include "UI_interface.h"
#include "UI_resources.h"
@@ -1265,6 +1266,8 @@ static int modify_key_op_poll(bContext *C)
static int insert_key_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
+ Object *ob = CTX_data_active_object(C);
+ bool ob_edit_mode = false;
KeyingSet *ks = NULL;
int type = RNA_enum_get(op->ptr, "type");
float cfra = (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
@@ -1287,12 +1290,25 @@ static int insert_key_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "No active keying set");
return OPERATOR_CANCELLED;
}
+
+ /* exit the edit mode to make sure that those object data properties that have been
+ * updated since the last switching to the edit mode will be keyframed correctly
+ */
+ if (ob && (ob->mode & OB_MODE_EDIT) != 0 && ANIM_keyingset_find_id(ks, (ID *)ob->data)) {
+ ED_object_toggle_modes(C, OB_MODE_EDIT);
+ ob_edit_mode = true;
+ }
/* try to insert keyframes for the channels specified by KeyingSet */
success = ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
if (G.debug & G_DEBUG)
BKE_reportf(op->reports, RPT_INFO, "Keying set '%s' - successfully added %d keyframes", ks->name, success);
+ /* restore the edit mode if necessary */
+ if (ob_edit_mode) {
+ ED_object_toggle_modes(C, OB_MODE_EDIT);
+ }
+
/* report failure or do updates? */
if (success == MODIFYKEY_INVALID_CONTEXT) {
BKE_report(op->reports, RPT_ERROR, "No suitable context info for active keying set");