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.
This commit is contained in:
Antony Riakiotakis 2013-09-09 18:39:51 +00:00
parent 97d250fa65
commit 00641bb237
3 changed files with 15 additions and 0 deletions

View File

@ -64,6 +64,7 @@ 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 */

View File

@ -878,6 +878,19 @@ 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;

View File

@ -623,6 +623,7 @@ 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)
{
curvemap_initialize(cuma);
return curvemap_evaluateF(cuma, value);
}