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
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2010-01-29 19:32:06 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2010-01-29 19:32:06 +0300
commit812e5140b0b0a8e1569ceac3fac1852274ea3a2c (patch)
treef21c7a1c0ea8bac569516aee277c610e2dcf2fcd /source/blender/blenkernel
parente803c033088a4b17b9a0f142851801e26f3395ba (diff)
Fix #20549: selecting a texture node in a material node tree would
keep that texture locked as the current visible texture in the texture buttons.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_texture.h3
-rw-r--r--source/blender/blenkernel/intern/texture.c14
2 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h
index 95ada45f5d8..735a4e1dd71 100644
--- a/source/blender/blenkernel/BKE_texture.h
+++ b/source/blender/blenkernel/BKE_texture.h
@@ -31,6 +31,7 @@
#ifndef BKE_TEXTURE_H
#define BKE_TEXTURE_H
+struct bNode;
struct Brush;
struct ColorBand;
struct EnvMap;
@@ -75,6 +76,8 @@ struct Tex *give_current_lamp_texture(struct Lamp *la);
struct Tex *give_current_world_texture(struct World *world);
struct Tex *give_current_brush_texture(struct Brush *br);
+struct bNode *give_current_material_texture_node(struct Material *ma);
+
int give_active_mtex(struct ID *id, struct MTex ***mtex_ar, short *act);
void set_active_mtex(struct ID *id, short act);
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index c60001db314..634d9e6ce0d 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -858,6 +858,16 @@ void set_current_lamp_texture(Lamp *la, Tex *newtex)
}
}
+bNode *give_current_material_texture_node(Material *ma)
+{
+ bNode *node;
+
+ if(ma && ma->use_nodes && ma->nodetree)
+ return nodeGetActiveID(ma->nodetree, ID_TE);
+
+ return NULL;
+}
+
Tex *give_current_material_texture(Material *ma)
{
MTex *mtex= NULL;
@@ -865,6 +875,9 @@ Tex *give_current_material_texture(Material *ma)
bNode *node;
if(ma && ma->use_nodes && ma->nodetree) {
+ /* first check texture, then material, this works together
+ with a hack that clears the active ID flag for textures on
+ making a material node active */
node= nodeGetActiveID(ma->nodetree, ID_TE);
if(node) {
@@ -877,6 +890,7 @@ Tex *give_current_material_texture(Material *ma)
ma= (Material*)node->id;
}
}
+
if(ma) {
mtex= ma->mtex[(int)(ma->texact)];
if(mtex) tex= mtex->tex;