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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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");
|
||||
|
Reference in New Issue
Block a user