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:
-rw-r--r--source/blender/blenkernel/BKE_colortools.h1
-rw-r--r--source/blender/blenkernel/intern/colortools.c13
-rw-r--r--source/blender/makesrna/intern/rna_color.c15
3 files changed, 13 insertions, 16 deletions
diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h
index e703f189d6f..e0b7e68bafc 100644
--- a/source/blender/blenkernel/BKE_colortools.h
+++ b/source/blender/blenkernel/BKE_colortools.h
@@ -64,7 +64,6 @@ void curvemapping_changed_all(struct CurveMapping *cumap);
/* 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 */
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 063fc2eccab..7f94f365925 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -878,19 +878,6 @@ void curvemapping_initialize(CurveMapping *cumap)
}
}
-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;
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index b184cc11286..2fba4e9ed7b 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -621,12 +621,19 @@ static void rna_ColorManagement_update(Main *UNUSED(bmain), Scene *UNUSED(scene)
}
/* 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 @@ static void rna_def_curvemap(BlenderRNA *brna)
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 @@ static void rna_def_curvemapping(BlenderRNA *brna)
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)