Fix T81380: Playback set start/endframe operators can set negative
rendering range The Allow Negative Frames option, introduced in rB21a2350248fd, allows for negative frames, but this should only apply for playback and animations, the rendering range should still be clamped to MINFRAME / MAXFRAME, because rendering does not allow for negative frames. Preview range should not be affected afaict (I am not aware of operators that allow for rendering this range). Maniphest Tasks: T81380 Differential Revision: https://developer.blender.org/D9112
This commit is contained in:
parent
8bce181b71
commit
ca38bce46a
Notes:
blender-bot
2023-02-13 23:17:13 +01:00
Referenced by issue #93332, Unable to set the Start Frame to a negative value Referenced by issue #87798, Playback and animations can NOT occur during negative frame ranges. Referenced by issue #81534, "Allow negative frames" does not allow entering negative start-/end frame Referenced by issue #81380, Playback set start/end operators can set rendering range fields to negative frames Referenced by issue #81286, Negative frames not being played in current project
|
@ -35,6 +35,7 @@
|
|||
#include "BKE_context.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_sequencer.h"
|
||||
|
||||
|
@ -299,7 +300,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 +316,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 +355,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 +371,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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue