Fix crash in texture nodes, when no derivatives available, other nodes already
[blender.git] / source / blender / nodes / texture / nodes / node_texture_texture.c
index 2d5434703425ab562f2452da843a6c71a690f4d2..1b8eb3aabc673e6d44eeb7f6a114489198f16c48 100644 (file)
@@ -54,8 +54,14 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
        float co[3], dxt[3], dyt[3];
        
        copy_v3_v3(co, p->co);
-       copy_v3_v3(dxt, p->dxt);
-       copy_v3_v3(dyt, p->dyt);
+       if (p->osatex) {
+               copy_v3_v3(dxt, p->dxt);
+               copy_v3_v3(dyt, p->dyt);
+       }
+       else {
+               zero_v3(dxt);
+               zero_v3(dyt);
+       }
        
        if(node->custom2 || node->need_exec==0) {
                /* this node refers to its own texture tree! */