Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaikon Araujo <Nokiam>2017-11-28 01:33:08 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2017-11-29 20:11:36 +0300
commit4b4702ab8af6f74edc20ba6735d74f61aa15ce47 (patch)
tree521f4ab1e83633b26dc9e467c25fe2cc4fa0f02e
parent4f7280da404c5054da4061335fee1dac24d9c812 (diff)
Sequencer: add many more color blend modes, and a new color mix strip.
Differential Revision: https://developer.blender.org/D2872
-rw-r--r--release/scripts/startup/bl_ui/space_sequencer.py13
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c300
-rw-r--r--source/blender/blenkernel/intern/sequencer.c1
-rw-r--r--source/blender/blenloader/intern/writefile.c3
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c1
-rw-r--r--source/blender/makesdna/DNA_sequence_types.h30
-rw-r--r--source/blender/makesrna/RNA_access.h1
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c65
-rw-r--r--source/blender/makesrna/intern/rna_sequencer_api.c1
10 files changed, 412 insertions, 5 deletions
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
index 106e6695553..94924106542 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -361,6 +361,7 @@ class SEQUENCER_MT_add_effect(Menu):
layout.operator("sequencer.effect_strip_add", text="Wipe").type = 'WIPE'
layout.operator("sequencer.effect_strip_add", text="Glow").type = 'GLOW'
layout.operator("sequencer.effect_strip_add", text="Text").type = 'TEXT'
+ layout.operator("sequencer.effect_strip_add", text="Color Mix").type = 'COLORMIX'
layout.operator("sequencer.effect_strip_add", text="Transform").type = 'TRANSFORM'
layout.operator("sequencer.effect_strip_add", text="Color").type = 'COLOR'
layout.operator("sequencer.effect_strip_add", text="Speed Control").type = 'SPEED'
@@ -602,7 +603,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', 'SPEED',
- 'MULTICAM', 'GAUSSIAN_BLUR', 'TEXT',
+ 'MULTICAM', 'GAUSSIAN_BLUR', 'TEXT', 'COLORMIX'
}
def draw(self, context):
@@ -750,6 +751,12 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
row = col.row(align=True)
row.prop(strip, "size_x")
row.prop(strip, "size_y")
+ elif strip.type == 'COLORMIX':
+ split = layout.split(percentage=0.35)
+ split.label(text="Blend Mode:")
+ split.prop(strip, "blend_effect", text="")
+ row = layout.row(align=True)
+ row.prop(strip, "factor", slider=True)
class SEQUENCER_PT_input(SequencerButtonsPanel, Panel):
@@ -770,7 +777,7 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, Panel):
'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
- 'MULTICAM', 'SPEED', 'ADJUSTMENT',
+ 'MULTICAM', 'SPEED', 'ADJUSTMENT', 'COLORMIX'
}
def draw(self, context):
@@ -1009,7 +1016,7 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel):
'META', 'ADD', 'SUBTRACT', 'ALPHA_OVER',
'ALPHA_UNDER', 'CROSS', 'GAMMA_CROSS', 'MULTIPLY',
'OVER_DROP', 'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
- 'MULTICAM', 'SPEED', 'ADJUSTMENT',
+ 'MULTICAM', 'SPEED', 'ADJUSTMENT', 'COLORMIX'
}
def draw(self, context):
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index a2c45057bf7..df21512a262 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -53,6 +53,8 @@
#include "IMB_imbuf.h"
#include "IMB_colormanagement.h"
+#include "BLI_math_color_blend.h"
+
#include "RNA_access.h"
#include "RE_pipeline.h"
@@ -1266,6 +1268,274 @@ static void do_mul_effect(const SeqRenderData *context, Sequence *UNUSED(seq), f
}
}
+/*********************** Blend Mode ***************************************/
+typedef void (*IMB_blend_func_byte)(unsigned char *dst, const unsigned char *src1, const unsigned char *src2);
+typedef void (*IMB_blend_func_float)(float *dst, const float *src1, const float *src2);
+
+BLI_INLINE void apply_blend_function_byte(float facf0, float facf1, int x, int y, unsigned char *rect1, unsigned char *rect2, unsigned char *out, IMB_blend_func_byte blend_function)
+{
+ int xo;
+ unsigned char *rt1, *rt2, *rt;
+ unsigned int achannel;
+ xo = x;
+ rt1 = rect1;
+ rt2 = rect2;
+ rt = out;
+ while (y--) {
+ for (x = xo; x > 0; x--) {
+ achannel = rt2[3];
+ rt2[3] = (unsigned int) achannel * facf0;
+ blend_function(rt, rt1, rt2);
+ rt2[3] = achannel;
+ rt[3] = rt2[3];
+ rt1 += 4;
+ rt2 += 4;
+ rt += 4;
+ }
+ if (y == 0) {
+ break;
+ }
+ y--;
+ for (x = xo; x > 0; x--) {
+ achannel = rt2[3];
+ rt2[3] = (unsigned int) achannel * facf1;
+ blend_function(rt, rt1, rt2);
+ rt2[3] = achannel;
+ rt[3] = rt2[3];
+ rt1 += 4;
+ rt2 += 4;
+ rt += 4;
+ }
+ }
+}
+
+BLI_INLINE void apply_blend_function_float(float facf0, float facf1, int x, int y, float *rect1, float *rect2, float *out, IMB_blend_func_float blend_function)
+{
+ int xo;
+ float *rt1, *rt2, *rt;
+ float achannel;
+ xo = x;
+ rt1 = rect1;
+ rt2 = rect2;
+ rt = out;
+ while (y--) {
+ for (x = xo; x > 0; x--) {
+ achannel = rt2[3];
+ rt2[3] = achannel * facf0;
+ blend_function(rt, rt1, rt2);
+ rt2[3] = achannel;
+ rt[3] = rt2[3];
+ rt1 += 4;
+ rt2 += 4;
+ rt += 4;
+ }
+ if (y == 0) {
+ break;
+ }
+ y--;
+ for (x = xo; x > 0; x--) {
+ achannel = rt2[3];
+ rt2[3] = achannel * facf1;
+ blend_function(rt, rt1, rt2);
+ rt2[3] = achannel;
+ rt[3] = rt2[3];
+ rt1 += 4;
+ rt2 += 4;
+ rt += 4;
+ }
+ }
+}
+
+static void do_blend_effect_float(float facf0, float facf1, int x, int y, float *rect1, float *rect2, int btype, float *out)
+{
+ switch (btype) {
+ case SEQ_TYPE_ADD:
+ apply_blend_function_float(facf0, facf1, x, y, rect1, rect2, out, blend_color_add_float);
+ break;
+ case SEQ_TYPE_SUB:
+ apply_blend_function_float(facf0, facf1, x, y, rect1, rect2, out, blend_color_sub_float);
+ break;
+ case SEQ_TYPE_MUL:
+ apply_blend_function_float(facf0, facf1, x, y, rect1, rect2, out, blend_color_mul_float);
+ break;
+ case SEQ_TYPE_DARKEN:
+ apply_blend_function_float(facf0, facf1, x, y, rect1, rect2, out, blend_color_darken_float);
+ break;
+ case SEQ_TYPE_BURN:
+ apply_blend_function_float(facf0, facf1, x, y, rect1, rect2, out, blend_color_burn_float);
+ break;
+ case SEQ_TYPE_LINEAR_BURN:
+ apply_blend_function_float(facf0, facf1, x, y, rect1, rect2, out, blend_color_linearburn_float);
+ break;
+ case SEQ_TYPE_SCREEN:
+ apply_blend_function_float(facf0, facf1, x, y, rect1, rect2, out, blend_color_screen_float);
+ break;
+ case SEQ_TYPE_LIGHTEN:
+ apply_blend_function_float(facf0, facf1, x, y, rect1, rect2, out, blend_color_lighten_float);
+ break;
+ case SEQ_TYPE_DODGE:
+ apply_blend_function_float(facf0, facf1, x, y, rect1, rect2, out, blend_color_dodge_float);
+ break;
+ case SEQ_TYPE_OVERLAY:
+ apply_blend_function_float(facf0, facf1, x, y, rect1, rect2, out, blend_color_overlay_float);
+ break;
+ case SEQ_TYPE_SOFT_LIGHT:
+ apply_blend_function_float(facf0, facf1, x, y, rect1, rect2, out, blend_color_softlight_float);
+ break;
+ case SEQ_TYPE_HARD_LIGHT:
+ apply_blend_function_float(facf0, facf1, x, y, rect1, rect2, out, blend_color_hardlight_float);
+ break;
+ case SEQ_TYPE_PIN_LIGHT:
+ apply_blend_function_float(facf0, facf1, x, y, rect1, rect2, out, blend_color_pinlight_float);
+ break;
+ case SEQ_TYPE_LIN_LIGHT:
+ apply_blend_function_float(facf0, facf1, x, y, rect1, rect2, out, blend_color_linearlight_float);
+ break;
+ case SEQ_TYPE_VIVID_LIGHT:
+ apply_blend_function_float(facf0, facf1, x, y, rect1, rect2, out, blend_color_vividlight_float);
+ break;
+ case SEQ_TYPE_BLEND_COLOR:
+ apply_blend_function_float(facf0, facf1, x, y, rect1, rect2, out, blend_color_color_float);
+ break;
+ case SEQ_TYPE_HUE:
+ apply_blend_function_float(facf0, facf1, x, y, rect1, rect2, out, blend_color_hue_float);
+ break;
+ case SEQ_TYPE_SATURATION:
+ apply_blend_function_float(facf0, facf1, x, y, rect1, rect2, out, blend_color_saturation_float);
+ break;
+ case SEQ_TYPE_VALUE:
+ apply_blend_function_float(facf0, facf1, x, y, rect1, rect2, out, blend_color_luminosity_float);
+ break;
+ case SEQ_TYPE_DIFFERENCE:
+ apply_blend_function_float(facf0, facf1, x, y, rect1, rect2, out, blend_color_difference_float);
+ break;
+ case SEQ_TYPE_EXCLUSION:
+ apply_blend_function_float(facf0, facf1, x, y, rect1, rect2, out, blend_color_exclusion_float);
+ break;
+ default:
+ break;
+ }
+}
+
+static void do_blend_effect_byte(float facf0, float facf1, int x, int y, unsigned char *rect1, unsigned char *rect2, int btype, unsigned char *out)
+{
+ switch (btype) {
+ case SEQ_TYPE_ADD:
+ apply_blend_function_byte(facf0, facf1, x, y, rect1, rect2, out, blend_color_add_byte);
+ break;
+ case SEQ_TYPE_SUB:
+ apply_blend_function_byte(facf0, facf1, x, y, rect1, rect2, out, blend_color_sub_byte);
+ break;
+ case SEQ_TYPE_MUL:
+ apply_blend_function_byte(facf0, facf1, x, y, rect1, rect2, out, blend_color_mul_byte);
+ break;
+ case SEQ_TYPE_DARKEN:
+ apply_blend_function_byte(facf0, facf1, x, y, rect1, rect2, out, blend_color_darken_byte);
+ break;
+ case SEQ_TYPE_BURN:
+ apply_blend_function_byte(facf0, facf1, x, y, rect1, rect2, out, blend_color_burn_byte);
+ break;
+ case SEQ_TYPE_LINEAR_BURN:
+ apply_blend_function_byte(facf0, facf1, x, y, rect1, rect2, out, blend_color_linearburn_byte);
+ break;
+ case SEQ_TYPE_SCREEN:
+ apply_blend_function_byte(facf0, facf1, x, y, rect1, rect2, out, blend_color_screen_byte);
+ break;
+ case SEQ_TYPE_LIGHTEN:
+ apply_blend_function_byte(facf0, facf1, x, y, rect1, rect2, out, blend_color_lighten_byte);
+ break;
+ case SEQ_TYPE_DODGE:
+ apply_blend_function_byte(facf0, facf1, x, y, rect1, rect2, out, blend_color_dodge_byte);
+ break;
+ case SEQ_TYPE_OVERLAY:
+ apply_blend_function_byte(facf0, facf1, x, y, rect1, rect2, out, blend_color_overlay_byte);
+ break;
+ case SEQ_TYPE_SOFT_LIGHT:
+ apply_blend_function_byte(facf0, facf1, x, y, rect1, rect2, out, blend_color_softlight_byte);
+ break;
+ case SEQ_TYPE_HARD_LIGHT:
+ apply_blend_function_byte(facf0, facf1, x, y, rect1, rect2, out, blend_color_hardlight_byte);
+ break;
+ case SEQ_TYPE_PIN_LIGHT:
+ apply_blend_function_byte(facf0, facf1, x, y, rect1, rect2, out, blend_color_pinlight_byte);
+ break;
+ case SEQ_TYPE_LIN_LIGHT:
+ apply_blend_function_byte(facf0, facf1, x, y, rect1, rect2, out, blend_color_linearlight_byte);
+ break;
+ case SEQ_TYPE_VIVID_LIGHT:
+ apply_blend_function_byte(facf0, facf1, x, y, rect1, rect2, out, blend_color_vividlight_byte);
+ break;
+ case SEQ_TYPE_BLEND_COLOR:
+ apply_blend_function_byte(facf0, facf1, x, y, rect1, rect2, out, blend_color_color_byte);
+ break;
+ case SEQ_TYPE_HUE:
+ apply_blend_function_byte(facf0, facf1, x, y, rect1, rect2, out, blend_color_hue_byte);
+ break;
+ case SEQ_TYPE_SATURATION:
+ apply_blend_function_byte(facf0, facf1, x, y, rect1, rect2, out, blend_color_saturation_byte);
+ break;
+ case SEQ_TYPE_VALUE:
+ apply_blend_function_byte(facf0, facf1, x, y, rect1, rect2, out, blend_color_luminosity_byte);
+ break;
+ case SEQ_TYPE_DIFFERENCE:
+ apply_blend_function_byte(facf0, facf1, x, y, rect1, rect2, out, blend_color_difference_byte);
+ break;
+ case SEQ_TYPE_EXCLUSION:
+ apply_blend_function_byte(facf0, facf1, x, y, rect1, rect2, out, blend_color_exclusion_byte);
+ break;
+ default:
+ break;
+ }
+}
+
+static void do_blend_mode_effect(const SeqRenderData *context, Sequence *seq, float UNUSED(cfra), float facf0, float facf1,
+ ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *UNUSED(ibuf3), int start_line, int total_lines, ImBuf *out)
+{
+ if (out->rect_float) {
+ float *rect1 = NULL, *rect2 = NULL, *rect_out = NULL;
+ slice_get_float_buffers(context, ibuf1, ibuf2, NULL, out, start_line, &rect1, &rect2, NULL, &rect_out);
+ do_blend_effect_float(facf0, facf1, context->rectx, total_lines, rect1, rect2, seq->blend_mode, rect_out);
+ }
+ else {
+ unsigned char *rect1 = NULL, *rect2 = NULL, *rect_out = NULL;
+ slice_get_byte_buffers(context, ibuf1, ibuf2, NULL, out, start_line, &rect1, &rect2, NULL, &rect_out);
+ do_blend_effect_byte(facf0, facf1, context->rectx, total_lines, rect1, rect2, seq->blend_mode, rect_out);
+ }
+}
+/*********************** Color Mix Effect *************************/
+static void init_colormix_effect(Sequence *seq)
+{
+ ColorMixVars *data;
+
+ if (seq->effectdata){
+ MEM_freeN(seq->effectdata);
+ }
+ seq->effectdata = MEM_callocN(sizeof(ColorMixVars), "colormixvars");
+ data = (ColorMixVars *) seq->effectdata;
+ data->blend_effect = SEQ_TYPE_OVERLAY;
+ data->factor = 1.0f;
+}
+
+static void do_colormix_effect(const SeqRenderData *context, Sequence *seq, float UNUSED(cfra), float UNUSED(facf0), float UNUSED(facf1),
+ ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *UNUSED(ibuf3), int start_line, int total_lines, ImBuf *out)
+{
+ float facf;
+
+ ColorMixVars *data = seq->effectdata;
+ facf = data->factor;
+
+ if (out->rect_float) {
+ float *rect1 = NULL, *rect2 = NULL, *rect_out = NULL;
+ slice_get_float_buffers(context, ibuf1, ibuf2, NULL, out, start_line, &rect1, &rect2, NULL, &rect_out);
+ do_blend_effect_float(facf, facf, context->rectx, total_lines, rect1, rect2, data->blend_effect, rect_out);
+ }
+ else {
+ unsigned char *rect1 = NULL, *rect2 = NULL, *rect_out = NULL;
+ slice_get_byte_buffers(context, ibuf1, ibuf2, NULL, out, start_line, &rect1, &rect2, NULL, &rect_out);
+ do_blend_effect_byte(facf, facf, context->rectx, total_lines, rect1, rect2, data->blend_effect, rect_out);
+ }
+}
+
/*********************** Wipe *************************/
typedef struct WipeZone {
@@ -3336,6 +3606,36 @@ static struct SeqEffectHandle get_sequence_effect_impl(int seq_type)
rval.execute_slice = do_mul_effect;
rval.early_out = early_out_mul_input2;
break;
+ case SEQ_TYPE_SCREEN:
+ case SEQ_TYPE_OVERLAY:
+ case SEQ_TYPE_BURN:
+ case SEQ_TYPE_LINEAR_BURN:
+ case SEQ_TYPE_DARKEN:
+ case SEQ_TYPE_LIGHTEN:
+ case SEQ_TYPE_DODGE:
+ case SEQ_TYPE_SOFT_LIGHT:
+ case SEQ_TYPE_HARD_LIGHT:
+ case SEQ_TYPE_PIN_LIGHT:
+ case SEQ_TYPE_LIN_LIGHT:
+ case SEQ_TYPE_VIVID_LIGHT:
+ case SEQ_TYPE_BLEND_COLOR:
+ case SEQ_TYPE_HUE:
+ case SEQ_TYPE_SATURATION:
+ case SEQ_TYPE_VALUE:
+ case SEQ_TYPE_DIFFERENCE:
+ case SEQ_TYPE_EXCLUSION:
+ rval.multithreaded = true;
+ rval.execute_slice = do_blend_mode_effect;
+ rval.early_out = early_out_mul_input2;
+ break;
+ case SEQ_TYPE_COLORMIX:
+ rval.multithreaded = true;
+ rval.init = init_colormix_effect;
+ rval.free = free_effect_default;
+ rval.copy = copy_effect_default;
+ rval.execute_slice = do_colormix_effect;
+ rval.early_out = early_out_mul_input2;
+ break;
case SEQ_TYPE_ALPHAOVER:
rval.multithreaded = true;
rval.init = init_alpha_over_or_under;
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 9e8e202c2bc..5f631621dcd 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -1160,6 +1160,7 @@ static const char *give_seqname_by_type(int type)
case SEQ_TYPE_ALPHAOVER: return "Alpha Over";
case SEQ_TYPE_ALPHAUNDER: return "Alpha Under";
case SEQ_TYPE_OVERDROP: return "Over Drop";
+ case SEQ_TYPE_COLORMIX: return "Color Mix";
case SEQ_TYPE_WIPE: return "Wipe";
case SEQ_TYPE_GLOW: return "Glow";
case SEQ_TYPE_TRANSFORM: return "Transform";
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 2648ebdc395..d7d2dd529f9 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2637,6 +2637,9 @@ static void write_scene(WriteData *wd, Scene *sce)
case SEQ_TYPE_TEXT:
writestruct(wd, DATA, TextVars, 1, seq->effectdata);
break;
+ case SEQ_TYPE_COLORMIX:
+ writestruct(wd, DATA, ColorMixVars, 1, seq->effectdata);
+ break;
}
}
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index bb7e2d75482..14661e2f44f 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -156,6 +156,7 @@ void color3ubv_from_seq(Scene *curscene, Sequence *seq, unsigned char col[3])
case SEQ_TYPE_MULTICAM:
case SEQ_TYPE_ADJUSTMENT:
case SEQ_TYPE_GAUSSIAN_BLUR:
+ case SEQ_TYPE_COLORMIX:
UI_GetThemeColor3ubv(TH_SEQ_EFFECT, col);
/* slightly offset hue to distinguish different effects */
@@ -170,6 +171,7 @@ void color3ubv_from_seq(Scene *curscene, Sequence *seq, unsigned char col[3])
else if (seq->type == SEQ_TYPE_MULTICAM) rgb_byte_set_hue_float_offset(col, 0.32);
else if (seq->type == SEQ_TYPE_ADJUSTMENT) rgb_byte_set_hue_float_offset(col, 0.40);
else if (seq->type == SEQ_TYPE_GAUSSIAN_BLUR) rgb_byte_set_hue_float_offset(col, 0.42);
+ else if (seq->type == SEQ_TYPE_COLORMIX) rgb_byte_set_hue_float_offset(col, 0.46);
break;
case SEQ_TYPE_COLOR:
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index f0c67ac3294..0d1cc5d4552 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -95,6 +95,7 @@ EnumPropertyItem sequencer_prop_effect_types[] = {
{SEQ_TYPE_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""},
{SEQ_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", ""},
{SEQ_TYPE_TEXT, "TEXT", 0, "Text", ""},
+ {SEQ_TYPE_COLORMIX, "COLORMIX", 0, "Color Mix", ""},
{0, NULL, 0, NULL, NULL}
};
diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h
index 74a1a13c2eb..b7e118d2053 100644
--- a/source/blender/makesdna/DNA_sequence_types.h
+++ b/source/blender/makesdna/DNA_sequence_types.h
@@ -301,6 +301,11 @@ enum {
SEQ_TEXT_ALIGN_Y_BOTTOM = 2,
};
+typedef struct ColorMixVars {
+ int blend_effect; /* value from SEQ_TYPE_XXX enumeration */
+ float factor; /* blend factor [0.0f, 1.0f] */
+} ColorMixVars;
+
/* ***************** Sequence modifiers ****************** */
typedef struct SequenceModifierData {
@@ -516,8 +521,29 @@ enum {
SEQ_TYPE_ADJUSTMENT = 31,
SEQ_TYPE_GAUSSIAN_BLUR = 40,
SEQ_TYPE_TEXT = 41,
-
- SEQ_TYPE_MAX = 41
+ SEQ_TYPE_COLORMIX = 42,
+
+ /* Blend modes */
+ SEQ_TYPE_SCREEN = 43,
+ SEQ_TYPE_LIGHTEN = 44,
+ SEQ_TYPE_DODGE = 45,
+ SEQ_TYPE_DARKEN = 46,
+ SEQ_TYPE_BURN = 47,
+ SEQ_TYPE_LINEAR_BURN = 48,
+ SEQ_TYPE_OVERLAY = 49,
+ SEQ_TYPE_HARD_LIGHT = 50,
+ SEQ_TYPE_SOFT_LIGHT = 51,
+ SEQ_TYPE_PIN_LIGHT = 52,
+ SEQ_TYPE_LIN_LIGHT = 53,
+ SEQ_TYPE_VIVID_LIGHT = 54,
+ SEQ_TYPE_HUE = 55,
+ SEQ_TYPE_SATURATION = 56,
+ SEQ_TYPE_VALUE = 57,
+ SEQ_TYPE_BLEND_COLOR = 58,
+ SEQ_TYPE_DIFFERENCE = 59,
+ SEQ_TYPE_EXCLUSION = 60,
+
+ SEQ_TYPE_MAX = 60
};
#define SEQ_MOVIECLIP_RENDER_UNDISTORTED (1 << 0)
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index c497de3dee5..97fd216b5f5 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -117,6 +117,7 @@ extern StructRNA RNA_ColorManagedViewSettings;
extern StructRNA RNA_ColorRamp;
extern StructRNA RNA_ColorRampElement;
extern StructRNA RNA_ColorSequence;
+extern StructRNA RNA_ColorMixSequence;
extern StructRNA RNA_CompositorNode;
extern StructRNA RNA_CompositorNodeAlphaOver;
extern StructRNA RNA_CompositorNodeBilateralblur;
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index fbc29039539..61ac81a6d1c 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -550,6 +550,8 @@ static StructRNA *rna_Sequence_refine(struct PointerRNA *ptr)
return &RNA_GaussianBlurSequence;
case SEQ_TYPE_TEXT:
return &RNA_TextSequence;
+ case SEQ_TYPE_COLORMIX:
+ return &RNA_ColorMixSequence;
default:
return &RNA_Sequence;
}
@@ -1338,6 +1340,24 @@ static const EnumPropertyItem blend_mode_items[] = {
{SEQ_TYPE_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""},
{SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""},
{SEQ_TYPE_OVERDROP, "OVER_DROP", 0, "Over Drop", ""},
+ {SEQ_TYPE_LIGHTEN, "LIGHTEN", 0, "Lighten", ""},
+ {SEQ_TYPE_DARKEN, "DARKEN", 0, "Darken", ""},
+ {SEQ_TYPE_SCREEN, "SCREEN", 0, "Screen", ""},
+ {SEQ_TYPE_OVERLAY, "OVERLAY", 0, "Overlay", ""},
+ {SEQ_TYPE_DODGE, "DODGE", 0, "Dodge", ""},
+ {SEQ_TYPE_BURN, "BURN", 0, "Burn", ""},
+ {SEQ_TYPE_LINEAR_BURN, "LINEAR_BURN", 0, "Linear Burn", ""},
+ {SEQ_TYPE_SOFT_LIGHT, "SOFT_LIGHT", 0, "Soft Light", ""},
+ {SEQ_TYPE_HARD_LIGHT, "HARD_LIGHT", 0, "Hard Light", ""},
+ {SEQ_TYPE_PIN_LIGHT, "PIN_LIGHT", 0, "Pin Light", ""},
+ {SEQ_TYPE_LIN_LIGHT, "LINEAR_LIGHT", 0, "Linear Light", ""},
+ {SEQ_TYPE_VIVID_LIGHT, "VIVID_LIGHT", 0, "Vivid Light", ""},
+ {SEQ_TYPE_BLEND_COLOR, "COLOR", 0, "Color", ""},
+ {SEQ_TYPE_HUE, "HUE", 0, "Hue", ""},
+ {SEQ_TYPE_SATURATION, "SATURATION", 0, "Saturation", ""},
+ {SEQ_TYPE_VALUE, "VALUE", 0, "Value", ""},
+ {SEQ_TYPE_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""},
+ {SEQ_TYPE_EXCLUSION, "EXCLUSION", 0, "Exclusion", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -1411,6 +1431,7 @@ static void rna_def_sequence(BlenderRNA *brna)
{SEQ_TYPE_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""},
{SEQ_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", ""},
{SEQ_TYPE_TEXT, "TEXT", 0, "Text", ""},
+ {SEQ_TYPE_COLORMIX, "COLORMIX", 0, "Color Mix", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -2378,6 +2399,49 @@ static void rna_def_text(StructRNA *srna)
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
}
+static void rna_def_color_mix(StructRNA *srna)
+{
+ static EnumPropertyItem blend_color_items[] = {
+ {SEQ_TYPE_ADD, "ADD", 0, "Add", ""},
+ {SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""},
+ {SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""},
+ {SEQ_TYPE_LIGHTEN, "LIGHTEN", 0, "Lighten", ""},
+ {SEQ_TYPE_DARKEN, "DARKEN", 0, "Darken", ""},
+ {SEQ_TYPE_SCREEN, "SCREEN", 0, "Screen", ""},
+ {SEQ_TYPE_OVERLAY, "OVERLAY", 0, "Overlay", ""},
+ {SEQ_TYPE_DODGE, "DODGE", 0, "Dodge", ""},
+ {SEQ_TYPE_BURN, "BURN", 0, "Burn", ""},
+ {SEQ_TYPE_LINEAR_BURN, "LINEAR_BURN", 0, "Linear Burn", ""},
+ {SEQ_TYPE_SOFT_LIGHT, "SOFT_LIGHT", 0, "Soft Light", ""},
+ {SEQ_TYPE_HARD_LIGHT, "HARD_LIGHT", 0, "Hard Light", ""},
+ {SEQ_TYPE_PIN_LIGHT, "PIN_LIGHT", 0, "Pin Light", ""},
+ {SEQ_TYPE_LIN_LIGHT, "LINEAR_LIGHT", 0, "Linear Light", ""},
+ {SEQ_TYPE_VIVID_LIGHT, "VIVID_LIGHT", 0, "Vivid Light", ""},
+ {SEQ_TYPE_BLEND_COLOR, "COLOR", 0, "Color", ""},
+ {SEQ_TYPE_HUE, "HUE", 0, "Hue", ""},
+ {SEQ_TYPE_SATURATION, "SATURATION", 0, "Saturation", ""},
+ {SEQ_TYPE_VALUE, "VALUE", 0, "Value", ""},
+ {SEQ_TYPE_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""},
+ {SEQ_TYPE_EXCLUSION, "EXCLUSION", 0, "Exclusion", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "ColorMixVars", "effectdata");
+
+ prop = RNA_def_property(srna, "blend_effect", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "blend_effect");
+ RNA_def_property_enum_items(prop, blend_color_items);
+ RNA_def_property_ui_text(prop, "Blend Effect", "Method for controlling how the strip combines with other strips");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Blend Factor", "Percentage of how much the strip's colors affect other strips");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+}
+
static EffectInfo def_effects[] = {
{"AddSequence", "Add Sequence", "Add Sequence", NULL, 2},
{"AdjustmentSequence", "Adjustment Layer Sequence",
@@ -2404,6 +2468,7 @@ static EffectInfo def_effects[] = {
rna_def_gaussian_blur, 1},
{"TextSequence", "Text Sequence", "Sequence strip creating text",
rna_def_text, 0},
+ {"ColorMixSequence", "Color Mix Sequence", "Color Mix Sequence", rna_def_color_mix, 2},
{"", "", "", NULL, 0}
};
diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c
index e1d3f3958a5..d447d2972f6 100644
--- a/source/blender/makesrna/intern/rna_sequencer_api.c
+++ b/source/blender/makesrna/intern/rna_sequencer_api.c
@@ -475,6 +475,7 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop)
{SEQ_TYPE_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""},
{SEQ_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", ""},
{SEQ_TYPE_TEXT, "TEXT", 0, "Text", ""},
+ {SEQ_TYPE_COLORMIX, "COLORMIX", 0, "Color Mix", ""},
{0, NULL, 0, NULL, NULL}
};