[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50254] trunk/blender/source/blender: fix for own crash caused by curve refactor, now curve tables are initialized once when the tree is initialized.
Campbell Barton
ideasman42 at gmail.com
Tue Aug 28 12:02:11 CEST 2012
Revision: 50254
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50254
Author: campbellbarton
Date: 2012-08-28 10:02:10 +0000 (Tue, 28 Aug 2012)
Log Message:
-----------
fix for own crash caused by curve refactor, now curve tables are initialized once when the tree is initialized.
thanks to Antony Riakiotakis for providing a fix, though this works a little different.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/colortools.c
trunk/blender/source/blender/nodes/shader/nodes/node_shader_curves.c
trunk/blender/source/blender/python/generic/py_capi_utils.c
Modified: trunk/blender/source/blender/blenkernel/intern/colortools.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/colortools.c 2012-08-28 01:50:13 UTC (rev 50253)
+++ trunk/blender/source/blender/blenkernel/intern/colortools.c 2012-08-28 10:02:10 UTC (rev 50254)
@@ -105,9 +105,18 @@
int a;
for (a = 0; a < CM_TOT; a++) {
- if (cumap->cm[a].curve) MEM_freeN(cumap->cm[a].curve);
- if (cumap->cm[a].table) MEM_freeN(cumap->cm[a].table);
- if (cumap->cm[a].premultable) MEM_freeN(cumap->cm[a].premultable);
+ if (cumap->cm[a].curve) {
+ MEM_freeN(cumap->cm[a].curve);
+ cumap->cm[a].curve = NULL;
+ }
+ if (cumap->cm[a].table) {
+ MEM_freeN(cumap->cm[a].table);
+ cumap->cm[a].table = NULL;
+ }
+ if (cumap->cm[a].premultable) {
+ MEM_freeN(cumap->cm[a].premultable);
+ cumap->cm[a].premultable = NULL;
+ }
}
}
Modified: trunk/blender/source/blender/nodes/shader/nodes/node_shader_curves.c
===================================================================
--- trunk/blender/source/blender/nodes/shader/nodes/node_shader_curves.c 2012-08-28 01:50:13 UTC (rev 50253)
+++ trunk/blender/source/blender/nodes/shader/nodes/node_shader_curves.c 2012-08-28 10:02:10 UTC (rev 50254)
@@ -45,6 +45,12 @@
{ -1, 0, "" }
};
+static void *node_shader_initexec_curve(bNode *node)
+{
+ curvemapping_initialize(node->storage);
+ return NULL; /* unused return */
+}
+
static void node_shader_exec_curve_vec(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
float vec[3];
@@ -65,7 +71,6 @@
float *array;
int size;
- curvemapping_initialize(node->storage);
curvemapping_table_RGBA(node->storage, &array, &size);
return GPU_stack_link(mat, "curves_vec", in, out, GPU_texture(size, array));
}
@@ -81,6 +86,7 @@
node_type_init(&ntype, node_shader_init_curve_vec);
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
node_type_exec(&ntype, node_shader_exec_curve_vec);
+ node_type_exec_new(&ntype, node_shader_initexec_curve, NULL, NULL); /* only for its initexec func */
node_type_gpu(&ntype, gpu_shader_curve_vec);
nodeRegisterType(ttype, &ntype);
@@ -138,6 +144,7 @@
node_type_init(&ntype, node_shader_init_curve_rgb);
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
node_type_exec(&ntype, node_shader_exec_curve_rgb);
+ node_type_exec_new(&ntype, node_shader_initexec_curve, NULL, NULL); /* only for its initexec func */
node_type_gpu(&ntype, gpu_shader_curve_rgb);
nodeRegisterType(ttype, &ntype);
Modified: trunk/blender/source/blender/python/generic/py_capi_utils.c
===================================================================
--- trunk/blender/source/blender/python/generic/py_capi_utils.c 2012-08-28 01:50:13 UTC (rev 50253)
+++ trunk/blender/source/blender/python/generic/py_capi_utils.c 2012-08-28 10:02:10 UTC (rev 50254)
@@ -523,7 +523,9 @@
}
}
-/* Would be nice if python had this built in */
+/* Would be nice if python had this built in
+ * See: http://wiki.blender.org/index.php/Dev:Doc/Tools/Debugging/PyFromC
+ */
void PyC_RunQuicky(const char *filepath, int n, ...)
{
FILE *fp = fopen(filepath, "r");
More information about the Bf-blender-cvs
mailing list