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:
authorJoshua Leung <aligorith@gmail.com>2013-04-23 05:54:29 +0400
committerJoshua Leung <aligorith@gmail.com>2013-04-23 05:54:29 +0400
commit42063f36af9643530e3b23cf271c95dc1be0457d (patch)
treeb0ce7d877d07853f78a71207045e2c160c9255a3 /source/blender/makesrna/intern/rna_animation.c
parent51010f50351a5115122dc64e02a5a9b2c76c4edb (diff)
Bugfix [#34869] Switching actions does not trigger animation refresh
Changing actions via RNA (or apparently from the Action Editor browse menu too) didn't perform all the necessary updates/tagging/recalc needed to have the results of the new action get immediately applied in the 3D view. This caused problems for exporters, as the first frames exported would be incorrect (though this could probably be worked around by manually stepping the current frame forward one frame then back again).
Diffstat (limited to 'source/blender/makesrna/intern/rna_animation.c')
-rw-r--r--source/blender/makesrna/intern/rna_animation.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index 50f156dd985..7bdaca3c847 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -71,11 +71,24 @@ EnumPropertyItem keying_flag_items[] = {
#include "BLI_math_base.h"
#include "BKE_animsys.h"
+#include "BKE_depsgraph.h"
#include "BKE_fcurve.h"
#include "BKE_nla.h"
+#include "DNA_object_types.h"
+
#include "WM_api.h"
+static void rna_AnimData_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ ID *id = ptr->id.data;
+
+ /* tag for refresh so that scheduled updates (e.g. action changed) will
+ * get computed and reflected in the scene [#34869]
+ */
+ DAG_id_tag_update(id, OB_RECALC_OB | OB_RECALC_DATA);
+}
+
static int rna_AnimData_action_editable(PointerRNA *ptr)
{
AnimData *adt = (AnimData *)ptr->data;
@@ -90,7 +103,16 @@ static int rna_AnimData_action_editable(PointerRNA *ptr)
static void rna_AnimData_action_set(PointerRNA *ptr, PointerRNA value)
{
ID *ownerId = (ID *)ptr->id.data;
+ AnimData *adt;
+
+ /* set action */
BKE_animdata_set_action(NULL, ownerId, value.data);
+
+ /* force action to get evaluated [#34869] */
+ adt = BKE_animdata_from_id(ownerId);
+ if (adt) {
+ adt->recalc |= ADT_RECALC_ANIM;
+ }
}
/* ****************************** */
@@ -912,7 +934,7 @@ static void rna_def_animdata(BlenderRNA *brna)
RNA_def_property_pointer_funcs(prop, NULL, "rna_AnimData_action_set", NULL, "rna_Action_id_poll");
RNA_def_property_editable_func(prop, "rna_AnimData_action_editable");
RNA_def_property_ui_text(prop, "Action", "Active Action for this datablock");
- RNA_def_property_update(prop, NC_ANIMATION, NULL); /* this will do? */
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA_ACTCHANGE, "rna_AnimData_update");
/* Active Action Settings */
prop = RNA_def_property(srna, "action_extrapolation", PROP_ENUM, PROP_NONE);
@@ -920,7 +942,7 @@ static void rna_def_animdata(BlenderRNA *brna)
RNA_def_property_enum_items(prop, nla_mode_extend_items);
RNA_def_property_ui_text(prop, "Action Extrapolation",
"Action to take for gaps past the Active Action's range (when evaluating with NLA)");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL);
prop = RNA_def_property(srna, "action_blend_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "act_blendmode");