diff options
Diffstat (limited to 'source/blender/editors/animation/anim_ops.c')
-rw-r--r-- | source/blender/editors/animation/anim_ops.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 40cd368e02b..9e622aea6ab 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -35,8 +35,8 @@ #include "BKE_context.h" #include "BKE_global.h" #include "BKE_main.h" +#include "BKE_report.h" #include "BKE_scene.h" -#include "BKE_sequencer.h" #include "UI_view2d.h" @@ -55,6 +55,8 @@ #include "DEG_depsgraph.h" #include "DEG_depsgraph_query.h" +#include "SEQ_sequencer.h" + #include "anim_intern.h" /* ********************** frame change operator ***************************/ @@ -299,7 +301,7 @@ static bool anim_set_end_frames_poll(bContext *C) return false; } -static int anim_set_sfra_exec(bContext *C, wmOperator *UNUSED(op)) +static int anim_set_sfra_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); int frame; @@ -315,6 +317,13 @@ static int anim_set_sfra_exec(bContext *C, wmOperator *UNUSED(op)) scene->r.psfra = frame; } else { + /* Clamping should be in sync with 'rna_Scene_start_frame_set()'. */ + int frame_clamped = frame; + CLAMP(frame_clamped, MINFRAME, MAXFRAME); + if (frame_clamped != frame) { + BKE_report(op->reports, RPT_WARNING, "Start frame clamped to valid rendering range"); + } + frame = frame_clamped; scene->r.sfra = frame; } @@ -347,7 +356,7 @@ static void ANIM_OT_start_frame_set(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -static int anim_set_efra_exec(bContext *C, wmOperator *UNUSED(op)) +static int anim_set_efra_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); int frame; @@ -363,6 +372,13 @@ static int anim_set_efra_exec(bContext *C, wmOperator *UNUSED(op)) scene->r.pefra = frame; } else { + /* Clamping should be in sync with 'rna_Scene_end_frame_set()'. */ + int frame_clamped = frame; + CLAMP(frame_clamped, MINFRAME, MAXFRAME); + if (frame_clamped != frame) { + BKE_report(op->reports, RPT_WARNING, "End frame clamped to valid rendering range"); + } + frame = frame_clamped; scene->r.efra = frame; } |