[Bf-blender-cvs] [213554f24a1] master: VSE: Add ASC CDL color correction method
Josef Raschen
noreply at git.blender.org
Thu Sep 30 21:19:29 CEST 2021
Commit: 213554f24a17ea5545b8603fefcda0198297b452
Author: Josef Raschen
Date: Thu Sep 30 21:09:47 2021 +0200
Branches: master
https://developer.blender.org/rB213554f24a17ea5545b8603fefcda0198297b452
VSE: Add ASC CDL color correction method
Add Offset/Slope/Power controls to the color balance modifier. This is
already available in compositor.
Reviewed By: sergey, ISS
Differential Revision: https://developer.blender.org/D12575
===================================================================
M release/scripts/startup/bl_ui/space_sequencer.py
M source/blender/makesdna/DNA_sequence_types.h
M source/blender/makesrna/intern/rna_sequencer.c
M source/blender/sequencer/intern/modifier.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
index 7b102604587..455f5e2d841 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -46,44 +46,85 @@ def selected_sequences_len(context):
def draw_color_balance(layout, color_balance):
+ layout.prop(color_balance, "correction_method")
+
layout.use_property_split = False
flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
- col = flow.column()
-
- box = col.box()
- split = box.split(factor=0.35)
- col = split.column(align=True)
- col.label(text="Lift:")
- col.separator()
- col.separator()
- col.prop(color_balance, "lift", text="")
- col.prop(color_balance, "invert_lift", text="Invert", icon='ARROW_LEFTRIGHT')
- split.template_color_picker(color_balance, "lift", value_slider=True, cubic=True)
-
- col = flow.column()
-
- box = col.box()
- split = box.split(factor=0.35)
- col = split.column(align=True)
- col.label(text="Gamma:")
- col.separator()
- col.separator()
- col.prop(color_balance, "gamma", text="")
- col.prop(color_balance, "invert_gamma", text="Invert", icon='ARROW_LEFTRIGHT')
- split.template_color_picker(color_balance, "gamma", value_slider=True, lock_luminosity=True, cubic=True)
-
- col = flow.column()
-
- box = col.box()
- split = box.split(factor=0.35)
- col = split.column(align=True)
- col.label(text="Gain:")
- col.separator()
- col.separator()
- col.prop(color_balance, "gain", text="")
- col.prop(color_balance, "invert_gain", text="Invert", icon='ARROW_LEFTRIGHT')
- split.template_color_picker(color_balance, "gain", value_slider=True, lock_luminosity=True, cubic=True)
+
+ if color_balance.correction_method == 'LIFT_GAMMA_GAIN':
+ col = flow.column()
+
+ box = col.box()
+ split = box.split(factor=0.35)
+ col = split.column(align=True)
+ col.label(text="Lift:")
+ col.separator()
+ col.separator()
+ col.prop(color_balance, "lift", text="")
+ col.prop(color_balance, "invert_lift", text="Invert", icon='ARROW_LEFTRIGHT')
+ split.template_color_picker(color_balance, "lift", value_slider=True, cubic=True)
+
+ col = flow.column()
+
+ box = col.box()
+ split = box.split(factor=0.35)
+ col = split.column(align=True)
+ col.label(text="Gamma:")
+ col.separator()
+ col.separator()
+ col.prop(color_balance, "gamma", text="")
+ col.prop(color_balance, "invert_gamma", text="Invert", icon='ARROW_LEFTRIGHT')
+ split.template_color_picker(color_balance, "gamma", value_slider=True, lock_luminosity=True, cubic=True)
+
+ col = flow.column()
+
+ box = col.box()
+ split = box.split(factor=0.35)
+ col = split.column(align=True)
+ col.label(text="Gain:")
+ col.separator()
+ col.separator()
+ col.prop(color_balance, "gain", text="")
+ col.prop(color_balance, "invert_gain", text="Invert", icon='ARROW_LEFTRIGHT')
+ split.template_color_picker(color_balance, "gain", value_slider=True, lock_luminosity=True, cubic=True)
+
+ elif color_balance.correction_method == 'OFFSET_POWER_SLOPE':
+ col = flow.column()
+
+ box = col.box()
+ split = box.split(factor=0.35)
+ col = split.column(align=True)
+ col.label(text="Offset:")
+ col.separator()
+ col.separator()
+ col.prop(color_balance, "offset", text="")
+ col.prop(color_balance, "invert_offset", text="Invert", icon='ARROW_LEFTRIGHT')
+ split.template_color_picker(color_balance, "offset", value_slider=True, cubic=True)
+
+ col = flow.column()
+
+ box = col.box()
+ split = box.split(factor=0.35)
+ col = split.column(align=True)
+ col.label(text="Power:")
+ col.separator()
+ col.separator()
+ col.prop(color_balance, "power", text="")
+ col.prop(color_balance, "invert_power", text="Invert", icon='ARROW_LEFTRIGHT')
+ split.template_color_picker(color_balance, "power", value_slider=True, cubic=True)
+
+ col = flow.column()
+
+ box = col.box()
+ split = box.split(factor=0.35)
+ col = split.column(align=True)
+ col.label(text="Slope:")
+ col.separator()
+ col.separator()
+ col.prop(color_balance, "slope", text="")
+ col.prop(color_balance, "invert_slope", text="Invert", icon='ARROW_LEFTRIGHT')
+ split.template_color_picker(color_balance, "slope", value_slider=True, cubic=True)
class SEQUENCER_PT_active_tool(ToolActivePanelHelper, Panel):
diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h
index 13bfa82b36d..a71f86eae9f 100644
--- a/source/blender/makesdna/DNA_sequence_types.h
+++ b/source/blender/makesdna/DNA_sequence_types.h
@@ -79,9 +79,13 @@ typedef struct StripTransform {
} StripTransform;
typedef struct StripColorBalance {
+ int method;
float lift[3];
float gamma[3];
float gain[3];
+ float slope[3];
+ float offset[3];
+ float power[3];
int flag;
char _pad[4];
/* float exposure; */
@@ -434,6 +438,11 @@ typedef struct ColorBalanceModifierData {
float color_multiply;
} ColorBalanceModifierData;
+enum {
+ SEQ_COLOR_BALANCE_METHOD_LIFTGAMMAGAIN = 0,
+ SEQ_COLOR_BALANCE_METHOD_SLOPEOFFSETPOWER = 1,
+};
+
typedef struct CurvesModifierData {
SequenceModifierData modifier;
@@ -571,6 +580,9 @@ enum {
#define SEQ_COLOR_BALANCE_INVERSE_GAIN 1
#define SEQ_COLOR_BALANCE_INVERSE_GAMMA 2
#define SEQ_COLOR_BALANCE_INVERSE_LIFT 4
+#define SEQ_COLOR_BALANCE_INVERSE_SLOPE 8
+#define SEQ_COLOR_BALANCE_INVERSE_OFFSET 16
+#define SEQ_COLOR_BALANCE_INVERSE_POWER 32
/* !!! has to be same as IMB_imbuf.h IMB_PROXY_... and IMB_TC_... */
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index 7303f6c920a..e519740259c 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -1591,12 +1591,28 @@ static void rna_def_color_balance(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
+ static const EnumPropertyItem method_items[] = {
+ {SEQ_COLOR_BALANCE_METHOD_LIFTGAMMAGAIN, "LIFT_GAMMA_GAIN", 0, "Lift/Gamma/Gain", ""},
+ {SEQ_COLOR_BALANCE_METHOD_SLOPEOFFSETPOWER,
+ "OFFSET_POWER_SLOPE",
+ 0,
+ "Offset/Power/Slope (ASC-CDL)",
+ "ASC-CDL standard color correction"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
srna = RNA_def_struct(brna, "SequenceColorBalanceData", NULL);
RNA_def_struct_ui_text(srna,
"Sequence Color Balance Data",
"Color balance parameters for a sequence strip and its modifiers");
RNA_def_struct_sdna(srna, "StripColorBalance");
+ prop = RNA_def_property(srna, "correction_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "method");
+ RNA_def_property_enum_items(prop, method_items);
+ RNA_def_property_ui_text(prop, "Correction Method", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
+
prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_ui_text(prop, "Lift", "Color balance lift (shadows)");
RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
@@ -1615,14 +1631,22 @@ static void rna_def_color_balance(BlenderRNA *brna)
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
- prop = RNA_def_property(srna, "invert_gain", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_GAIN);
- RNA_def_property_ui_text(prop, "Inverse Gain", "Invert the gain color`");
+ prop = RNA_def_property(srna, "slope", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_ui_text(prop, "Slope", "Correction for highlights");
+ RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
+ RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
- prop = RNA_def_property(srna, "invert_gamma", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_GAMMA);
- RNA_def_property_ui_text(prop, "Inverse Gamma", "Invert the gamma color");
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_ui_text(prop, "Offset", "Correction for entire tonal range");
+ RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
+
+ prop = RNA_def_property(srna, "power", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_ui_text(prop, "Power", "Correction for midtones");
+ RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
+ RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
prop = RNA_def_property(srna, "invert_lift", PROP_BOOLEAN, PROP_NONE);
@@ -1630,6 +1654,31 @@ static void rna_def_color_balance(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Inverse Lift", "Invert the lift color");
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
+ prop = RNA_def_property(srna, "invert_gamma", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_GAMMA);
+ RNA_def_property_ui_text(prop, "Inverse Gamma", "Invert the gamma color");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
+
+ prop = RNA_def_property(srna, "invert_gain", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_GAIN);
+ RNA_def_property_ui_text(prop, "Inverse Gain", "Invert the gain color`");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUEN
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list