- saturation option for sequencer strips, runs before multiply and color balance.
authorCampbell Barton <ideasman42@gmail.com>
Tue, 13 Jul 2010 09:28:01 +0000 (09:28 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 13 Jul 2010 09:28:01 +0000 (09:28 +0000)
- multiply of 0.0 wasnt being applied.

release/scripts/ui/space_sequencer.py
source/blender/blenkernel/intern/sequencer.c
source/blender/blenloader/intern/readfile.c
source/blender/makesdna/DNA_sequence_types.h
source/blender/makesrna/intern/rna_sequencer.c
source/blender/makesrna/rna_cleanup/rna_properties.txt

index 11f542ce5be5a22e1047de99044c2a1975a89809..a41b5fe5262ab83c21d9de693b48e464ba19e001 100644 (file)
@@ -745,6 +745,7 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel):
 
         col = layout.column()
         col.label(text="Colors:")
+        col.prop(strip, "color_saturation", text="Saturation")
         col.prop(strip, "multiply_colors", text="Multiply")
         col.prop(strip, "premultiply")
         col.prop(strip, "convert_float")
index 1ab4e75ee06a89cd9b9f035480fc220c9bb0ca2d..69dd4b3a1b737783bb0c79058c49363287d1cdc1 100644 (file)
@@ -1769,12 +1769,31 @@ static void input_preprocess(Scene *scene, Sequence *seq, TStripElem *se, int cf
        if(seq->flag & SEQ_FLIPX) {
                IMB_flipx(se->ibuf);
        }
-       if(seq->flag & SEQ_FLIPY) {
-               IMB_flipy(se->ibuf);
-       }
 
-       if(seq->mul == 0.0) {
-               seq->mul = 1.0;
+       if(seq->sat != 1.0f) {
+               /* inline for now, could become an imbuf function */
+               int i;
+               char *rct= (char *)se->ibuf->rect;
+               float *rctf= se->ibuf->rect_float;
+               const float sat= seq->sat;
+               float hsv[3];
+
+               if(rct) {
+                       float rgb[3];
+                       for (i = se->ibuf->x * se->ibuf->y; i > 0; i--, rct+=4) {
+                               rgb_byte_to_float(rct, rgb);
+                               rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+                               hsv_to_rgb(hsv[0], hsv[1] * sat, hsv[2], rgb, rgb+1, rgb+2);
+                               rgb_float_to_byte(rgb, rct);
+                       }
+               }
+
+               if(rctf) {
+                       for (i = se->ibuf->x * se->ibuf->y; i > 0; i--, rctf+=4) {
+                               rgb_to_hsv(rctf[0], rctf[1], rctf[2], hsv, hsv+1, hsv+2);
+                               hsv_to_rgb(hsv[0], hsv[1] * sat, hsv[2], rctf, rctf+1, rctf+2);
+                       }
+               }
        }
 
        mul = seq->mul;
index 31627141235d25499989924b255dc23f90593374..4309163fe7a5226f032c8c062f2e7476f7049fe1 100644 (file)
@@ -10953,6 +10953,15 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                tex->saturation= 1.0f;
                }
 
+               for (scene= main->scene.first; scene; scene=scene->id.next) {
+                       if(scene) {
+                               Sequence *seq;
+                               SEQ_BEGIN(scene->ed, seq) {
+                                       seq->sat= 1.0f;
+                               }
+                               SEQ_END
+                       }
+               }
        }
 
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
index 3ab7cb73d5629ac2df7ba703731c22995392060e..a5299ef081d02137b9191ce68d1cdad795084673 100644 (file)
@@ -140,6 +140,7 @@ typedef struct Sequence {
        int startstill, endstill;
        int machine, depth; /*machine - the strip channel, depth - the depth in the sequence when dealing with metastrips */
        int startdisp, enddisp; /*starting and ending points in the sequence*/
+       float sat, pad;
        float mul, handsize;
                                        /* is sfra needed anymore? - it looks like its only used in one place */
        int sfra;               /* starting frame according to the timeline of the scene. */
index 9e00dc26008e4f100ba8d2bb43b858dca2cc2f42..f46efb675ca9b05043338f0e779b5a016078c55e 100644 (file)
@@ -992,6 +992,13 @@ static void rna_def_filter_video(StructRNA *srna)
        RNA_def_property_ui_text(prop, "Multiply Colors", "");
        RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
+       prop= RNA_def_property(srna, "color_saturation", PROP_FLOAT, PROP_UNSIGNED);
+       RNA_def_property_float_sdna(prop, NULL, "sat");
+       RNA_def_property_range(prop, 0.0f, 20.0f);
+       RNA_def_property_ui_range(prop, 0.0f, 2.0f, 3, 3);
+       RNA_def_property_ui_text(prop, "Saturation", "");
+       RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
+
        prop= RNA_def_property(srna, "strobe", PROP_FLOAT, PROP_NONE);
        RNA_def_property_range(prop, 1.0f, 30.0f);
        RNA_def_property_ui_text(prop, "Strobe", "Only display every nth frame");
index e7ad37b0d72096374a4324ad5ee6f32d1d2f5b55..0c0b7e1070ba169505b9ad2fa797cf555c6137c7 100644 (file)
@@ -599,7 +599,7 @@ EditObjectActuator.time -> time:    int    Duration the new Object lives or the
 EditObjectActuator.track_object -> track_object:    pointer    Track to this Object
 EffectSequence.color_balance -> color_balance:    pointer, (read-only)    
 EffectSequence.crop -> crop:    pointer, (read-only)    
-EffectSequence.multiply_colors -> multiply_colors:    float    
+EffectSequence.multiply_colors -> color_multiply:    float    
 EffectSequence.proxy -> proxy:    pointer, (read-only)    
 EffectSequence.strobe -> strobe:    float    Only display every nth frame
 EffectSequence.transform -> transform:    pointer, (read-only)