Compositor: Texture node didn't use texture-nodes itself.
Now composites initialize texture nodes correctly.
Also reviewed the fix for crashing texture nodes for displace.
It appears texture nodes also are used for sculpt/paint
brushes, in these cases it can be allowed again. But, don't
do this during rendering for now!
return NULL;
}
+/* check if texture nodes need exec or end */
+static void ntree_composite_texnode(bNodeTree *ntree, int init)
+{
+ bNode *node;
+
+ for(node= ntree->nodes.first; node; node= node->next) {
+ if(node->type==CMP_NODE_TEXTURE && node->id) {
+ Tex *tex= (Tex *)node->id;
+ if(tex->nodetree && tex->use_nodes) {
+ /* has internal flag to detect it only does it once */
+ if(init)
+ ntreeBeginExecTree(tex->nodetree);
+ else
+ ntreeEndExecTree(tex->nodetree);
+ }
+ }
+ }
+
+}
/* optimized tree execute test for compositing */
void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
ntreeInitPreview(ntree, 0, 0);
ntreeBeginExecTree(ntree);
+ ntree_composite_texnode(ntree, 1);
/* prevent unlucky accidents */
if(G.background)
{
int result_type;
- result_type = multitex_ext(texture, tex_co, NULL, NULL, 0, texres);
+ /* no node textures for now */
+ result_type = multitex_ext_safe(texture, tex_co, texres);
/* if the texture gave an RGB value, we assume it didn't give a valid
* intensity, so calculate one (formula from do_material_tex).
/* node shaders... */
struct Tex;
struct MTex;
+/* this one uses nodes */
int multitex_ext(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres);
+/* nodes disabled */
+int multitex_ext_safe(struct Tex *tex, float *texvec, struct TexResult *texres);
+/* only for internal node usage */
int multitex_nodes(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres,
short thread, short which_output, struct ShadeInput *shi, struct MTex *mtex);
/* Warning, if the texres's values are not declared zero, check the return value to be sure
* the color values are set before using the r/g/b values, otherwise you may use uninitialized values - Campbell */
-/* extern-tex doesn't support nodes (ntreeBeginExec() can't be called when rendering is going on) */
int multitex_ext(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres)
+{
+ return multitex_nodes(tex, texvec, dxt, dyt, osatex, texres, 0, 0, NULL, NULL);
+}
+
+/* extern-tex doesn't support nodes (ntreeBeginExec() can't be called when rendering is going on) */
+int multitex_ext_safe(Tex *tex, float *texvec, TexResult *texres)
{
int use_nodes= tex->use_nodes, retval;
tex->use_nodes= 0;
- retval= multitex_nodes(tex, texvec, dxt, dyt, osatex, texres, 0, 0, NULL, NULL);
+ retval= multitex_nodes(tex, texvec, NULL, NULL, 0, texres, 0, 0, NULL, NULL);
tex->use_nodes= use_nodes;
return retval;
}
+
/* ------------------------------------------------------------------------- */
/* in = destination, tex = texture, out = previous color */