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:
authorNicholas Bishop <nicholasbishop@gmail.com>2011-01-16 21:33:08 +0300
committerNicholas Bishop <nicholasbishop@gmail.com>2011-01-16 21:33:08 +0300
commitc94eefd52b4174be3b98b3e921546a7a8486d691 (patch)
tree87bc3c0b80c7cc6b25c66e5e43ce3abf2d521169 /source/blender/editors/interface/interface_icons.c
parent6ef1f23a33dffa1765c358b158ef18798d1ec3c0 (diff)
Fixed bug [#25649] Image editor paint icon missing until enter weight
paint A couple underlying issues: * Paint icon was looking only at the object mode to determine what the "current" mode is, but that gave problems when the object mode was anything other than texpaint, but 2D image paint was turned on. Fix was to also look at what space is being drawn, and only if it's in the 3D view does it look at the ob mode. * The brushes lists weren't getting filtered correctly in the same case where 2D image paint was on but a different object mode is enabled. Fixed by changing the brush rna poll to look at the paint source, rather than the object mode.
Diffstat (limited to 'source/blender/editors/interface/interface_icons.c')
-rw-r--r--source/blender/editors/interface/interface_icons.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index ff041c18b00..bb6738cb8cd 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -48,6 +48,7 @@
#include "DNA_brush_types.h"
#include "DNA_object_types.h"
#include "DNA_screen_types.h"
+#include "DNA_space_types.h"
#include "RNA_access.h"
#include "RNA_enum_types.h"
@@ -1028,14 +1029,15 @@ static int ui_id_brush_get_icon(bContext *C, ID *id, int preview)
}
else {
Object *ob = CTX_data_active_object(C);
- EnumPropertyItem *items;
+ SpaceImage *sima;
+ EnumPropertyItem *items = NULL;
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 */
+ /* XXX: this is not nice, should probably make brushes
+ be strictly in one paint mode only to avoid
+ checking various context stuff here */
- if(ob) {
+ if(CTX_wm_view3d(C) && ob) {
if(ob->mode & OB_MODE_SCULPT)
mode = OB_MODE_SCULPT;
else if(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT))
@@ -1043,12 +1045,10 @@ static int ui_id_brush_get_icon(bContext *C, ID *id, int preview)
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;
+ else if((sima = CTX_wm_space_image(C)) &&
+ (sima->flag & SI_DRAWTOOL)) {
+ mode = OB_MODE_TEXTURE_PAINT;
+ }
/* reset the icon */
if(mode == OB_MODE_SCULPT) {
@@ -1064,7 +1064,7 @@ static int ui_id_brush_get_icon(bContext *C, ID *id, int preview)
tool = br->imagepaint_tool;
}
- if(!RNA_enum_icon_from_value(items, tool, &id->icon_id))
+ if(!items || !RNA_enum_icon_from_value(items, tool, &id->icon_id))
id->icon_id = 0;
}