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:
authorMatt Ebb <matt@mke3.net>2010-01-27 03:22:29 +0300
committerMatt Ebb <matt@mke3.net>2010-01-27 03:22:29 +0300
commit0bb36e9ced06b04b961300b21211f456c7035bcf (patch)
tree9e38b0b5e9b84a22a7a03c5cad4139106168685c /source/blender/makesrna
parentebafb7e484fa45aed0f4be75cfb5d570d7d43f81 (diff)
Fixes to Color Balance node:
* The Lift/Gamma/Gain formula previously was incorrect, fixed this and removed conversions - now the RNA values are the same as what goes into the formula. * Because of this, added the ability for the Value slider to map to a wider range than 0.0-1.0. The black/white gradient remains the same, in this case just indicating darker/brighter rather than absolute colour values. Also added ability for color wheels to be locked at full brightness (useful for this case, where the color value itself is dark). * Added an alternate formula - offset/power/slope (asc-cdl). This fits the standard Color Decision List formula, here for compatibility with other systems, though default Lift/Gamma/Gain is easier to use and gives nicer results.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c70
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c1
2 files changed, 44 insertions, 27 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index fa14bea4228..8b9eb00e96a 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -300,24 +300,6 @@ static void rna_Node_image_layer_update(Main *bmain, Scene *scene, PointerRNA *p
rna_Node_update(bmain, scene, ptr);
}
-static void rna_Node_colorbalance_update(Main *bmain, Scene *scene, PointerRNA *ptr)
-{
- bNode *node= (bNode*)ptr->data;
- NodeColorBalance *ncb = node->storage;
- float lift[3], gamma[3], gain[3];
-
- lift[0] = (ncb->lift[0] * 2.f - 1.f)*0.5f;
- lift[1] = (ncb->lift[1] * 2.f - 1.f)*0.5f;
- lift[2] = (ncb->lift[2] * 2.f - 1.f)*0.5f;
-
- mul_v3_v3fl(gamma, ncb->gamma, 2.f);
- mul_v3_v3fl(gain, ncb->gain, 2.f);
-
- lift_gamma_gain_to_asc_cdl(lift, gamma, gain, ncb->offset, ncb->slope, ncb->power);
-
- rna_Node_update(bmain, scene, ptr);
-}
-
static EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl)
{
EnumPropertyItem *item= NULL;
@@ -1878,33 +1860,67 @@ static void def_cmp_lensdist(StructRNA *srna)
static void def_cmp_colorbalance(StructRNA *srna)
{
PropertyRNA *prop;
- static float default_col[3] = {0.5f, 0.5f, 0.5f};
+ static float default_1[3] = {1.f, 1.f, 1.f};
+
+ static EnumPropertyItem type_items[] = {
+ {0, "LIFT_GAMMA_GAIN", 0, "Lift/Gamma/Gain", ""},
+ {1, "OFFSET_POWER_SLOPE", 0, "Offset/Power/Slope (ASC-CDL)", "ASC-CDL standard color correction"},
+ {0, NULL, 0, NULL, NULL}};
+
+ prop = RNA_def_property(srna, "correction_formula", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, type_items);
+ RNA_def_property_ui_text(prop, "Correction Formula", "");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
RNA_def_struct_sdna_from(srna, "NodeColorBalance", "storage");
prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "lift");
RNA_def_property_array(prop, 3);
- RNA_def_property_float_array_default(prop, default_col);
RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
RNA_def_property_ui_text(prop, "Lift", "Correction for Shadows");
- RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_colorbalance_update");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "gamma");
RNA_def_property_array(prop, 3);
- RNA_def_property_float_array_default(prop, default_col);
- RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
+ RNA_def_property_float_array_default(prop, default_1);
+ RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
RNA_def_property_ui_text(prop, "Gamma", "Correction for Midtones");
- RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_colorbalance_update");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "gain");
RNA_def_property_array(prop, 3);
- RNA_def_property_float_array_default(prop, default_col);
- RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
+ RNA_def_property_float_array_default(prop, default_1);
+ RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
RNA_def_property_ui_text(prop, "Gain", "Correction for Highlights");
- RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_colorbalance_update");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+
+
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "lift");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Offset", "Correction for Shadows");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "power", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "gamma");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_array_default(prop, default_1);
+ RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Power", "Correction for Midtones");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "slope", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "gain");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_array_default(prop, default_1);
+ 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_Node_update");
}
static void def_cmp_huecorrect(StructRNA *srna)
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index cd7051fc171..07bf20b0c03 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -344,6 +344,7 @@ void RNA_api_ui_layout(StructRNA *srna)
func= RNA_def_function(srna, "template_color_wheel", "uiTemplateColorWheel");
api_ui_item_rna_common(func);
RNA_def_boolean(func, "value_slider", 0, "", "Display the value slider to the right of the color wheel");
+ RNA_def_boolean(func, "lock", 0, "", "Lock the color wheel display to value 1.0 regardless of actual color");
func= RNA_def_function(srna, "template_triColorSet", "uiTemplateTriColorSet");
api_ui_item_rna_common(func);