diff options
-rw-r--r-- | source/blender/editors/animation/anim_channels_defines.c | 8 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframing.c | 75 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_convert.c | 25 | ||||
-rw-r--r-- | source/blender/editors/include/ED_keyframing.h | 3 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_anim.c | 7 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna_anim.c | 4 |
6 files changed, 36 insertions, 86 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 7a7769ccc90..91448b2ecb9 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -4373,7 +4373,7 @@ static void achannel_setting_slider_cb(bContext *C, void *id_poin, void *fcu_poi /* insert a keyframe for this F-Curve */ done = insert_keyframe_direct( - depsgraph, reports, ptr, prop, fcu, cfra, ts->keyframe_type, nla_context, flag); + reports, ptr, prop, fcu, cfra, ts->keyframe_type, nla_context, flag); if (done) { if (adt->action != NULL) { @@ -4433,7 +4433,7 @@ static void achannel_setting_slider_shapekey_cb(bContext *C, void *key_poin, voi /* insert a keyframe for this F-Curve */ done = insert_keyframe_direct( - depsgraph, reports, ptr, prop, fcu, cfra, ts->keyframe_type, nla_context, flag); + reports, ptr, prop, fcu, cfra, ts->keyframe_type, nla_context, flag); if (done) { WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); @@ -4460,7 +4460,6 @@ static void achannel_setting_slider_nla_curve_cb(bContext *C, PropertyRNA *prop; int index; - Depsgraph *depsgraph = CTX_data_depsgraph(C); ReportList *reports = CTX_wm_reports(C); Scene *scene = CTX_data_scene(C); ToolSettings *ts = scene->toolsettings; @@ -4485,8 +4484,7 @@ static void achannel_setting_slider_nla_curve_cb(bContext *C, } /* insert a keyframe for this F-Curve */ - done = insert_keyframe_direct( - depsgraph, reports, ptr, prop, fcu, cfra, ts->keyframe_type, NULL, flag); + done = insert_keyframe_direct(reports, ptr, prop, fcu, cfra, ts->keyframe_type, NULL, flag); if (done) { WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 2e7ed7eae34..40b193f501e 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -721,23 +721,12 @@ static short new_key_needed(FCurve *fcu, float cFrame, float nValue) /* ------------------ RNA Data-Access Functions ------------------ */ /* Try to read value using RNA-properties obtained already */ -static float *setting_get_rna_values(Depsgraph *depsgraph, - PointerRNA *ptr, - PropertyRNA *prop, - const bool get_evaluated, - float *buffer, - int buffer_size, - int *r_count) +static float *setting_get_rna_values( + PointerRNA *ptr, PropertyRNA *prop, float *buffer, int buffer_size, int *r_count) { BLI_assert(buffer_size >= 1); float *values = buffer; - PointerRNA ptr_eval; - - if (get_evaluated) { - DEG_get_evaluated_rna_pointer(depsgraph, ptr, &ptr_eval); - ptr = &ptr_eval; - } if (RNA_property_array_check(prop)) { int length = *r_count = RNA_property_array_length(ptr, prop); @@ -977,12 +966,8 @@ static bool visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop) * In the event that it is not possible to perform visual keying, try to fall-back * to using the default method. Assumes that all data it has been passed is valid. */ -static float *visualkey_get_values(Depsgraph *depsgraph, - PointerRNA *ptr, - PropertyRNA *prop, - float *buffer, - int buffer_size, - int *r_count) +static float *visualkey_get_values( + PointerRNA *ptr, PropertyRNA *prop, float *buffer, int buffer_size, int *r_count) { BLI_assert(buffer_size >= 4); @@ -999,27 +984,21 @@ static float *visualkey_get_values(Depsgraph *depsgraph, */ if (ptr->type == &RNA_Object) { Object *ob = (Object *)ptr->data; - const Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); - /* Loc code is specific... */ if (strstr(identifier, "location")) { - copy_v3_v3(buffer, ob_eval->obmat[3]); + copy_v3_v3(buffer, ob->obmat[3]); *r_count = 3; return buffer; } - copy_m4_m4(tmat, ob_eval->obmat); - rotmode = ob_eval->rotmode; + copy_m4_m4(tmat, ob->obmat); + rotmode = ob->rotmode; } else if (ptr->type == &RNA_PoseBone) { - Object *ob = (Object *)ptr->id.data; bPoseChannel *pchan = (bPoseChannel *)ptr->data; - const Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); - bPoseChannel *pchan_eval = BKE_pose_channel_find_name(ob_eval->pose, pchan->name); - - BKE_armature_mat_pose_to_bone(pchan_eval, pchan_eval->pose_mat, tmat); - rotmode = pchan_eval->rotmode; + BKE_armature_mat_pose_to_bone(pchan, pchan->pose_mat, tmat); + rotmode = pchan->rotmode; /* Loc code is specific... */ if (strstr(identifier, "location")) { @@ -1032,7 +1011,7 @@ static float *visualkey_get_values(Depsgraph *depsgraph, } } else { - return setting_get_rna_values(depsgraph, ptr, prop, true, buffer, buffer_size, r_count); + return setting_get_rna_values(ptr, prop, buffer, buffer_size, r_count); } /* Rot/Scale code are common! */ @@ -1066,7 +1045,7 @@ static float *visualkey_get_values(Depsgraph *depsgraph, } /* as the function hasn't returned yet, read value from system in the default way */ - return setting_get_rna_values(depsgraph, ptr, prop, true, buffer, buffer_size, r_count); + return setting_get_rna_values(ptr, prop, buffer, buffer_size, r_count); } /* ------------------------- Insert Key API ------------------------- */ @@ -1075,8 +1054,7 @@ static float *visualkey_get_values(Depsgraph *depsgraph, * Retrieve current property values to keyframe, * possibly applying NLA correction when necessary. */ -static float *get_keyframe_values(Depsgraph *depsgraph, - ReportList *reports, +static float *get_keyframe_values(ReportList *reports, PointerRNA ptr, PropertyRNA *prop, int index, @@ -1094,11 +1072,11 @@ static float *get_keyframe_values(Depsgraph *depsgraph, * it works by keyframing using a value extracted from the final matrix * instead of using the kt system to extract a value. */ - values = visualkey_get_values(depsgraph, &ptr, prop, buffer, buffer_size, r_count); + values = visualkey_get_values(&ptr, prop, buffer, buffer_size, r_count); } else { /* read value from system */ - values = setting_get_rna_values(depsgraph, &ptr, prop, false, buffer, buffer_size, r_count); + values = setting_get_rna_values(&ptr, prop, buffer, buffer_size, r_count); } /* adjust the value for NLA factors */ @@ -1207,8 +1185,7 @@ static bool insert_keyframe_value(ReportList *reports, * the keyframe insertion. These include the 'visual' keyframing modes, quick refresh, * and extra keyframe filtering. */ -bool insert_keyframe_direct(Depsgraph *depsgraph, - ReportList *reports, +bool insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, @@ -1261,8 +1238,7 @@ bool insert_keyframe_direct(Depsgraph *depsgraph, int value_count; int index = fcu->array_index; - float *values = get_keyframe_values(depsgraph, - reports, + float *values = get_keyframe_values(reports, ptr, prop, index, @@ -1416,8 +1392,7 @@ short insert_keyframe(Main *bmain, int value_count; bool force_all; - float *values = get_keyframe_values(depsgraph, - reports, + float *values = get_keyframe_values(reports, ptr, prop, array_index, @@ -2407,7 +2382,7 @@ static int insert_key_button_exec(bContext *C, wmOperator *op) if (fcu) { success = insert_keyframe_direct( - depsgraph, op->reports, ptr, prop, fcu, cfra, ts->keyframe_type, NULL, 0); + op->reports, ptr, prop, fcu, cfra, ts->keyframe_type, NULL, 0); } else { BKE_report(op->reports, @@ -2423,15 +2398,8 @@ static int insert_key_button_exec(bContext *C, wmOperator *op) fcu = rna_get_fcurve_context_ui(C, &ptr, prop, index, NULL, NULL, &driven, &special); if (fcu && driven) { - success = insert_keyframe_direct(depsgraph, - op->reports, - ptr, - prop, - fcu, - cfra, - ts->keyframe_type, - NULL, - INSERTKEY_DRIVER); + success = insert_keyframe_direct( + op->reports, ptr, prop, fcu, cfra, ts->keyframe_type, NULL, INSERTKEY_DRIVER); } } else { @@ -2794,8 +2762,7 @@ bool fcurve_is_changed(PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, float fra float buffer[RNA_MAX_ARRAY_LENGTH]; int count, index = fcu->array_index; - float *values = setting_get_rna_values( - NULL, &ptr, prop, false, buffer, RNA_MAX_ARRAY_LENGTH, &count); + float *values = setting_get_rna_values(&ptr, prop, buffer, RNA_MAX_ARRAY_LENGTH, &count); float fcurve_val = calculate_fcurve(&anim_rna, fcu, frame); float cur_val = (index >= 0 && index < count) ? values[index] : 0.0f; diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c index 087d8540b03..3543a370bd0 100644 --- a/source/blender/editors/gpencil/gpencil_convert.c +++ b/source/blender/editors/gpencil/gpencil_convert.c @@ -387,8 +387,7 @@ static void gp_stroke_path_animation_preprocess_gaps(tGpTimingData *gtd, } } -static void gp_stroke_path_animation_add_keyframes(Depsgraph *depsgraph, - ReportList *reports, +static void gp_stroke_path_animation_add_keyframes(ReportList *reports, PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, @@ -446,7 +445,7 @@ static void gp_stroke_path_animation_add_keyframes(Depsgraph *depsgraph, cfra = last_valid_time + MIN_TIME_DELTA; } insert_keyframe_direct( - depsgraph, reports, ptr, prop, fcu, cfra, BEZT_KEYTYPE_KEYFRAME, NULL, INSERTKEY_FAST); + reports, ptr, prop, fcu, cfra, BEZT_KEYTYPE_KEYFRAME, NULL, INSERTKEY_FAST); last_valid_time = cfra; } else if (G.debug & G_DEBUG) { @@ -459,7 +458,7 @@ static void gp_stroke_path_animation_add_keyframes(Depsgraph *depsgraph, cfra = last_valid_time + MIN_TIME_DELTA; } insert_keyframe_direct( - depsgraph, reports, ptr, prop, fcu, cfra, BEZT_KEYTYPE_KEYFRAME, NULL, INSERTKEY_FAST); + reports, ptr, prop, fcu, cfra, BEZT_KEYTYPE_KEYFRAME, NULL, INSERTKEY_FAST); last_valid_time = cfra; } else { @@ -467,15 +466,8 @@ static void gp_stroke_path_animation_add_keyframes(Depsgraph *depsgraph, * and also far enough from (not yet added!) end_stroke keyframe! */ if ((cfra - last_valid_time) > MIN_TIME_DELTA && (end_stroke_time - cfra) > MIN_TIME_DELTA) { - insert_keyframe_direct(depsgraph, - reports, - ptr, - prop, - fcu, - cfra, - BEZT_KEYTYPE_BREAKDOWN, - NULL, - INSERTKEY_FAST); + insert_keyframe_direct( + reports, ptr, prop, fcu, cfra, BEZT_KEYTYPE_BREAKDOWN, NULL, INSERTKEY_FAST); last_valid_time = cfra; } else if (G.debug & G_DEBUG) { @@ -493,7 +485,6 @@ static void gp_stroke_path_animation(bContext *C, Curve *cu, tGpTimingData *gtd) { - Depsgraph *depsgraph = CTX_data_depsgraph(C); Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); bAction *act; @@ -538,7 +529,7 @@ static void gp_stroke_path_animation(bContext *C, cu->ctime = 0.0f; cfra = (float)gtd->start_frame; insert_keyframe_direct( - depsgraph, reports, ptr, prop, fcu, cfra, BEZT_KEYTYPE_KEYFRAME, NULL, INSERTKEY_FAST); + reports, ptr, prop, fcu, cfra, BEZT_KEYTYPE_KEYFRAME, NULL, INSERTKEY_FAST); cu->ctime = cu->pathlen; if (gtd->realtime) { @@ -548,7 +539,7 @@ static void gp_stroke_path_animation(bContext *C, cfra = (float)gtd->end_frame; } insert_keyframe_direct( - depsgraph, reports, ptr, prop, fcu, cfra, BEZT_KEYTYPE_KEYFRAME, NULL, INSERTKEY_FAST); + reports, ptr, prop, fcu, cfra, BEZT_KEYTYPE_KEYFRAME, NULL, INSERTKEY_FAST); } else { /* Use actual recorded timing! */ @@ -575,7 +566,7 @@ static void gp_stroke_path_animation(bContext *C, } gp_stroke_path_animation_add_keyframes( - depsgraph, reports, ptr, prop, fcu, cu, gtd, rng, time_range, nbr_gaps, tot_gaps_time); + reports, ptr, prop, fcu, cu, gtd, rng, time_range, nbr_gaps, tot_gaps_time); BLI_rng_free(rng); } diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index a893f03bd88..9851988edd4 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -113,8 +113,7 @@ int insert_vert_fcurve( * Use this to insert a keyframe using the current value being keyframed, in the * nominated F-Curve (no creation of animation data performed). Returns success. */ -bool insert_keyframe_direct(struct Depsgraph *depsgraph, - struct ReportList *reports, +bool insert_keyframe_direct(struct ReportList *reports, struct PointerRNA ptr, struct PropertyRNA *prop, struct FCurve *fcu, diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index 5ff200fa7e4..f1ff23d4108 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -286,12 +286,11 @@ void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra) if (special) { /* NLA Strip property */ if (IS_AUTOKEY_ON(scene)) { - Depsgraph *depsgraph = CTX_data_depsgraph(C); ReportList *reports = CTX_wm_reports(C); ToolSettings *ts = scene->toolsettings; insert_keyframe_direct( - depsgraph, reports, but->rnapoin, but->rnaprop, fcu, cfra, ts->keyframe_type, NULL, 0); + reports, but->rnapoin, but->rnaprop, fcu, cfra, ts->keyframe_type, NULL, 0); WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); } } @@ -300,12 +299,10 @@ void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra) * making it easier to set up corrective drivers */ if (IS_AUTOKEY_ON(scene)) { - Depsgraph *depsgraph = CTX_data_depsgraph(C); ReportList *reports = CTX_wm_reports(C); ToolSettings *ts = scene->toolsettings; - insert_keyframe_direct(depsgraph, - reports, + insert_keyframe_direct(reports, but->rnapoin, but->rnaprop, fcu, diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c index 710ae0433e0..7aa69ab1543 100644 --- a/source/blender/python/intern/bpy_rna_anim.c +++ b/source/blender/python/intern/bpy_rna_anim.c @@ -337,7 +337,6 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb * strips themselves. These are stored separately or else the properties will * not have any effect. */ - struct Depsgraph *depsgraph = CTX_data_depsgraph(BPy_GetContext()); ReportList reports; short result = 0; @@ -357,8 +356,7 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb NlaStrip *strip = (NlaStrip *)ptr.data; FCurve *fcu = list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), index); - result = insert_keyframe_direct( - depsgraph, &reports, ptr, prop, fcu, cfra, keytype, NULL, options); + result = insert_keyframe_direct(&reports, ptr, prop, fcu, cfra, keytype, NULL, options); } else { BKE_reportf(&reports, RPT_ERROR, "Could not resolve path (%s)", path_full); |