== Sequencer ==
authorPeter Schlaile <peter@schlaile.de>
Sun, 28 Nov 2010 18:23:21 +0000 (18:23 +0000)
committerPeter Schlaile <peter@schlaile.de>
Sun, 28 Nov 2010 18:23:21 +0000 (18:23 +0000)
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.

release/scripts/ui/space_sequencer.py
source/blender/blenkernel/intern/sequencer.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/makesdna/DNA_sequence_types.h
source/blender/makesrna/intern/rna_sequencer.c

index 5f2834914916fbfabe052ddb601d305b3738ce0b..c709483a08b5c328e6e98b485237c01cd9d547f4 100644 (file)
@@ -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):
index b98976729c4c382de46739125675f6d830350c30..9eafb3fb3e378396578ea907cd2f7c9960f179d2 100644 (file)
@@ -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;
index 9d67cc2366c92beb98d391ddb476a9b11939d1d4..f264e90194f0ae3ef4f76850db9c4957dc1f0fb8 100644 (file)
@@ -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;
 }
 
index d51dec97351933fd1377d99b50559d0779ff2d67..9303394f1498028746f5bc6eef98533feec13c92 100644 (file)
@@ -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;
index f56440d9c139db5d5c422faebbd96616a28530cf..958adad86e36562bf8a426d37bcf339edab05f3f 100644 (file)
@@ -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",