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>2011-08-15 17:17:39 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2011-08-15 17:17:39 +0400
commitb62951c0d5cccaa0e391266ccab2eb2ce74bd223 (patch)
tree260412babe35fd8223c8b2d555514a8bc16384f8 /source/blender/blenkernel/intern/texture.c
parent470b39608a33924da27a584d68c8945d28b8f4fe (diff)
Fix #28162: texture properties didn't show correct texture datablock chooser
in a particular setup with two nested material nodes. Material active texture was looking also recursively into material node, but this was already done outside of this function.
Diffstat (limited to 'source/blender/blenkernel/intern/texture.c')
-rw-r--r--source/blender/blenkernel/intern/texture.c32
1 files changed, 6 insertions, 26 deletions
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 036ba34d0c8..493baebd197 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -1005,7 +1005,7 @@ void autotexname(Tex *tex)
Tex *give_current_object_texture(Object *ob)
{
- Material *ma;
+ Material *ma, *node_ma;
Tex *tex= NULL;
if(ob==NULL) return NULL;
@@ -1015,6 +1015,10 @@ Tex *give_current_object_texture(Object *ob)
tex= give_current_lamp_texture(ob->data);
} else {
ma= give_current_material(ob, ob->actcol);
+
+ if((node_ma=give_node_material(ma)))
+ ma= node_ma;
+
tex= give_current_material_texture(ma);
}
@@ -1080,17 +1084,6 @@ Tex *give_current_material_texture(Material *ma)
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;
- }
- }
- }
- return tex;
}
if(ma) {
@@ -1165,11 +1158,6 @@ void set_current_material_texture(Material *ma, Tex *newtex)
id_us_plus(&newtex->id);
ma= NULL;
}
- else {
- node= nodeGetActiveID(ma->nodetree, ID_MA);
- if(node)
- ma= (Material*)node->id;
- }
}
if(ma) {
int act= (int)ma->texact;
@@ -1198,16 +1186,8 @@ int has_current_material_texture(Material *ma)
if(ma && ma->use_nodes && ma->nodetree) {
node= nodeGetActiveID(ma->nodetree, ID_TE);
- if(node) {
+ if(node)
return 1;
- }
- else {
- node= nodeGetActiveID(ma->nodetree, ID_MA);
- if(node)
- ma= (Material*)node->id;
- else
- ma= NULL;
- }
}
return (ma != NULL);