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>2019-05-01 05:35:00 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-05-01 05:35:00 +0300
commit340c564020f580579e2d7db63ba860527cd72ea3 (patch)
treeeb9ad773560c621aae4806944d093f27156e5253 /source/blender/editors/space_image
parent3ae872d9abb899fa1a3f581fe0064b6941758d50 (diff)
UI: move image paint panels into the image side-bar
- Move painting brush panels into the image side-bar. - Add active tool panel to the image side-bar.
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r--source/blender/editors/space_image/image_buttons.c1
-rw-r--r--source/blender/editors/space_image/space_image.c31
2 files changed, 31 insertions, 1 deletions
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index f5dd0c4ad53..752eedebe71 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -1371,6 +1371,7 @@ void image_buttons_register(ARegionType *art)
pt = MEM_callocN(sizeof(PanelType), "spacetype image panel metadata");
strcpy(pt->idname, "IMAGE_PT_metadata");
strcpy(pt->label, N_("Metadata"));
+ strcpy(pt->category, "Image");
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
pt->poll = metadata_panel_context_poll;
pt->draw = metadata_panel_context_draw;
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index ae2620118e9..248497a15ef 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -743,6 +743,33 @@ static void image_buttons_region_init(wmWindowManager *wm, ARegion *ar)
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
+static void image_buttons_region_layout(const bContext *C, ARegion *ar)
+{
+ const enum eContextObjectMode mode = CTX_data_mode_enum(C);
+ const char *contexts_base[3] = {NULL};
+
+ const char **contexts = contexts_base;
+
+ SpaceImage *sima = CTX_wm_space_image(C);
+ switch (sima->mode) {
+ case SI_MODE_VIEW:
+ break;
+ case SI_MODE_PAINT:
+ ARRAY_SET_ITEMS(contexts, ".paint_common_2d", ".imagepaint_2d");
+ break;
+ case SI_MODE_MASK:
+ break;
+ case SI_MODE_UV:
+ if (mode == CTX_MODE_EDIT_MESH) {
+ ARRAY_SET_ITEMS(contexts, ".uv_sculpt");
+ }
+ break;
+ }
+
+ const bool vertical = true;
+ ED_region_panels_layout_ex(C, ar, contexts_base, -1, vertical);
+}
+
static void image_buttons_region_draw(const bContext *C, ARegion *ar)
{
SpaceImage *sima = CTX_wm_space_image(C);
@@ -769,7 +796,8 @@ static void image_buttons_region_draw(const bContext *C, ARegion *ar)
}
ED_space_image_release_buffer(sima, ibuf, lock);
- ED_region_panels(C, ar);
+ /* Layout handles details. */
+ ED_region_panels_draw(C, ar);
}
static void image_buttons_region_listener(wmWindow *UNUSED(win),
@@ -1014,6 +1042,7 @@ void ED_spacetype_image(void)
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
art->listener = image_buttons_region_listener;
art->init = image_buttons_region_init;
+ art->layout = image_buttons_region_layout;
art->draw = image_buttons_region_draw;
BLI_addhead(&st->regiontypes, art);