[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59965] trunk/blender/source/blender: Attempt fix for #36688.

Antony Riakiotakis kalast at gmail.com
Mon Sep 9 20:39:52 CEST 2013


Revision: 59965
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59965
Author:   psy-fi
Date:     2013-09-09 18:39:51 +0000 (Mon, 09 Sep 2013)
Log Message:
-----------
Attempt fix for #36688.

Curves may not be not initialized when called from python. C code
explicilty says that curvemapping_initialize should be called prior to
evaluating the curve, however the curve clip rectangle is not available
when calling evaluation on the curvemap. This is not possible unless we
force the evaluation on CurveMapping level, not on CurveMap level.

For now just pass a rectangle with the x boundary values of the curvemap
for evaluation to avoid the crash.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_colortools.h
    trunk/blender/source/blender/blenkernel/intern/colortools.c
    trunk/blender/source/blender/makesrna/intern/rna_color.c

Modified: trunk/blender/source/blender/blenkernel/BKE_colortools.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_colortools.h	2013-09-09 18:00:25 UTC (rev 59964)
+++ trunk/blender/source/blender/blenkernel/BKE_colortools.h	2013-09-09 18:39:51 UTC (rev 59965)
@@ -64,6 +64,7 @@
 
 /* call before _all_ evaluation functions */
 void                curvemapping_initialize(struct CurveMapping *cumap);
+void                curvemap_initialize(struct CurveMap *cuma);
 
 /* keep these (const CurveMap) - to help with thread safety */
 /* single curve, no table check */

Modified: trunk/blender/source/blender/blenkernel/intern/colortools.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/colortools.c	2013-09-09 18:00:25 UTC (rev 59964)
+++ trunk/blender/source/blender/blenkernel/intern/colortools.c	2013-09-09 18:39:51 UTC (rev 59965)
@@ -878,6 +878,19 @@
 	}
 }
 
+void curvemap_initialize(CurveMap *cuma)
+{
+	if (cuma->table == NULL) {
+		rctf clipr;
+		/* clip rectangle is not available here, but we can use a temporary
+		 * rectangle with the same min/max values */
+		clipr.xmin = cuma->mintable;
+		clipr.xmax = cuma->maxtable;
+
+		curvemap_make_table(cuma, &clipr);
+	}
+}
+
 void curvemapping_table_RGBA(const CurveMapping *cumap, float **array, int *size)
 {
 	int a;

Modified: trunk/blender/source/blender/makesrna/intern/rna_color.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_color.c	2013-09-09 18:00:25 UTC (rev 59964)
+++ trunk/blender/source/blender/makesrna/intern/rna_color.c	2013-09-09 18:39:51 UTC (rev 59965)
@@ -623,6 +623,7 @@
 /* this function only exists because #curvemap_evaluateF uses a 'const' qualifier */
 static float rna_CurveMap_evaluateF(struct CurveMap *cuma, float value)
 {
+	curvemap_initialize(cuma);
 	return curvemap_evaluateF(cuma, value);
 }
 




More information about the Bf-blender-cvs mailing list