Index: release/scripts/startup/bl_ui/properties_texture.py =================================================================== --- release/scripts/startup/bl_ui/properties_texture.py (revision 48705) +++ release/scripts/startup/bl_ui/properties_texture.py (working copy) @@ -219,7 +219,10 @@ col.label(text="Adjust:") col.prop(tex, "intensity") col.prop(tex, "contrast") - col.prop(tex, "saturation") + sub = col.row() + sub.active = not tex.use_negative_bricont + sub.prop(tex, "saturation") + col.prop(tex, "use_negative_bricont", text="Allow negative values") # Texture Slot Panels # Index: source/blender/makesdna/DNA_texture_types.h =================================================================== --- source/blender/makesdna/DNA_texture_types.h (revision 48705) +++ source/blender/makesdna/DNA_texture_types.h (working copy) @@ -373,6 +373,7 @@ #define TEX_REPEAT_YMIR 256 #define TEX_FLAG_MASK ( TEX_COLORBAND | TEX_FLIPBLEND | TEX_NEGALPHA | TEX_CHECKER_ODD | TEX_CHECKER_EVEN | TEX_PRV_ALPHA | TEX_PRV_NOR | TEX_REPEAT_XMIR | TEX_REPEAT_YMIR ) #define TEX_DS_EXPAND 512 +#define TEX_NEGATIVE_BRICONT 1024 /* extend (starts with 1 because of backward comp.) */ #define TEX_EXTEND 1 Index: source/blender/makesrna/intern/rna_texture.c =================================================================== --- source/blender/makesrna/intern/rna_texture.c (revision 48705) +++ source/blender/makesrna/intern/rna_texture.c (working copy) @@ -377,6 +377,14 @@ tex->coba = add_colorband(0); } +static void rna_Texture_use_negative_bricont_set(PointerRNA *ptr, int value) +{ + Tex *tex= (Tex*)ptr->data; + + if(value) tex->flag |= TEX_NEGATIVE_BRICONT; + else tex->flag &= ~TEX_NEGATIVE_BRICONT; +} + static void rna_Texture_use_nodes_set(PointerRNA *ptr, int v) { Tex *tex = (Tex *)ptr->data; @@ -1983,6 +1991,12 @@ RNA_def_property_range(prop, 0, 2); RNA_def_property_ui_text(prop, "Saturation", "Adjust the saturation of colors in the texture"); RNA_def_property_update(prop, 0, "rna_Texture_update"); + + prop= RNA_def_property(srna, "use_negative_bricont", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_NEGATIVE_BRICONT); + RNA_def_property_boolean_funcs(prop, NULL, "rna_Texture_use_negative_bricont_set"); + RNA_def_property_ui_text(prop, "Allow negative values", "Don't clamp to zero brightness & contrast"); + RNA_def_property_update(prop, 0, "rna_Texture_update"); /* RGB Factor */ prop = RNA_def_property(srna, "factor_red", PROP_FLOAT, PROP_NONE); Index: source/blender/render/intern/include/texture.h =================================================================== --- source/blender/render/intern/include/texture.h (revision 48705) +++ source/blender/render/intern/include/texture.h (working copy) @@ -35,17 +35,22 @@ #define BRICONT \ texres->tin= (texres->tin-0.5f) * tex->contrast+tex->bright-0.5f; \ - if(texres->tin < 0.0f) texres->tin= 0.0f; \ - else if(texres->tin > 1.0f) texres->tin= 1.0f; \ + if( !tex->flag & TEX_NEGATIVE_BRICONT ) { \ + if(texres->tin < 0.0f) texres->tin= 0.0f; \ + else if(texres->tin > 1.0f) texres->tin= 1.0f; \ + } \ #define BRICONTRGB \ texres->tr= tex->rfac*((texres->tr-0.5f)*tex->contrast+tex->bright-0.5f); \ - if(texres->tr<0.0f) texres->tr= 0.0f; \ + if(texres->tr<0.0f && !(tex->flag & TEX_NEGATIVE_BRICONT)) \ + texres->tr= 0.0f; \ texres->tg= tex->gfac*((texres->tg-0.5f)*tex->contrast+tex->bright-0.5f); \ - if(texres->tg<0.0f) texres->tg= 0.0f; \ + if(texres->tg<0.0f && !(tex->flag & TEX_NEGATIVE_BRICONT)) \ + texres->tg= 0.0f; \ texres->tb= tex->bfac*((texres->tb-0.5f)*tex->contrast+tex->bright-0.5f); \ - if(texres->tb<0.0f) texres->tb= 0.0f; \ - if(tex->saturation != 1.0f) { \ + if(texres->tb<0.0f && !(tex->flag & TEX_NEGATIVE_BRICONT)) \ + texres->tb= 0.0f; \ + if(tex->saturation != 1.0f && !(tex->flag & TEX_NEGATIVE_BRICONT)) { \ float _hsv[3]; \ rgb_to_hsv(texres->tr, texres->tg, texres->tb, \ _hsv, _hsv+1, _hsv+2); \