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:
authorTon Roosendaal <ton@blender.org>2010-12-27 22:26:38 +0300
committerTon Roosendaal <ton@blender.org>2010-12-27 22:26:38 +0300
commitb2be78c0ccbeb24995584ad7d5c70ae9f49ef04a (patch)
tree6e660b3186714bf5b8e26a468748027529030003 /source
parent1a8cc0a8f051c92e03bee4ad9cb4ae0727b0a4e5 (diff)
Bugfix #25392
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!
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/node.c20
-rw-r--r--source/blender/modifiers/intern/MOD_util.c3
-rw-r--r--source/blender/render/extern/include/RE_shader_ext.h4
-rw-r--r--source/blender/render/intern/source/texture.c10
4 files changed, 34 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index f52a538cc00..0513593a0e0 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -2474,6 +2474,25 @@ static bNode *getExecutableNode(bNodeTree *ntree)
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)
@@ -2489,6 +2508,7 @@ 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)
diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c
index de96684a2dd..cbf2bd8af4b 100644
--- a/source/blender/modifiers/intern/MOD_util.c
+++ b/source/blender/modifiers/intern/MOD_util.c
@@ -53,7 +53,8 @@ void get_texture_value(Tex *texture, float *tex_co, TexResult *texres)
{
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).
diff --git a/source/blender/render/extern/include/RE_shader_ext.h b/source/blender/render/extern/include/RE_shader_ext.h
index 71ce269fce6..26e34a741f7 100644
--- a/source/blender/render/extern/include/RE_shader_ext.h
+++ b/source/blender/render/extern/include/RE_shader_ext.h
@@ -189,7 +189,11 @@ typedef struct ShadeInput
/* 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);
diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c
index 9e3c3c4e1d6..684732c10d3 100644
--- a/source/blender/render/intern/source/texture.c
+++ b/source/blender/render/intern/source/texture.c
@@ -1348,18 +1348,24 @@ int multitex_mtex(ShadeInput *shi, MTex *mtex, float *texvec, float *dxt, float
/* 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 */