[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25974] trunk/blender/source/blender/ editors/space_buttons/buttons_context.c: Fix [#19902] sculpt brush texture not accessible when the object has no material
Matt Ebb
matt at mke3.net
Thu Jan 14 00:12:48 CET 2010
Revision: 25974
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25974
Author: broken
Date: 2010-01-14 00:12:48 +0100 (Thu, 14 Jan 2010)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_buttons/buttons_context.c
Modified: trunk/blender/source/blender/editors/space_buttons/buttons_context.c
===================================================================
--- trunk/blender/source/blender/editors/space_buttons/buttons_context.c 2010-01-13 22:17:56 UTC (rev 25973)
+++ trunk/blender/source/blender/editors/space_buttons/buttons_context.c 2010-01-13 23:12:48 UTC (rev 25974)
@@ -332,16 +332,17 @@
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 @@
}
}
/* 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 @@
}
}
/* 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 @@
}
}
/* 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 @@
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 */
More information about the Bf-blender-cvs
mailing list