[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60055] trunk/blender/source/blender: Better fix for #36688.
Antony Riakiotakis
kalast at gmail.com
Thu Sep 12 01:28:23 CEST 2013
Revision: 60055
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60055
Author: psy-fi
Date: 2013-09-11 23:28:23 +0000 (Wed, 11 Sep 2013)
Log Message:
-----------
Better fix for #36688.
Throw a python error if user attempts to use CurveMap without calling
CurveMapping.initialize() first. Added access to the initialize function
to CurveMapping on RNA level.
Thanks to Campbel for the help and remarks!
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-11 23:24:45 UTC (rev 60054)
+++ trunk/blender/source/blender/blenkernel/BKE_colortools.h 2013-09-11 23:28:23 UTC (rev 60055)
@@ -64,7 +64,6 @@
/* 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-11 23:24:45 UTC (rev 60054)
+++ trunk/blender/source/blender/blenkernel/intern/colortools.c 2013-09-11 23:28:23 UTC (rev 60055)
@@ -878,19 +878,6 @@
}
}
-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-11 23:24:45 UTC (rev 60054)
+++ trunk/blender/source/blender/makesrna/intern/rna_color.c 2013-09-11 23:28:23 UTC (rev 60055)
@@ -621,12 +621,19 @@
}
/* this function only exists because #curvemap_evaluateF uses a 'const' qualifier */
-static float rna_CurveMap_evaluateF(struct CurveMap *cuma, float value)
+static float rna_CurveMap_evaluateF(struct CurveMap *cuma, ReportList *reports, float value)
{
- curvemap_initialize(cuma);
+ if (!cuma->table) {
+ BKE_reportf(reports, RPT_ERROR, "CurveMap table not initialized, call initialize() on CurveMapping owner of the CurveMap");
+ return 0.0f;
+ }
return curvemap_evaluateF(cuma, value);
}
+static void rna_CurveMap_initialize(struct CurveMapping *cumap)
+{
+ curvemapping_initialize(cumap);
+}
#else
static void rna_def_curvemappoint(BlenderRNA *brna)
@@ -712,6 +719,7 @@
rna_def_curvemap_points_api(brna, prop);
func = RNA_def_function(srna, "evaluate", "rna_CurveMap_evaluateF");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Evaluate curve at given location");
parm = RNA_def_float(func, "position", 0.0f, -FLT_MAX, FLT_MAX, "Position", "Position to evaluate curve at", -FLT_MAX, FLT_MAX);
RNA_def_property_flag(parm, PROP_REQUIRED);
@@ -780,6 +788,9 @@
func = RNA_def_function(srna, "update", "curvemapping_changed_all");
RNA_def_function_ui_description(func, "Update curve mapping after making changes");
+
+ func = RNA_def_function(srna, "initialize", "rna_CurveMap_initialize");
+ RNA_def_function_ui_description(func, "Initialize curve");
}
static void rna_def_color_ramp_element(BlenderRNA *brna)
More information about the Bf-blender-cvs
mailing list