diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 1ca1da315b7..9090c5f77c6 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..c5a07e57d3e 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,285 @@ static void do_mul_effect(const SeqRenderData *context, Sequence *UNUSED(seq), f } } +/*********************** Blend Mode Functions Helpers *************************/ +/* Begining of float blend mode effects */ +#define DEFINE_BLEND_EFFECT_FUNCTION(fname,internal_name)\ +static void fname##_byte(float facf0, float facf1, int x, int y, unsigned char *rect1, unsigned char *rect2, unsigned char *out)\ +{\ + int xo;\ + unsigned char *rt1, *rt2, *rt;\ + unsigned int achannel;\ + xo = x;\ + rt1 = rect1;\ + rt2 = rect2;\ + rt = out;\ + while (y--) {\ + x = xo;\ + while (x--) {\ + achannel = rt2[3];\ + rt2[3] = (unsigned int) achannel * facf0;\ + internal_name##_byte(rt, rt1, rt2);\ + rt2[3] = achannel;\ + rt[3] = rt2[3];\ + rt1 += 4;\ + rt2 += 4;\ + rt += 4;\ + }\ + if (y == 0) {\ + break;\ + }\ + y--;\ + x = xo;\ + while (x--) {\ + achannel = rt2[3];\ + rt2[3] = (unsigned int) achannel * facf1;\ + internal_name##_byte(rt, rt1, rt2);\ + rt2[3] = achannel;\ + rt[3] = rt2[3];\ + rt1 += 4;\ + rt2 += 4;\ + rt += 4;\ + }\ + }\ +}\ +static void fname##_float(float facf0, float facf1, int x, int y, float *rect1, float *rect2, float *out)\ +{\ + int xo;\ + float *rt1, *rt2, *rt;\ + float achannel;\ + xo = x;\ + rt1 = rect1;\ + rt2 = rect2;\ + rt = out;\ + while (y--) {\ + x = xo;\ + while (x--) {\ + achannel = rt2[3];\ + rt2[3] = achannel * facf0;\ + internal_name##_float(rt, rt1, rt2);\ + rt2[3] = achannel;\ + rt[3] = rt2[3];\ + rt1 += 4;\ + rt2 += 4;\ + rt += 4;\ + }\ + if (y == 0) {\ + break;\ + }\ + y--;\ + x = xo;\ + while (x--) {\ + achannel = rt2[3];\ + rt2[3] = achannel * facf1;\ + internal_name##_float(rt, rt1, rt2);\ + rt2[3] = achannel;\ + rt[3] = rt2[3];\ + rt1 += 4;\ + rt2 += 4;\ + rt += 4;\ + }\ + }\ +} + +DEFINE_BLEND_EFFECT_FUNCTION(do_blend_add_effect, blend_color_add); +DEFINE_BLEND_EFFECT_FUNCTION(do_blend_sub_effect, blend_color_sub); +DEFINE_BLEND_EFFECT_FUNCTION(do_blend_mul_effect, blend_color_mul); +DEFINE_BLEND_EFFECT_FUNCTION(do_blend_darken_effect, blend_color_darken); +DEFINE_BLEND_EFFECT_FUNCTION(do_blend_burn_effect, blend_color_burn); +DEFINE_BLEND_EFFECT_FUNCTION(do_blend_linearburn_effect, blend_color_linearburn); +DEFINE_BLEND_EFFECT_FUNCTION(do_blend_screen_effect, blend_color_screen); +DEFINE_BLEND_EFFECT_FUNCTION(do_blend_lighten_effect, blend_color_lighten); +DEFINE_BLEND_EFFECT_FUNCTION(do_blend_dodge_effect, blend_color_dodge); +DEFINE_BLEND_EFFECT_FUNCTION(do_blend_overlay_effect, blend_color_overlay); +DEFINE_BLEND_EFFECT_FUNCTION(do_blend_softlight_effect, blend_color_softlight); +DEFINE_BLEND_EFFECT_FUNCTION(do_blend_hardlight_effect, blend_color_hardlight); +DEFINE_BLEND_EFFECT_FUNCTION(do_blend_pinlight_effect, blend_color_pinlight); +DEFINE_BLEND_EFFECT_FUNCTION(do_blend_linearlight_effect, blend_color_linearlight); +DEFINE_BLEND_EFFECT_FUNCTION(do_blend_vividlight_effect, blend_color_vividlight); +DEFINE_BLEND_EFFECT_FUNCTION(do_blend_color_effect, blend_color_color); +DEFINE_BLEND_EFFECT_FUNCTION(do_blend_hue_effect, blend_color_hue); +DEFINE_BLEND_EFFECT_FUNCTION(do_blend_saturation_effect, blend_color_saturation); +DEFINE_BLEND_EFFECT_FUNCTION(do_blend_value_effect, blend_color_luminosity); + +/*********************** Blend Modes *************************/ +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: + do_blend_add_effect_float(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_SUB: + do_blend_sub_effect_float(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_MUL: + do_blend_mul_effect_float(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_DARKEN: + do_blend_darken_effect_float(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_BURN: + do_blend_burn_effect_float(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_LINEAR_BURN: + do_blend_linearburn_effect_float(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_SCREEN: + do_blend_screen_effect_float(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_LIGHTEN: + do_blend_lighten_effect_float(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_DODGE: + do_blend_dodge_effect_float(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_OVERLAY: + do_blend_overlay_effect_float(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_SLIGHT: + do_blend_softlight_effect_float(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_HLIGHT: + do_blend_hardlight_effect_float(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_PIN_LIGHT: + do_blend_pinlight_effect_float(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_LIN_LIGHT: + do_blend_linearlight_effect_float(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_VIVID_LIGHT: + do_blend_vividlight_effect_float(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_BLEND_COLOR: + do_blend_color_effect_float(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_HUE: + do_blend_hue_effect_float(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_SATURATION: + do_blend_saturation_effect_float(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_VALUE: + do_blend_value_effect_float(facf0, facf1, x, y, rect1, rect2, out); + 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: + do_blend_add_effect_byte(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_SUB: + do_blend_sub_effect_byte(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_MUL: + do_blend_mul_effect_byte(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_DARKEN: + do_blend_darken_effect_byte(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_BURN: + do_blend_burn_effect_byte(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_LINEAR_BURN: + do_blend_linearburn_effect_byte(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_SCREEN: + do_blend_screen_effect_byte(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_LIGHTEN: + do_blend_lighten_effect_byte(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_DODGE: + do_blend_dodge_effect_byte(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_OVERLAY: + do_blend_overlay_effect_byte(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_SLIGHT: + do_blend_softlight_effect_byte(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_HLIGHT: + do_blend_hardlight_effect_byte(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_PIN_LIGHT: + do_blend_pinlight_effect_byte(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_LIN_LIGHT: + do_blend_linearlight_effect_byte(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_VIVID_LIGHT: + do_blend_vividlight_effect_byte(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_BLEND_COLOR: + do_blend_color_effect_byte(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_HUE: + do_blend_hue_effect_byte(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_SATURATION: + do_blend_saturation_effect_byte(facf0, facf1, x, y, rect1, rect2, out); + break; + case SEQ_TYPE_VALUE: + do_blend_value_effect_byte(facf0, facf1, x, y, rect1, rect2, out); + 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 +3617,34 @@ 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_SLIGHT: + case SEQ_TYPE_HLIGHT: + 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: + 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 9b0db300e6d..c5c4669046b 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/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 160aa157189..39badfed680 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -155,6 +155,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 */ @@ -169,6 +170,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..c7d9467a2a1 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; + float factor; +} 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, + /*Light Effects*/ + SEQ_TYPE_SCREEN = 43, + SEQ_TYPE_LIGHTEN = 44, + SEQ_TYPE_DODGE = 45, + /*Daarken Effects*/ + SEQ_TYPE_DARKEN = 46, + SEQ_TYPE_BURN = 47, + SEQ_TYPE_LINEAR_BURN = 48, + /*Overlay Effects*/ + SEQ_TYPE_OVERLAY = 49, + SEQ_TYPE_HLIGHT = 50, + SEQ_TYPE_SLIGHT = 51, + SEQ_TYPE_PIN_LIGHT = 52, + SEQ_TYPE_LIN_LIGHT = 53, + SEQ_TYPE_VIVID_LIGHT = 54, + /*Color Effects*/ + SEQ_TYPE_HUE = 55, + SEQ_TYPE_SATURATION = 56, + SEQ_TYPE_VALUE = 57, + SEQ_TYPE_BLEND_COLOR = 58, + + SEQ_TYPE_MAX = 58 }; #define SEQ_MOVIECLIP_RENDER_UNDISTORTED (1 << 0) diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index dd96b1848df..5eef8bbd7bd 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..a47c54be240 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,22 @@ 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_BURN, "BURN", 0, "Burn", ""}, + {SEQ_TYPE_LINEAR_BURN, "LBURN", 0, "Linear Burn", ""}, + {SEQ_TYPE_DARKEN, "DARKEN", 0, "Darken", ""}, + {SEQ_TYPE_SCREEN, "SCREEN", 0, "Screen", ""}, + {SEQ_TYPE_LIGHTEN, "LIGHTEN", 0, "Lighten", ""}, + {SEQ_TYPE_DODGE, "DODGE", 0, "Dodge", ""}, + {SEQ_TYPE_OVERLAY, "OVERLAY", 0, "Overlay", ""}, + {SEQ_TYPE_SLIGHT, "SLIGHT", 0, "Soft Light", ""}, + {SEQ_TYPE_HLIGHT, "HLIGHT", 0, "Hard Light", ""}, + {SEQ_TYPE_PIN_LIGHT, "PLIGHT", 0, "Pin Light", ""}, + {SEQ_TYPE_LIN_LIGHT, "LLIGHT", 0, "Linear Light", ""}, + {SEQ_TYPE_VIVID_LIGHT, "VLIGHT", 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", ""}, {0, NULL, 0, NULL, NULL} }; @@ -1411,6 +1429,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 +2397,47 @@ 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_BURN, "BURN", 0, "Burn", ""}, + {SEQ_TYPE_LINEAR_BURN, "LBURN", 0, "Linear Burn", ""}, + {SEQ_TYPE_DARKEN, "DARKEN", 0, "Darken", ""}, + {SEQ_TYPE_SCREEN, "SCREEN", 0, "Screen", ""}, + {SEQ_TYPE_LIGHTEN, "LIGHTEN", 0, "Lighten", ""}, + {SEQ_TYPE_DODGE, "DODGE", 0, "Dodge", ""}, + {SEQ_TYPE_OVERLAY, "OVERLAY", 0, "Overlay", ""}, + {SEQ_TYPE_SLIGHT, "SLIGHT", 0, "Soft Light", ""}, + {SEQ_TYPE_HLIGHT, "HLIGHT", 0, "Hard Light", ""}, + {SEQ_TYPE_PIN_LIGHT, "PLIGHT", 0, "Pin Light", ""}, + {SEQ_TYPE_LIN_LIGHT, "LLIGHT", 0, "Linear Light", ""}, + {SEQ_TYPE_VIVID_LIGHT, "VLIGHT", 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", ""}, + {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 +2464,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} };