Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/animation/anim_ops.c
| Show All 29 Lines | |||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "DNA_anim_types.h" | #include "DNA_anim_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_report.h" | |||||
| #include "BKE_scene.h" | #include "BKE_scene.h" | ||||
| #include "BKE_sequencer.h" | #include "BKE_sequencer.h" | ||||
| #include "UI_view2d.h" | #include "UI_view2d.h" | ||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "RNA_define.h" | #include "RNA_define.h" | ||||
| ▲ Show 20 Lines • Show All 248 Lines • ▼ Show 20 Lines | if (ELEM(area->spacetype, SPACE_ACTION, SPACE_GRAPH, SPACE_NLA, SPACE_SEQ, SPACE_CLIP)) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| CTX_wm_operator_poll_msg_set(C, "Expected an animation area to be active"); | CTX_wm_operator_poll_msg_set(C, "Expected an animation area to be active"); | ||||
| return false; | 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); | Scene *scene = CTX_data_scene(C); | ||||
| int frame; | int frame; | ||||
| if (scene == NULL) { | if (scene == NULL) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| frame = CFRA; | frame = CFRA; | ||||
| /* if Preview Range is defined, set the 'start' frame for that */ | /* if Preview Range is defined, set the 'start' frame for that */ | ||||
| if (PRVRANGEON) { | if (PRVRANGEON) { | ||||
| scene->r.psfra = frame; | scene->r.psfra = frame; | ||||
| } | } | ||||
| else { | 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, "Startframe clamped to valid rendering range"); | |||||
brecht: Startframe -> Start frame | |||||
| } | |||||
| frame = frame_clamped; | |||||
| scene->r.sfra = frame; | scene->r.sfra = frame; | ||||
| } | } | ||||
| if (PEFRA < frame) { | if (PEFRA < frame) { | ||||
| if (PRVRANGEON) { | if (PRVRANGEON) { | ||||
| scene->r.pefra = frame; | scene->r.pefra = frame; | ||||
| } | } | ||||
| else { | else { | ||||
| Show All 16 Lines | static void ANIM_OT_start_frame_set(wmOperatorType *ot) | ||||
| /* api callbacks */ | /* api callbacks */ | ||||
| ot->exec = anim_set_sfra_exec; | ot->exec = anim_set_sfra_exec; | ||||
| ot->poll = anim_set_end_frames_poll; | ot->poll = anim_set_end_frames_poll; | ||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | 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); | Scene *scene = CTX_data_scene(C); | ||||
| int frame; | int frame; | ||||
| if (scene == NULL) { | if (scene == NULL) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| frame = CFRA; | frame = CFRA; | ||||
| /* if Preview Range is defined, set the 'end' frame for that */ | /* if Preview Range is defined, set the 'end' frame for that */ | ||||
| if (PRVRANGEON) { | if (PRVRANGEON) { | ||||
| scene->r.pefra = frame; | scene->r.pefra = frame; | ||||
| } | } | ||||
| else { | 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, "Endframe clamped to valid rendering range"); | |||||
brechtUnsubmitted Not Done Inline ActionsEndframe -> End frame brecht: Endframe -> End frame | |||||
| } | |||||
| frame = frame_clamped; | |||||
| scene->r.efra = frame; | scene->r.efra = frame; | ||||
| } | } | ||||
| if (PSFRA > frame) { | if (PSFRA > frame) { | ||||
| if (PRVRANGEON) { | if (PRVRANGEON) { | ||||
| scene->r.psfra = frame; | scene->r.psfra = frame; | ||||
| } | } | ||||
| else { | else { | ||||
| ▲ Show 20 Lines • Show All 173 Lines • Show Last 20 Lines | |||||
Startframe -> Start frame