diff options
author | Matt Ebb <matt@mke3.net> | 2010-04-22 10:59:41 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2010-04-22 10:59:41 +0400 |
commit | a2b6abeee15f359ddeafdea7a2f3a965da0bf410 (patch) | |
tree | 57d81fe3a168e26e5895d781c2d054d62c9141f9 /source/blender/editors/space_buttons/buttons_context.c | |
parent | 5c948964901435ee22596dc6180284605ab3b52d (diff) |
Fix [#22097] missing panels in texture tab
Made texture/texture slot context a bit less flaky when dealing with active material and
texture nodes inside a node material in the node editor. Now if the active material has
nodes enabled, and there are no active material/texture nodes inside it, nothing will be
shown in the texture properties (similar to 2.49).
Diffstat (limited to 'source/blender/editors/space_buttons/buttons_context.c')
-rw-r--r-- | source/blender/editors/space_buttons/buttons_context.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 961c3cf17ce..da6f9fa3f1e 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -699,11 +699,20 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r Material *ma= ptr->data; /* if we have a node material, get slot from material in material node */ - if(ma && ma->use_nodes && ma->nodetree) + if(ma && ma->use_nodes && ma->nodetree) { + /* if there's an active texture node in the node tree, + * then that texture is in context directly, without a texture slot */ + if (give_current_material_texture_node(ma)) + return 0; + ma= give_node_material(ma); - - if(ma) + if (ma) + CTX_data_pointer_set(result, &ma->id, &RNA_MaterialTextureSlot, ma->mtex[(int)ma->texact]); + else + return 0; + } else if(ma) { CTX_data_pointer_set(result, &ma->id, &RNA_MaterialTextureSlot, ma->mtex[(int)ma->texact]); + } } else if((ptr=get_pointer_type(path, &RNA_Lamp))) { Lamp *la= ptr->data; |