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");