From f803b2054cabad07bc8bb977016217ac50a769a8 Mon Sep 17 00:00:00 2001 From: Diego Hernan Borghetti Date: Fri, 14 Mar 2008 15:20:21 -0300 Subject: [PATCH] Fix for bug #8555: geometry node front/bake was broken. Fix for bug #7418: texture ipo's didn't show for textures in node materials. Fix for part of bug #6758: node materials in other node materials could miss texture coordinates. Author: Brecht Van Lommel SVN revision: 14110 Date: 2008-03-14 15:08:27 -0300 (Fri, 14 Mar 2008) --- source/blender/blenkernel/intern/material.c | 14 +++++++++++--- source/blender/blenkernel/intern/node.c | 10 ++++++++++ source/blender/blenkernel/intern/texture.c | 20 +++++++++++++++++--- source/blender/render/intern/include/rendercore.h | 4 ++-- source/blender/src/editnode.c | 11 +---------- 5 files changed, 41 insertions(+), 18 deletions(-) diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index c78f7a9..c2b2ed2 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -628,9 +628,7 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb) if(ma->flarec==0) ma->flarec= 1; - /* add all texcoflags from mtex */ - ma->texco= 0; - ma->mapto= 0; + /* add all texcoflags from mtex, texco and mapto were cleared in advance */ for(a=0; amat.first; ma; ma= ma->id.next) { + if(ma->id.us) { + ma->texco= 0; + ma->mapto= 0; + } + } + /* two steps, first initialize, then or the flags for layers */ for(ma= G.main->mat.first; ma; ma= ma->id.next) { /* is_used flag comes back in convertblender.c */ diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index b51626f..f6f374b 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1269,11 +1269,21 @@ bNode *nodeGetActiveID(bNodeTree *ntree, short idtype) bNode *node; if(ntree==NULL) return NULL; + + /* check for group edit */ + for(node= ntree->nodes.first; node; node= node->next) + if(node->flag & NODE_GROUP_EDIT) + break; + + if(node) + ntree= (bNodeTree*)node->id; + /* now find active node with this id */ for(node= ntree->nodes.first; node; node= node->next) if(node->id && GS(node->id->name)==idtype) if(node->flag & NODE_ACTIVE_ID) break; + return node; } diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index ebe4d9b..be13b87 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -55,6 +55,7 @@ #include "DNA_image_types.h" #include "DNA_world_types.h" #include "DNA_brush_types.h" +#include "DNA_node_types.h" #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" @@ -75,6 +76,7 @@ #include "BKE_icons.h" #include "BKE_ipo.h" #include "BKE_brush.h" +#include "BKE_node.h" /* ------------------------------------------------------------------------- */ @@ -716,6 +718,7 @@ Tex *give_current_texture(Object *ob, int act) Lamp *la = 0; MTex *mtex = 0; Tex *tex = 0; + bNode *node; if(ob==0) return 0; if(ob->totcol==0) return 0; @@ -726,7 +729,6 @@ Tex *give_current_texture(Object *ob, int act) mtex= la->mtex[(int)(la->texact)]; if(mtex) tex= mtex->tex; } - else tex= 0; } else { if(act>ob->totcol) act= ob->totcol; else if(act==0) act= 1; @@ -739,13 +741,25 @@ Tex *give_current_texture(Object *ob, int act) if(matarar && *matarar) ma= (*matarar)[act-1]; else ma= 0; - + } + + if(ma && ma->use_nodes && ma->nodetree) { + node= nodeGetActiveID(ma->nodetree, ID_TE); + + if(node) { + tex= (Tex *)node->id; + ma= NULL; + } + else { + node= nodeGetActiveID(ma->nodetree, ID_MA); + if(node) + ma= (Material*)node->id; + } } if(ma) { mtex= ma->mtex[(int)(ma->texact)]; if(mtex) tex= mtex->tex; } - else tex= 0; } return tex; diff --git a/source/blender/render/intern/include/rendercore.h b/source/blender/render/intern/include/rendercore.h index da8a2f9..b58b17e 100644 --- a/source/blender/render/intern/include/rendercore.h +++ b/source/blender/render/intern/include/rendercore.h @@ -40,8 +40,8 @@ /* vector defines */ -#define CROSS(dest, a, b) dest[0]= a[1] * b[2] - a[2] * b[1]; dest[1]= a[2] * b[0] - a[0] * b[2]; dest[2]= a[0] * b[1] - a[1] * b[0] -#define VECMUL(dest, f) dest[0]*= f; dest[1]*= f; dest[2]*= f +#define CROSS(dest, a, b) { dest[0]= a[1] * b[2] - a[2] * b[1]; dest[1]= a[2] * b[0] - a[0] * b[2]; dest[2]= a[0] * b[1] - a[1] * b[0]; } +#define VECMUL(dest, f) { dest[0]*= f; dest[1]*= f; dest[2]*= f; } struct HaloRen; struct ShadeInput; diff --git a/source/blender/src/editnode.c b/source/blender/src/editnode.c index b34b829..63f6ca8 100644 --- a/source/blender/src/editnode.c +++ b/source/blender/src/editnode.c @@ -1099,16 +1099,7 @@ void node_rename_cb(SpaceNode *snode) /* used in buttons to check context, also checks for edited groups */ bNode *editnode_get_active_idnode(bNodeTree *ntree, short id_code) { - bNode *node; - - /* check for edited group */ - for(node= ntree->nodes.first; node; node= node->next) - if(node->flag & NODE_GROUP_EDIT) - break; - if(node) - return nodeGetActiveID((bNodeTree *)node->id, id_code); - else - return nodeGetActiveID(ntree, id_code); + return nodeGetActiveID(ntree, id_code); } /* used in buttons to check context, also checks for edited groups */ -- 2.11.4.GIT