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.
This commit is contained in:
@@ -633,9 +633,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; a<MAX_MTEX; a++) {
|
||||
|
||||
/* separate tex switching */
|
||||
@@ -730,6 +728,16 @@ void init_render_materials(int r_mode, float *amb)
|
||||
{
|
||||
Material *ma;
|
||||
|
||||
/* clear these flags before going over materials, to make sure they
|
||||
* are cleared only once, otherwise node materials contained in other
|
||||
* node materials can go wrong */
|
||||
for(ma= G.main->mat.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 */
|
||||
|
||||
@@ -1356,11 +1356,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@@ -729,6 +731,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;
|
||||
@@ -739,7 +742,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;
|
||||
@@ -752,13 +754,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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1138,16 +1138,7 @@ void node_rename(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 */
|
||||
|
||||
Reference in New Issue
Block a user