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
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')
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c20
-rw-r--r--source/blender/editors/space_image/image_buttons.c1
-rw-r--r--source/blender/editors/space_image/space_image.c31
-rw-r--r--source/blender/editors/uvedit/uvedit_buttons.c2
4 files changed, 35 insertions, 19 deletions
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index 1b1c3bf6d13..f9244049d54 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -203,14 +203,14 @@ static void buttons_main_region_layout_properties(const bContext *C,
static void buttons_main_region_layout_tool(const bContext *C, ARegion *ar)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
const enum eContextObjectMode mode = CTX_data_mode_enum(C);
const char *contexts_base[5] = {NULL};
contexts_base[0] = ".active_tool";
const char **contexts = &contexts_base[1];
- if (workspace->tools_space_type == SPACE_VIEW3D) {
+ /* Hard coded to 3D view. */
+ {
switch (mode) {
case CTX_MODE_EDIT_MESH:
ARRAY_SET_ITEMS(contexts, ".mesh_edit");
@@ -267,22 +267,6 @@ static void buttons_main_region_layout_tool(const bContext *C, ARegion *ar)
break;
}
}
- else if (workspace->tools_space_type == SPACE_IMAGE) {
- switch (workspace->tools_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;
- }
- }
/* for grease pencil we don't use tool system yet, so we need check outside
* workspace->tools_space_type because this value is not available
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);
diff --git a/source/blender/editors/uvedit/uvedit_buttons.c b/source/blender/editors/uvedit/uvedit_buttons.c
index 3983cce6769..1482fea456d 100644
--- a/source/blender/editors/uvedit/uvedit_buttons.c
+++ b/source/blender/editors/uvedit/uvedit_buttons.c
@@ -258,6 +258,8 @@ void ED_uvedit_buttons_register(ARegionType *art)
pt = MEM_callocN(sizeof(PanelType), "spacetype image panel uv");
strcpy(pt->idname, "IMAGE_PT_uv");
strcpy(pt->label, N_("UV Vertex")); /* XXX C panels unavailable through RNA bpy.types! */
+ /* Could be 'Item' matching 3D view, avoid new tab for two buttons. */
+ strcpy(pt->category, "Image");
pt->draw = image_panel_uv;
pt->poll = image_panel_uv_poll;
BLI_addtail(&art->paneltypes, pt);