Revision: 33366
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33366
Author:   schlaile
Date:     2010-11-28 19:23:21 +0100 (Sun, 28 Nov 2010)

Log Message:
-----------
== 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.

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

Modified: trunk/blender/release/scripts/ui/space_sequencer.py
===================================================================
--- trunk/blender/release/scripts/ui/space_sequencer.py 2010-11-28 18:22:23 UTC 
(rev 33365)
+++ trunk/blender/release/scripts/ui/space_sequencer.py 2010-11-28 18:23:21 UTC 
(rev 33366)
@@ -384,10 +384,18 @@
 
         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):
     bl_label = "Effect Strip"
 

Modified: trunk/blender/source/blender/blenkernel/intern/sequencer.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/sequencer.c  2010-11-28 
18:22:23 UTC (rev 33365)
+++ trunk/blender/source/blender/blenkernel/intern/sequencer.c  2010-11-28 
18:23:21 UTC (rev 33366)
@@ -1558,9 +1558,6 @@
 {
        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 @@
                                        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 @@
                                /* 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;

Modified: trunk/blender/source/blender/editors/space_sequencer/sequencer_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_sequencer/sequencer_edit.c       
2010-11-28 18:22:23 UTC (rev 33365)
+++ trunk/blender/source/blender/editors/space_sequencer/sequencer_edit.c       
2010-11-28 18:23:21 UTC (rev 33366)
@@ -2561,18 +2561,15 @@
        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 @@
                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;
 }
 

Modified: trunk/blender/source/blender/makesdna/DNA_sequence_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_sequence_types.h  2010-11-28 
18:22:23 UTC (rev 33365)
+++ trunk/blender/source/blender/makesdna/DNA_sequence_types.h  2010-11-28 
18:23:21 UTC (rev 33366)
@@ -42,6 +42,7 @@
 
 typedef struct StripElem {
        char name[80];
+       int orig_width, orig_height;
 } StripElem;
 
 typedef struct StripCrop {
@@ -81,7 +82,6 @@
        int startstill, endstill;
        StripElem *stripdata;
        char dir[160];
-       int orx, ory;
        StripProxy *proxy;
        StripCrop *crop;
        StripTransform *transform;

Modified: trunk/blender/source/blender/makesrna/intern/rna_sequencer.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_sequencer.c        
2010-11-28 18:22:23 UTC (rev 33365)
+++ trunk/blender/source/blender/makesrna/intern/rna_sequencer.c        
2010-11-28 18:23:21 UTC (rev 33366)
@@ -180,19 +180,6 @@
        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 @@
        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 @@
        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 @@
        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",


_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to