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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-08-28 14:02:10 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-08-28 14:02:10 +0400
commitc43583a23ae0e552779148236f973d20275f9bd0 (patch)
tree5a881f7c41f6838ac0841495e699b61a2dcbc44c /source
parenta798371df157ecd30e4bfd6035c7a4c6a8b1f277 (diff)
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.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/colortools.c15
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_curves.c9
-rw-r--r--source/blender/python/generic/py_capi_utils.c4
3 files changed, 23 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 7c03c75bd99..d65c81b4f9b 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -105,9 +105,18 @@ void curvemapping_free_data(CurveMapping *cumap)
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;
+ }
}
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_curves.c b/source/blender/nodes/shader/nodes/node_shader_curves.c
index 0c08f1bc215..8831b07d8a0 100644
--- a/source/blender/nodes/shader/nodes/node_shader_curves.c
+++ b/source/blender/nodes/shader/nodes/node_shader_curves.c
@@ -45,6 +45,12 @@ static bNodeSocketTemplate sh_node_curve_vec_out[]= {
{ -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 @@ static int gpu_shader_curve_vec(GPUMaterial *mat, bNode *node, GPUNodeStack *in,
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 @@ void register_node_type_sh_curve_vec(bNodeTreeType *ttype)
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 @@ void register_node_type_sh_curve_rgb(bNodeTreeType *ttype)
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);
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index 657844ebfff..520773c1ddf 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -523,7 +523,9 @@ void PyC_SetHomePath(const char *py_path_bundle)
}
}
-/* 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");