Patch from Francois Tarlier: extend colour balance node 'lift' value to 0.0-2.0 range
authorMatt Ebb <matt@mke3.net>
Thu, 25 Mar 2010 00:10:41 +0000 (00:10 +0000)
committerMatt Ebb <matt@mke3.net>
Thu, 25 Mar 2010 00:10:41 +0000 (00:10 +0000)
(default 1.0), like the other controls. Thanks!

source/blender/blenkernel/BKE_blender.h
source/blender/blenloader/intern/readfile.c
source/blender/makesrna/intern/rna_nodetree.c
source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c

index b9576c3..6b656f1 100644 (file)
@@ -45,7 +45,7 @@ struct Scene;
 struct Main;
        
 #define BLENDER_VERSION                        252
-#define BLENDER_SUBVERSION             0
+#define BLENDER_SUBVERSION             1
 
 #define BLENDER_MINVERSION             250
 #define BLENDER_MINSUBVERSION  0
index b28610f..609ff7a 100644 (file)
@@ -3727,6 +3727,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
                        FluidsimModifierData *fluidmd = (FluidsimModifierData*) md;
                        
                        fluidmd->fss= newdataadr(fd, fluidmd->fss);
+                       fluidmd->fss->fmd= fluidmd;
                        fluidmd->fss->meshSurfNormals = 0;
                }
                else if (md->type==eModifierType_Smoke) {
@@ -10642,13 +10643,62 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                } /* sequencer changes */
        }
 
-       /* put 2.50 compatibility code here until next subversion bump */
-       {
+       if (main->versionfile < 252 || (main->versionfile == 252 && main->subversionfile < 1)) {
                Brush *brush;
+               Object *ob;
+               Scene *scene;
+               bNodeTree *ntree;
                
                for (brush= main->brush.first; brush; brush= brush->id.next) {
                        if (brush->curve) brush->curve->preset = CURVE_PRESET_SMOOTH;
                }
+               
+               /* properly initialise active flag for fluidsim modifiers */
+               for(ob = main->object.first; ob; ob = ob->id.next) {
+                       ModifierData *md;
+                       for(md= ob->modifiers.first; md; md= md->next) {
+                               if (md->type == eModifierType_Fluidsim) {
+                                       FluidsimModifierData *fmd = (FluidsimModifierData *)md;
+                                       fmd->fss->flag |= OB_FLUIDSIM_ACTIVE;
+                               }
+                       }
+               }
+               
+               /* adjustment to color balance node values */
+               for(scene= main->scene.first; scene; scene= scene->id.next) {
+                       if(scene->nodetree) {
+                               bNode *node=scene->nodetree->nodes.first;
+                               
+                               while(node) {
+                                       if (node->type == CMP_NODE_COLORBALANCE) {
+                                               NodeColorBalance *n= (NodeColorBalance *)node->storage;
+                                               n->lift[0] += 1.f;
+                                               n->lift[1] += 1.f;
+                                               n->lift[2] += 1.f;
+                                       }
+                                       node= node->next;
+                               }
+                       }
+               }
+               /* check inside node groups too */
+               for (ntree= main->nodetree.first; ntree; ntree=ntree->id.next) {
+                       bNode *node=ntree->nodes.first;
+                       
+                       while(node) {
+                               if (node->type == CMP_NODE_COLORBALANCE) {
+                                       NodeColorBalance *n= (NodeColorBalance *)node->storage;
+                                       n->lift[0] += 1.f;
+                                       n->lift[1] += 1.f;
+                                       n->lift[2] += 1.f;
+                               }
+                               node= node->next;
+                       }
+               }
+
+       }
+       /* put 2.50 compatibility code here until next subversion bump */
+       {
+               
        }
 
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
index dae280c..6a30a78 100644 (file)
@@ -1927,7 +1927,8 @@ static void def_cmp_colorbalance(StructRNA *srna)
        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_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, "Lift", "Correction for Shadows");
        RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
        
index 7ec28e6..b40b27e 100644 (file)
@@ -56,7 +56,7 @@ DO_INLINE float colorbalance_cdl(float in, float offset, float power, float slop
 
 DO_INLINE float colorbalance_lgg(float in, float lift, float gamma, float gain)
 {
-       float x = gain*(in+lift*(1-in));
+       float x = gain*(in+(lift-1)*(1-in));
        
        /* prevent NaN */
        if (x < 0.f) x = 0.f;
@@ -150,7 +150,7 @@ static void node_composit_init_colorbalance(bNode *node)
 {
        NodeColorBalance *n= node->storage= MEM_callocN(sizeof(NodeColorBalance), "node colorbalance");
 
-       n->lift[0] = n->lift[1] = n->lift[2] = 0.0f;
+       n->lift[0] = n->lift[1] = n->lift[2] = 1.0f;
        n->gamma[0] = n->gamma[1] = n->gamma[2] = 1.0f;
        n->gain[0] = n->gain[1] = n->gain[2] = 1.0f;
 }