[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33647] trunk/blender/source/blender: Fixed bug #23826, Other kind of brushes appear in sculpt mode
Nicholas Bishop
nicholasbishop at gmail.com
Tue Dec 14 02:19:51 CET 2010
Revision: 33647
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33647
Author: nicholasbishop
Date: 2010-12-14 02:19:51 +0100 (Tue, 14 Dec 2010)
Log Message:
-----------
Fixed bug #23826, Other kind of brushes appear in sculpt mode
Was another problem caused by each brush being allowed in more than
one paint mode.
Added a new field to the brush struct to indicate what mode the icon
was last set for; if it's changed then reset it. Not sure if it's
really worth it to cache this, could remove it for simplicity.
Modified Paths:
--------------
trunk/blender/source/blender/editors/interface/interface_icons.c
trunk/blender/source/blender/makesdna/DNA_brush_types.h
Modified: trunk/blender/source/blender/editors/interface/interface_icons.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_icons.c 2010-12-13 21:22:30 UTC (rev 33646)
+++ trunk/blender/source/blender/editors/interface/interface_icons.c 2010-12-14 01:19:51 UTC (rev 33647)
@@ -1026,30 +1026,46 @@
BKE_icon_getid(id);
ui_id_icon_render(C, id, preview);
}
- else if(!id->icon_id) {
- /* no icon found, reset it */
-
- /* this is not nice, should probably make
- brushes be strictly in one paint mode only
- to avoid this kind of thing */
+ else {
Object *ob = CTX_data_active_object(C);
EnumPropertyItem *items;
- int tool;
-
- if(ob && (ob->mode & OB_MODE_SCULPT)) {
+ int tool, mode = 0;
+
+ /* this is not nice, should probably make brushes be
+ strictly in one paint mode only to avoid checking
+ object mode here */
+
+ if(ob) {
+ if(ob->mode & OB_MODE_SCULPT)
+ mode = OB_MODE_SCULPT;
+ else if(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT))
+ mode = OB_MODE_VERTEX_PAINT;
+ else if(ob->mode & OB_MODE_TEXTURE_PAINT)
+ mode = OB_MODE_TEXTURE_PAINT;
+ }
+
+ /* check if cached icon is OK */
+ if(!mode || (id->icon_id && mode == br->icon_mode))
+ return id->icon_id;
+
+ br->icon_mode = mode;
+
+ /* reset the icon */
+ if(mode == OB_MODE_SCULPT) {
items = brush_sculpt_tool_items;
tool = br->sculpt_tool;
}
- else if(ob && (ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT))) {
+ else if(mode == OB_MODE_VERTEX_PAINT) {
items = brush_vertexpaint_tool_items;
tool = br->vertexpaint_tool;
}
- else {
+ else if(mode == OB_MODE_TEXTURE_PAINT) {
items = brush_imagepaint_tool_items;
tool = br->imagepaint_tool;
}
- RNA_enum_icon_from_value(items, tool, &id->icon_id);
+ if(!RNA_enum_icon_from_value(items, tool, &id->icon_id))
+ id->icon_id = 0;
}
return id->icon_id;
Modified: trunk/blender/source/blender/makesdna/DNA_brush_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_brush_types.h 2010-12-13 21:22:30 UTC (rev 33646)
+++ trunk/blender/source/blender/makesdna/DNA_brush_types.h 2010-12-14 01:19:51 UTC (rev 33647)
@@ -57,7 +57,10 @@
struct ImBuf *icon_imbuf;
PreviewImage *preview;
char icon_filepath[240];
+ int icon_mode; /* store paint mode for which brush's icon was last generated */
+ int pad;
+
float normal_weight;
short blend; /* blend mode */
More information about the Bf-blender-cvs
mailing list