diff options
Diffstat (limited to 'source/blender/editors/animation/keyframing.c')
-rw-r--r-- | source/blender/editors/animation/keyframing.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index e6f2f087ede..6f2360767c0 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -53,17 +53,18 @@ #include "DNA_object_types.h" #include "DNA_rigidbody_types.h" -#include "BKE_animsys.h" #include "BKE_action.h" +#include "BKE_animsys.h" #include "BKE_armature.h" +#include "BKE_context.h" #include "BKE_fcurve.h" -#include "BKE_idcode.h" -#include "BKE_nla.h" #include "BKE_global.h" -#include "BKE_context.h" -#include "BKE_report.h" +#include "BKE_idcode.h" #include "BKE_key.h" +#include "BKE_main.h" #include "BKE_material.h" +#include "BKE_nla.h" +#include "BKE_report.h" #include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" @@ -126,7 +127,7 @@ short ANIM_get_keyframing_flags(Scene *scene, short incl_mode) /* Get (or add relevant data to be able to do so) the Active Action for the given * Animation Data block, given an ID block where the Animation Data should reside. */ -bAction *verify_adt_action(ID *id, short add) +bAction *verify_adt_action(Main *bmain, ID *id, short add) { AnimData *adt; @@ -148,7 +149,7 @@ bAction *verify_adt_action(ID *id, short add) BLI_snprintf(actname, sizeof(actname), "%sAction", id->name + 2); /* create action */ - adt->action = BKE_action_add(G.main, actname); + adt->action = BKE_action_add(bmain, actname); /* set ID-type from ID-block that this is going to be assigned to * so that users can't accidentally break actions by assigning them @@ -158,7 +159,7 @@ bAction *verify_adt_action(ID *id, short add) /* tag depsgraph to be rebuilt to include time dependency */ /* XXX: we probably should have bmain passed down, but that involves altering too many API's */ - DEG_relations_tag_update(G.main); + DEG_relations_tag_update(bmain); } DEG_id_tag_update(&adt->action->id, DEG_TAG_COPY_ON_WRITE); @@ -1021,7 +1022,9 @@ bool insert_keyframe_direct(Depsgraph *depsgraph, ReportList *reports, PointerRN * * index of -1 keys all array indices */ -short insert_keyframe(Depsgraph *depsgraph, ReportList *reports, ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag) +short insert_keyframe( + Main *bmain, Depsgraph *depsgraph, ReportList *reports, ID *id, bAction *act, + const char group[], const char rna_path[], int array_index, float cfra, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag) { PointerRNA id_ptr, ptr; PropertyRNA *prop = NULL; @@ -1047,7 +1050,7 @@ short insert_keyframe(Depsgraph *depsgraph, ReportList *reports, ID *id, bAction /* if no action is provided, keyframe to the default one attached to this ID-block */ if (act == NULL) { /* get action to add F-Curve+keyframe to */ - act = verify_adt_action(id, 1); + act = verify_adt_action(bmain, id, 1); if (act == NULL) { BKE_reportf(reports, RPT_ERROR, @@ -1773,6 +1776,7 @@ void ANIM_OT_keyframe_delete_v3d(wmOperatorType *ot) static int insert_key_button_exec(bContext *C, wmOperator *op) { Depsgraph *depsgraph = CTX_data_depsgraph(C); + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); ToolSettings *ts = scene->toolsettings; PointerRNA ptr = {{NULL}}; @@ -1856,7 +1860,7 @@ static int insert_key_button_exec(bContext *C, wmOperator *op) index = -1; } - success = insert_keyframe(depsgraph, op->reports, ptr.id.data, NULL, group, path, index, cfra, ts->keyframe_type, flag); + success = insert_keyframe(bmain, depsgraph, op->reports, ptr.id.data, NULL, group, path, index, cfra, ts->keyframe_type, flag); MEM_freeN(path); } |