[Bf-blender-cvs] [ddd6be1] master: Compositor: negative color support for ASC-CDL offset

Campbell Barton noreply at git.blender.org
Wed May 4 16:02:10 CEST 2016


Commit: ddd6be1834692c63353e47ab8d94e8dfc576c906
Author: Campbell Barton
Date:   Wed May 4 23:56:38 2016 +1000
Branches: master
https://developer.blender.org/rBddd6be1834692c63353e47ab8d94e8dfc576c906

Compositor: negative color support for ASC-CDL offset

Since the color wheel can't handle negative colors usefully, use a basis value for the initial RGB.

===================================================================

M	source/blender/compositor/nodes/COM_ColorBalanceNode.cpp
M	source/blender/editors/space_node/drawnode.c
M	source/blender/makesdna/DNA_node_types.h
M	source/blender/makesrna/intern/rna_nodetree.c

===================================================================

diff --git a/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp b/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp
index a531493..46a7071 100644
--- a/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp
@@ -58,7 +58,12 @@ void ColorBalanceNode::convertToOperations(NodeConverter &converter, const Compo
 	}
 	else {
 		ColorBalanceASCCDLOperation *operationCDL = new ColorBalanceASCCDLOperation();
-		operationCDL->setOffset(n->offset);
+
+		float offset[3];
+		copy_v3_fl(offset, n->offset_basis);
+		add_v3_v3(offset, n->offset);
+
+		operationCDL->setOffset(offset);
 		operationCDL->setPower(n->power);
 		operationCDL->setSlope(n->slope);
 		operation = operationCDL;
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index b2f3306..ddbd076 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -1953,6 +1953,7 @@ static void node_composit_buts_colorbalance(uiLayout *layout, bContext *UNUSED(C
 		uiTemplateColorPicker(col, ptr, "offset", 1, 1, 0, 1);
 		row = uiLayoutRow(col, false);
 		uiItemR(row, ptr, "offset", 0, NULL, ICON_NONE);
+		uiItemR(col, ptr, "offset_basis", 0, NULL, ICON_NONE);
 		
 		col = uiLayoutColumn(split, false);
 		uiTemplateColorPicker(col, ptr, "power", 1, 1, 0, 1);
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index c75a019..6cba332 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -689,6 +689,8 @@ typedef struct NodeColorBalance {
 	float slope[3];
 	float offset[3];
 	float power[3];
+	float offset_basis;
+	char _pad[4];
 	
 	/* LGG parameters */
 	float lift[3];
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index ccbabb2..3221e93 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -5892,6 +5892,12 @@ static void def_cmp_colorbalance(StructRNA *srna)
 	RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Slope", "Correction for Highlights");
 	RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
+
+	prop = RNA_def_property(srna, "offset_basis", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_range(prop,  -FLT_MAX, FLT_MAX);
+	RNA_def_property_ui_range(prop, -1.0, 1.0, 1.0, 2);
+	RNA_def_property_ui_text(prop, "Basis", "Support negative color by using this as the RGB basis");
+	RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
 }
 
 static void def_cmp_huecorrect(StructRNA *srna)




More information about the Bf-blender-cvs mailing list