Move the set start/end frame operators from Timeline to Animation module
Eventually the idea is that they'll get remapped to some more global/generic hotkey that can get used across all animation editors (see T54728). However, to facilitate the removal of the timeline editor, it's better we do this now.
This commit is contained in:
parent
91b1b35bba
commit
0f77060ebc
|
@ -205,8 +205,8 @@ class TIME_MT_frame(Menu):
|
|||
layout.operator("anim.previewrange_clear")
|
||||
layout.operator("anim.previewrange_set")
|
||||
layout.separator()
|
||||
layout.operator("time.end_frame_set")
|
||||
layout.operator("time.start_frame_set")
|
||||
layout.operator("anim.end_frame_set")
|
||||
layout.operator("anim.start_frame_set")
|
||||
|
||||
layout.separator()
|
||||
|
||||
|
|
|
@ -276,6 +276,96 @@ static void ANIM_OT_change_frame(wmOperatorType *ot)
|
|||
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
||||
}
|
||||
|
||||
|
||||
/* ****************** Start/End Frame Operators *******************************/
|
||||
|
||||
static int anim_set_sfra_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
int frame;
|
||||
|
||||
if (scene == NULL)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
frame = CFRA;
|
||||
|
||||
/* if Preview Range is defined, set the 'start' frame for that */
|
||||
if (PRVRANGEON)
|
||||
scene->r.psfra = frame;
|
||||
else
|
||||
scene->r.sfra = frame;
|
||||
|
||||
if (PEFRA < frame) {
|
||||
if (PRVRANGEON)
|
||||
scene->r.pefra = frame;
|
||||
else
|
||||
scene->r.efra = frame;
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void ANIM_OT_start_frame_set(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Set Start Frame";
|
||||
ot->idname = "anim_OT_start_frame_set";
|
||||
ot->description = "Set the start frame";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = anim_set_sfra_exec;
|
||||
ot->poll = ED_operator_timeline_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
|
||||
static int anim_set_efra_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
int frame;
|
||||
|
||||
if (scene == NULL)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
frame = CFRA;
|
||||
|
||||
/* if Preview Range is defined, set the 'end' frame for that */
|
||||
if (PRVRANGEON)
|
||||
scene->r.pefra = frame;
|
||||
else
|
||||
scene->r.efra = frame;
|
||||
|
||||
if (PSFRA > frame) {
|
||||
if (PRVRANGEON)
|
||||
scene->r.psfra = frame;
|
||||
else
|
||||
scene->r.sfra = frame;
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void ANIM_OT_end_frame_set(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Set End Frame";
|
||||
ot->idname = "anim_OT_end_frame_set";
|
||||
ot->description = "Set the end frame";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = anim_set_efra_exec;
|
||||
ot->poll = ED_operator_timeline_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/* ****************** set preview range operator ****************************/
|
||||
|
||||
static int previewrange_define_exec(bContext *C, wmOperator *op)
|
||||
|
@ -383,6 +473,9 @@ void ED_operatortypes_anim(void)
|
|||
/* Animation Editors only -------------------------- */
|
||||
WM_operatortype_append(ANIM_OT_change_frame);
|
||||
|
||||
WM_operatortype_append(ANIM_OT_start_frame_set);
|
||||
WM_operatortype_append(ANIM_OT_end_frame_set);
|
||||
|
||||
WM_operatortype_append(ANIM_OT_previewrange_set);
|
||||
WM_operatortype_append(ANIM_OT_previewrange_clear);
|
||||
|
||||
|
|
|
@ -47,93 +47,6 @@
|
|||
|
||||
#include "time_intern.h"
|
||||
|
||||
/* ****************** Start/End Frame Operators *******************************/
|
||||
static int time_set_sfra_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
int frame;
|
||||
|
||||
if (scene == NULL)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
frame = CFRA;
|
||||
|
||||
/* if Preview Range is defined, set the 'start' frame for that */
|
||||
if (PRVRANGEON)
|
||||
scene->r.psfra = frame;
|
||||
else
|
||||
scene->r.sfra = frame;
|
||||
|
||||
if (PEFRA < frame) {
|
||||
if (PRVRANGEON)
|
||||
scene->r.pefra = frame;
|
||||
else
|
||||
scene->r.efra = frame;
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void TIME_OT_start_frame_set(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Set Start Frame";
|
||||
ot->idname = "TIME_OT_start_frame_set";
|
||||
ot->description = "Set the start frame";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = time_set_sfra_exec;
|
||||
ot->poll = ED_operator_timeline_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
|
||||
static int time_set_efra_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
int frame;
|
||||
|
||||
if (scene == NULL)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
frame = CFRA;
|
||||
|
||||
/* if Preview Range is defined, set the 'end' frame for that */
|
||||
if (PRVRANGEON)
|
||||
scene->r.pefra = frame;
|
||||
else
|
||||
scene->r.efra = frame;
|
||||
|
||||
if (PSFRA > frame) {
|
||||
if (PRVRANGEON)
|
||||
scene->r.psfra = frame;
|
||||
else
|
||||
scene->r.sfra = frame;
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void TIME_OT_end_frame_set(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Set End Frame";
|
||||
ot->idname = "TIME_OT_end_frame_set";
|
||||
ot->description = "Set the end frame";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = time_set_efra_exec;
|
||||
ot->poll = ED_operator_timeline_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/* ************************ View All Operator *******************************/
|
||||
|
||||
|
@ -206,8 +119,6 @@ static void TIME_OT_view_frame(wmOperatorType *ot)
|
|||
|
||||
void time_operatortypes(void)
|
||||
{
|
||||
WM_operatortype_append(TIME_OT_start_frame_set);
|
||||
WM_operatortype_append(TIME_OT_end_frame_set);
|
||||
WM_operatortype_append(TIME_OT_view_all);
|
||||
WM_operatortype_append(TIME_OT_view_frame);
|
||||
}
|
||||
|
@ -216,8 +127,8 @@ void time_keymap(wmKeyConfig *keyconf)
|
|||
{
|
||||
wmKeyMap *keymap = WM_keymap_find(keyconf, "Timeline", SPACE_TIME, 0);
|
||||
|
||||
WM_keymap_add_item(keymap, "TIME_OT_start_frame_set", SKEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "TIME_OT_end_frame_set", EKEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "ANIM_OT_start_frame_set", SKEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "ANIM_OT_end_frame_set", EKEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "TIME_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
|
||||
#ifdef WITH_INPUT_NDOF
|
||||
WM_keymap_add_item(keymap, "TIME_OT_view_all", NDOF_BUTTON_FIT, KM_PRESS, 0, 0);
|
||||
|
|
Loading…
Reference in New Issue