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

Campbell Barton ideasman42 at gmail.com
Tue Sep 10 01:06:14 CEST 2013


I'm not sure about this fix,
Accessing a curve from python will generate a table which ignores the
curves clipping...
Making further access from other areas of blender use that table,
it wont know to re-generate the table since it assumes if (table !=
NULL), its valid and uses correct clipping values).

On Tue, Sep 10, 2013 at 4:39 AM, Antony Riakiotakis <kalast at gmail.com> wrote:
> 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);
>  }
>
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs



-- 
- Campbell



More information about the Bf-blender-cvs mailing list