diff options
author | Andrea Weikert <elubie@gmx.net> | 2009-11-08 18:03:10 +0300 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2009-11-08 18:03:10 +0300 |
commit | 9e90cf6d78419d19751802a1b6046bb89b35f1ee (patch) | |
tree | e05d7be83224052a4add0ed051c7a5aaf91c8d5d /source/blender | |
parent | af011f33a6975d4a0176bf84027695462552e5b2 (diff) |
Sequencer: (small Durian wish)
* new operator: set rendersize (SEQUENCE_OT_rendersize) sets the render output size in the current scene to the size of the active sequence strip
* works for movies and images right now
* TODO: currently only works if image or movie strip has been loaded (as in showing the preview for example) - reason is that otherwise the size is not initialized in the strip
Diffstat (limited to 'source/blender')
3 files changed, 51 insertions, 0 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index a5e89b4023a..bf7d0e78c92 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2669,3 +2669,52 @@ void SEQUENCER_OT_swap_left(wmOperatorType *ot) /* properties */ } + +static int sequencer_rendersize_exec(bContext *C, wmOperator *op) +{ + int retval = OPERATOR_CANCELLED; + Scene *scene= CTX_data_scene(C); + Sequence *active_seq = get_last_seq(scene); + + if(active_seq==NULL) return OPERATOR_CANCELLED; + + printf("got active sequence\n"); + switch (active_seq->type) { + case SEQ_IMAGE: + case SEQ_MOVIE: + if (active_seq->strip) { + // prevent setting the render size if sequence values aren't initialized + if ( (active_seq->strip->orx>0) && (active_seq->strip->ory>0) ) { + scene->r.xsch= active_seq->strip->orx; + scene->r.ysch= active_seq->strip->ory; + WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene); + retval = OPERATOR_FINISHED; + } + } + break; + case SEQ_SCENE: + case SEQ_META: + case SEQ_RAM_SOUND: + case SEQ_HD_SOUND: + default: + break; + } + return retval; +} + +void SEQUENCER_OT_rendersize(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Set Render Size"; + ot->idname= "SEQUENCER_OT_rendersize"; + ot->description="Set render size and aspect from active sequence."; + + /* api callbacks */ + ot->exec= sequencer_rendersize_exec; + ot->poll= ED_operator_sequencer_active; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + /* properties */ +}
\ No newline at end of file diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index 0a8208fcc2e..82b24deae63 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -95,6 +95,7 @@ void SEQUENCER_OT_previous_edit(struct wmOperatorType *ot); void SEQUENCER_OT_next_edit(struct wmOperatorType *ot); void SEQUENCER_OT_swap_right(struct wmOperatorType *ot); void SEQUENCER_OT_swap_left(struct wmOperatorType *ot); +void SEQUENCER_OT_rendersize(struct wmOperatorType *ot); void SEQUENCER_OT_view_all(struct wmOperatorType *ot); void SEQUENCER_OT_view_selected(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c index 90342fc62b5..3e2f05f2901 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -81,6 +81,7 @@ void sequencer_operatortypes(void) WM_operatortype_append(SEQUENCER_OT_previous_edit); WM_operatortype_append(SEQUENCER_OT_swap_right); WM_operatortype_append(SEQUENCER_OT_swap_left); + WM_operatortype_append(SEQUENCER_OT_rendersize); WM_operatortype_append(SEQUENCER_OT_view_all); WM_operatortype_append(SEQUENCER_OT_view_selected); |