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:
authorMatt Ebb <matt@mke3.net>2010-01-14 02:12:48 +0300
committerMatt Ebb <matt@mke3.net>2010-01-14 02:12:48 +0300
commitddafe3f5df52e650e68c4e8f9ed3fc2bac7590c5 (patch)
tree49175844ca039e05d232ea22a33975a7e9cfef4a /source/blender/editors/space_buttons/buttons_context.c
parent0befa75009a7924aca838cf893c57caca33ba73a (diff)
Fix [#19902] sculpt brush texture not accessible when the object has no material
Texture handling really needs deeper improvement, this fix doesn't really help for other situations like modifiers, but solves the inconvenient case of sculpting with no material at least.
Diffstat (limited to 'source/blender/editors/space_buttons/buttons_context.c')
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index c4bdd3a6c5b..c689e994c17 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -332,16 +332,17 @@ static int buttons_context_path_texture(const bContext *C, ButsContextPath *path
World *wo;
Tex *tex;
PointerRNA *ptr= &path->ptr[path->len-1];
+ int orig_len = path->len;
/* if we already have a (pinned) texture, we're done */
if(RNA_struct_is_a(ptr->type, &RNA_Texture)) {
return 1;
}
/* try brush */
- else if((path->flag & SB_BRUSH_TEX) && buttons_context_path_brush(C, path)) {
+ if(buttons_context_path_brush(C, path)) {
br= path->ptr[path->len-1].data;
-
- if(br) {
+
+ if(br && (path->flag & SB_BRUSH_TEX)) {
tex= give_current_brush_texture(br);
RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
@@ -350,7 +351,7 @@ static int buttons_context_path_texture(const bContext *C, ButsContextPath *path
}
}
/* try world */
- else if((path->flag & SB_WORLD_TEX) && buttons_context_path_world(path)) {
+ if((path->flag & SB_WORLD_TEX) && buttons_context_path_world(path)) {
wo= path->ptr[path->len-1].data;
if(wo && GS(wo->id.name)==ID_WO) {
@@ -362,7 +363,7 @@ static int buttons_context_path_texture(const bContext *C, ButsContextPath *path
}
}
/* try material */
- else if(buttons_context_path_material(path)) {
+ if(buttons_context_path_material(path)) {
ma= path->ptr[path->len-1].data;
if(ma) {
@@ -374,7 +375,7 @@ static int buttons_context_path_texture(const bContext *C, ButsContextPath *path
}
}
/* try lamp */
- else if(buttons_context_path_data(path, OB_LAMP)) {
+ if(buttons_context_path_data(path, OB_LAMP)) {
la= path->ptr[path->len-1].data;
if(la) {
@@ -385,6 +386,19 @@ static int buttons_context_path_texture(const bContext *C, ButsContextPath *path
return 1;
}
}
+ /* try brushes again in case of no material, lamp, etc */
+ path->len = orig_len;
+ if(buttons_context_path_brush(C, path)) {
+ br= path->ptr[path->len-1].data;
+
+ if(br) {
+ tex= give_current_brush_texture(br);
+
+ RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
+ path->len++;
+ return 1;
+ }
+ }
/* TODO: material nodes */
/* no path to a texture possible */