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:
authorCampbell Barton <ideasman42@gmail.com>2018-05-22 20:19:54 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-05-22 20:23:06 +0300
commite6c27b4dabdab84b53d22c893bef8dfbd6335685 (patch)
treef87c2ed78d706ec3dd6ef254573259c8b1a16134 /source/blender/editors/interface/interface_icons.c
parent8aebcf8b7d760d086f59bfb2335d2c636ef91d4d (diff)
Fix T55071: Brush preview fails
Diffstat (limited to 'source/blender/editors/interface/interface_icons.c')
-rw-r--r--source/blender/editors/interface/interface_icons.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 9f5c2005878..df3846b7c6b 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -1365,16 +1365,21 @@ static int ui_id_brush_get_icon(const bContext *C, ID *id)
ui_id_icon_render(C, id, true);
}
else {
+ WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = CTX_data_active_object(C);
- SpaceImage *sima;
const EnumPropertyItem *items = NULL;
int tool = PAINT_TOOL_DRAW, mode = 0;
+ ScrArea *sa = CTX_wm_area(C);
+ char space_type = sa->spacetype;
+ if (space_type == SPACE_TOPBAR) {
+ space_type = workspace->tools_space_type;
+ }
/* XXX: this is not nice, should probably make brushes
* be strictly in one paint mode only to avoid
* checking various context stuff here */
- if (CTX_wm_view3d(C) && ob) {
+ if ((space_type == SPACE_VIEW3D) && ob) {
if (ob->mode & OB_MODE_SCULPT)
mode = OB_MODE_SCULPT;
else if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT))
@@ -1382,10 +1387,19 @@ static int ui_id_brush_get_icon(const bContext *C, ID *id)
else if (ob->mode & OB_MODE_TEXTURE_PAINT)
mode = OB_MODE_TEXTURE_PAINT;
}
- else if ((sima = CTX_wm_space_image(C)) &&
- (sima->mode == SI_MODE_PAINT))
- {
- mode = OB_MODE_TEXTURE_PAINT;
+ else if (space_type == SPACE_IMAGE) {
+ int sima_mode;
+ if (sa->spacetype == space_type) {
+ SpaceImage *sima = sa->spacedata.first;
+ sima_mode = sima->mode;
+ }
+ else {
+ sima_mode = workspace->tools_mode;
+ }
+
+ if (sima_mode == SI_MODE_PAINT) {
+ mode = OB_MODE_TEXTURE_PAINT;
+ }
}
/* reset the icon */