diff options
author | Peter Schlaile <peter@schlaile.de> | 2010-11-28 21:23:21 +0300 |
---|---|---|
committer | Peter Schlaile <peter@schlaile.de> | 2010-11-28 21:23:21 +0300 |
commit | 510920a299478cdd50ce8ce4ff43d14eb4e2c2e4 (patch) | |
tree | 9b71b0e3e8c3ab5a746cc2f018c73541237c0893 | |
parent | 3f6eb67b7718e329a482d71d2340989ee0a15e76 (diff) |
== Sequencer ==
This fixes Orig Dimension display (mostly).
* orx, ory both didn't get calculated, if dimension already matched
* putting them into Strip instead of StripData ment, that using images
of different dimensions in one strip could lead to incorrect results
Still TODO: on file open, timeline display happens before preview
display which means: orig_width and height are calculated after the
first draw of N-keys dialog. You have to hit refresh (or scrub one
frame) to get the right values displayed.
-rw-r--r-- | release/scripts/ui/space_sequencer.py | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 11 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_edit.c | 29 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_sequence_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sequencer.c | 38 |
5 files changed, 52 insertions, 40 deletions
diff --git a/release/scripts/ui/space_sequencer.py b/release/scripts/ui/space_sequencer.py index 5f283491491..c709483a08b 100644 --- a/release/scripts/ui/space_sequencer.py +++ b/release/scripts/ui/space_sequencer.py @@ -384,8 +384,16 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, bpy.types.Panel): col.label(text="Frame Offset %d:%d" % (strip.frame_offset_start, strip.frame_offset_end)) col.label(text="Frame Still %d:%d" % (strip.frame_still_start, strip.frame_still_end)) - if strip.type in ('MOVIE', 'IMAGE'): - col.label(text="Orig Dim: %dx%d" % (strip.orig_width, strip.orig_height)) + + elem = False + + if strip.type == 'IMAGE': + elem = strip.getStripElem(frame_current) + elif strip.type == 'MOVIE': + elem = strip.elements[0] + + if elem and elem.orig_width > 0 and elem.orig_height > 0: + col.label(text="Orig Dim: %dx%d" % (elem.orig_width, elem.orig_height)) class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel): diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index b98976729c4..9eafb3fb3e3 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1558,9 +1558,6 @@ static ImBuf * input_preprocess( { float mul; - seq->strip->orx= ibuf->x; - seq->strip->ory= ibuf->y; - if((seq->flag & SEQ_FILTERY) && seq->type != SEQ_MOVIE) { IMB_filtery(ibuf); } @@ -2054,6 +2051,9 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr IMB_convert_profile(ibuf, IB_PROFILE_NONE); copy_to_ibuf_still(context, seq, nr, ibuf); + + s_elem->orig_width = ibuf->x; + s_elem->orig_height = ibuf->y; } break; } @@ -2073,7 +2073,10 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr /* we don't need both (speed reasons)! */ if (ibuf && ibuf->rect_float && ibuf->rect) imb_freerectImBuf(ibuf); - + if (ibuf) { + seq->strip->stripdata->orig_width = ibuf->x; + seq->strip->stripdata->orig_height = ibuf->y; + } } copy_to_ibuf_still(context, seq, nr, ibuf); break; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 9d67cc2366c..f264e90194f 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2561,18 +2561,15 @@ static int sequencer_rendersize_exec(bContext *C, wmOperator *UNUSED(op)) if(active_seq==NULL) return OPERATOR_CANCELLED; - switch (active_seq->type) { + StripElem * se = 0; + + if (active_seq->strip) { + switch (active_seq->type) { case SEQ_IMAGE: + se = give_stripelem(active_seq, scene->r.cfra); + break; 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; - } - } + se = active_seq->strip->stripdata; break; case SEQ_SCENE: case SEQ_META: @@ -2580,7 +2577,19 @@ static int sequencer_rendersize_exec(bContext *C, wmOperator *UNUSED(op)) case SEQ_HD_SOUND: default: break; + } } + + if (se) { + // prevent setting the render size if sequence values aren't initialized + if ( (se->orig_width > 0) && (se->orig_height > 0) ) { + scene->r.xsch= se->orig_width; + scene->r.ysch= se->orig_height; + WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene); + retval = OPERATOR_FINISHED; + } + } + return retval; } diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index d51dec97351..9303394f149 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -42,6 +42,7 @@ struct bSound; typedef struct StripElem { char name[80]; + int orig_width, orig_height; } StripElem; typedef struct StripCrop { @@ -81,7 +82,6 @@ typedef struct Strip { int startstill, endstill; StripElem *stripdata; char dir[160]; - int orx, ory; StripProxy *proxy; StripCrop *crop; StripTransform *transform; diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index f56440d9c13..958adad86e3 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -180,19 +180,6 @@ static int rna_Sequence_frame_length_get(PointerRNA *ptr) return seq_tx_get_final_right(seq, 0)-seq_tx_get_final_left(seq, 0); } -static int rna_Sequence_orx_get(PointerRNA *ptr) -{ - Sequence *seq= (Sequence*)ptr->data; - return seq->strip->orx; -} - -static int rna_Sequence_ory_get(PointerRNA *ptr) -{ - Sequence *seq= (Sequence*)ptr->data; - return seq->strip->ory; -} - - static void rna_Sequence_channel_set(PointerRNA *ptr, int value) { Sequence *seq= (Sequence*)ptr->data; @@ -679,6 +666,16 @@ static void rna_def_strip_element(BlenderRNA *brna) RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_ui_text(prop, "Filename", ""); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); + + prop= RNA_def_property(srna, "orig_width", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "orig_width"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Orig Width", "Original image width"); + + prop= RNA_def_property(srna, "orig_height", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "orig_height"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Orig Height", "Original image height"); } static void rna_def_strip_crop(BlenderRNA *brna) @@ -1200,16 +1197,6 @@ static void rna_def_input(StructRNA *srna) RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_anim_endofs_final_set", NULL); // overlap tests RNA_def_property_ui_text(prop, "Animation End Offset", "Animation end offset (trim end)"); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); - - prop= RNA_def_property(srna, "orig_width", PROP_INT, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Orig Width", "Original image width"); - RNA_def_property_int_funcs(prop, "rna_Sequence_orx_get", NULL,NULL); - - prop= RNA_def_property(srna, "orig_height", PROP_INT, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Orig Height", "Original image height"); - RNA_def_property_int_funcs(prop, "rna_Sequence_ory_get", NULL,NULL); } static void rna_def_image(BlenderRNA *brna) @@ -1295,6 +1282,11 @@ static void rna_def_movie(BlenderRNA *brna) RNA_def_property_ui_text(prop, "MPEG Preseek", "For MPEG movies, preseek this many frames"); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); + prop= RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "strip->stripdata", "strip->len"); + RNA_def_property_struct_type(prop, "SequenceElement"); + RNA_def_property_ui_text(prop, "Elements", ""); + prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); RNA_def_property_ui_text(prop, "File", ""); RNA_def_property_string_funcs(prop, "rna_Sequence_filepath_get", "rna_Sequence_filepath_length", |