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:
-rw-r--r--release/scripts/startup/bl_ui/space_properties.py4
-rw-r--r--release/scripts/startup/bl_ui/space_topbar.py30
-rw-r--r--release/scripts/startup/bl_ui/space_view3d_toolbar.py10
-rw-r--r--source/blender/editors/interface/interface_icons.c3
-rw-r--r--source/blender/editors/screen/area.c3
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c111
-rw-r--r--source/blender/makesdna/DNA_space_types.h10
-rw-r--r--source/blender/makesrna/RNA_enum_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_space.c13
9 files changed, 156 insertions, 29 deletions
diff --git a/release/scripts/startup/bl_ui/space_properties.py b/release/scripts/startup/bl_ui/space_properties.py
index 20cb5719e20..cd7137e0254 100644
--- a/release/scripts/startup/bl_ui/space_properties.py
+++ b/release/scripts/startup/bl_ui/space_properties.py
@@ -31,7 +31,9 @@ class PROPERTIES_HT_header(Header):
row = layout.row()
row.template_header()
- row.prop(view, "context", expand=True, icon_only=True)
+
+ if view.mode == 'DATA_PROPERTIES':
+ row.prop(view, "context", expand=True, icon_only=True)
classes = (
diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 53acc29dfad..243b36bdeb7 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -125,13 +125,13 @@ class TOPBAR_HT_lower_bar(Header):
# Note: general mode options should be added to 'draw_right'.
if mode == 'SCULPT':
- layout.popover_group(space_type='VIEW_3D', region_type='TOOLS', context=".paint_common", category="")
+ layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".paint_common", category="")
elif mode == 'PAINT_VERTEX':
- layout.popover_group(space_type='VIEW_3D', region_type='TOOLS', context=".paint_common", category="")
+ layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".paint_common", category="")
elif mode == 'PAINT_WEIGHT':
- layout.popover_group(space_type='VIEW_3D', region_type='TOOLS', context=".paint_common", category="")
+ layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".paint_common", category="")
elif mode == 'PAINT_TEXTURE':
- layout.popover_group(space_type='VIEW_3D', region_type='TOOLS', context=".paint_common", category="")
+ layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".paint_common", category="")
elif mode == 'EDIT_ARMATURE':
pass
elif mode == 'EDIT_CURVE':
@@ -139,9 +139,9 @@ class TOPBAR_HT_lower_bar(Header):
elif mode == 'EDIT_MESH':
pass
elif mode == 'POSE':
- layout.popover_group(space_type='VIEW_3D', region_type='TOOLS', context=".posemode", category="")
+ pass
elif mode == 'PARTICLE':
- layout.popover_group(space_type='VIEW_3D', region_type='TOOLS', context=".paint_common", category="")
+ pass
def draw_right(self, context):
layout = self.layout
@@ -151,23 +151,23 @@ class TOPBAR_HT_lower_bar(Header):
mode = context.mode
if mode == 'SCULPT':
- layout.popover_group(space_type='VIEW_3D', region_type='TOOLS', context=".sculpt_mode", category="")
+ layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".sculpt_mode", category="")
elif mode == 'PAINT_VERTEX':
- layout.popover_group(space_type='VIEW_3D', region_type='TOOLS', context=".vertexpaint", category="")
+ layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".vertexpaint", category="")
elif mode == 'PAINT_WEIGHT':
- layout.popover_group(space_type='VIEW_3D', region_type='TOOLS', context=".weightpaint", category="")
+ layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".weightpaint", category="")
elif mode == 'PAINT_TEXTURE':
- layout.popover_group(space_type='VIEW_3D', region_type='TOOLS', context=".imagepaint", category="")
+ layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".imagepaint", category="")
elif mode == 'EDIT_ARMATURE':
- layout.popover_group(space_type='VIEW_3D', region_type='TOOLS', context=".armature_edit", category="")
+ layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".armature_edit", category="")
elif mode == 'EDIT_CURVE':
- layout.popover_group(space_type='VIEW_3D', region_type='TOOLS', context=".curve_edit", category="")
+ layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".curve_edit", category="")
elif mode == 'EDIT_MESH':
- layout.popover_group(space_type='VIEW_3D', region_type='TOOLS', context=".mesh_edit", category="")
+ layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".mesh_edit", category="")
elif mode == 'POSE':
- layout.popover_group(space_type='VIEW_3D', region_type='TOOLS', context=".posemode", category="")
+ layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".posemode", category="")
elif mode == 'PARTICLE':
- layout.popover_group(space_type='VIEW_3D', region_type='TOOLS', context=".particlemode", category="")
+ layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".particlemode", category="")
# 3D View Options, tsk. maybe users aren't always using 3D view?
toolsettings = context.tool_settings
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index c38ead16dc8..f6dc64c7df7 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -36,8 +36,8 @@ from .properties_paint_common import (
class View3DPanel:
- bl_space_type = 'VIEW_3D'
- bl_region_type = 'TOOLS'
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
# **************** standard tool clusters ******************
@@ -69,7 +69,7 @@ def draw_vpaint_symmetry(layout, vpaint):
class VIEW3D_PT_tools_meshedit_options(View3DPanel, Panel):
- bl_category = ""
+ bl_category = "Options"
bl_context = ".mesh_edit" # dot on purpose (access from topbar)
bl_label = "Mesh Options"
@@ -188,8 +188,8 @@ class VIEW3D_PT_tools_posemode_options(View3DPanel, Panel):
class View3DPaintPanel(UnifiedPaintPanel):
- bl_space_type = 'VIEW_3D'
- bl_region_type = 'TOOLS'
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
class VIEW3D_PT_imapaint_tools_missing(Panel, View3DPaintPanel):
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index bacea087677..2c813d152e9 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -1371,7 +1371,8 @@ static int ui_id_brush_get_icon(const bContext *C, ID *id)
int tool = PAINT_TOOL_DRAW, mode = 0;
ScrArea *sa = CTX_wm_area(C);
char space_type = sa->spacetype;
- if (space_type == SPACE_TOPBAR) {
+ /* When in an unsupported space. */
+ if (!ELEM(space_type, SPACE_VIEW3D, SPACE_IMAGE)) {
space_type = workspace->tools_space_type;
}
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index b05496fc349..7e3764e0f04 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1825,7 +1825,8 @@ void ED_region_panels(const bContext *C, ARegion *ar, const char *contexts[], in
bool is_context_new = 0;
int scroll;
- bool use_category_tabs = (ELEM(ar->regiontype, RGN_TYPE_TOOLS, RGN_TYPE_UI)); /* XXX, should use some better check? */
+ /* XXX, should use some better check? */
+ bool use_category_tabs = (ELEM(ar->regiontype, RGN_TYPE_TOOLS, RGN_TYPE_UI, RGN_TYPE_WINDOW));
/* offset panels for small vertical tab area */
const char *category = NULL;
const int category_tabs_width = UI_PANEL_CATEGORY_MARGIN_WIDTH;
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index bb57875d8f8..c5b81b56850 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -47,6 +47,10 @@
#include "WM_message.h"
#include "RNA_access.h"
+#include "RNA_define.h"
+#include "RNA_enum_types.h"
+
+#include "UI_resources.h"
#include "buttons_intern.h" /* own include */
@@ -138,10 +142,9 @@ static void buttons_main_region_init(wmWindowManager *wm, ARegion *ar)
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
-static void buttons_main_region_draw(const bContext *C, ARegion *ar)
+static void buttons_main_region_draw_properties(const bContext *C, SpaceButs *sbuts, ARegion *ar)
{
- /* draw entirely, view changes should be handled here */
- SpaceButs *sbuts = CTX_wm_space_buts(C);
+ BLI_assert(sbuts->space_subtype == SB_SUBTYPE_DATA);
const bool vertical = (sbuts->align == BUT_VERTICAL);
buttons_context_compute(C, sbuts);
@@ -199,6 +202,81 @@ static void buttons_main_region_draw(const bContext *C, ARegion *ar)
if (contexts[0]) {
ED_region_panels(C, ar, contexts, sbuts->mainb, vertical);
}
+}
+
+static void buttons_main_region_draw_tool(const bContext *C, SpaceButs *sbuts, ARegion *ar)
+{
+ BLI_assert(sbuts->space_subtype == SB_SUBTYPE_TOOL);
+ const bool vertical = (sbuts->align == BUT_VERTICAL);
+
+ const WorkSpace *workspace = CTX_wm_workspace(C);
+ if (workspace->tools_space_type == SPACE_VIEW3D) {
+ const int mode = CTX_data_mode_enum(C);
+ const char *contexts[3] = {NULL};
+ switch (mode) {
+ case CTX_MODE_EDIT_MESH:
+ ARRAY_SET_ITEMS(contexts, ".mesh_edit");
+ break;
+ case CTX_MODE_EDIT_CURVE:
+ ARRAY_SET_ITEMS(contexts, ".curve_edit");
+ break;
+ case CTX_MODE_EDIT_SURFACE:
+ ARRAY_SET_ITEMS(contexts, ".curve_edit");
+ break;
+ case CTX_MODE_EDIT_TEXT:
+ ARRAY_SET_ITEMS(contexts, ".todo");
+ break;
+ case CTX_MODE_EDIT_ARMATURE:
+ ARRAY_SET_ITEMS(contexts, ".armature_edit");
+ break;
+ case CTX_MODE_EDIT_METABALL:
+ ARRAY_SET_ITEMS(contexts, ".todo");
+ break;
+ case CTX_MODE_EDIT_LATTICE:
+ ARRAY_SET_ITEMS(contexts, ".todo");
+ break;
+ case CTX_MODE_POSE:
+ ARRAY_SET_ITEMS(contexts, ".posemode");
+ break;
+ case CTX_MODE_SCULPT:
+ ARRAY_SET_ITEMS(contexts, ".paint_common", ".sculpt_mode");
+ break;
+ case CTX_MODE_PAINT_WEIGHT:
+ ARRAY_SET_ITEMS(contexts, ".paint_common", ".weightpaint");
+ break;
+ case CTX_MODE_PAINT_VERTEX:
+ ARRAY_SET_ITEMS(contexts, ".paint_common", ".vertexpaint");
+ break;
+ case CTX_MODE_PAINT_TEXTURE:
+ ARRAY_SET_ITEMS(contexts, ".paint_common", ".imagepaint");
+ break;
+ case CTX_MODE_PARTICLE:
+ ARRAY_SET_ITEMS(contexts, ".particlemode");
+ break;
+ case CTX_MODE_OBJECT:
+ ARRAY_SET_ITEMS(contexts, ".todo");
+ break;
+ }
+ if (contexts[0]) {
+ ED_region_panels(C, ar, contexts, -1, vertical);
+ }
+ }
+ else if (workspace->tools_space_type == SPACE_IMAGE) {
+ /* TODO */
+ }
+}
+
+static void buttons_main_region_draw(const bContext *C, ARegion *ar)
+{
+ /* draw entirely, view changes should be handled here */
+ SpaceButs *sbuts = CTX_wm_space_buts(C);
+
+ if (sbuts->space_subtype == SB_SUBTYPE_DATA) {
+ buttons_main_region_draw_properties(C, sbuts, ar);
+ }
+ else if (sbuts->space_subtype == SB_SUBTYPE_TOOL) {
+ buttons_main_region_draw_tool(C, sbuts, ar);
+ }
sbuts->re_align = 0;
sbuts->mainbo = sbuts->mainb;
@@ -242,8 +320,10 @@ static void buttons_header_region_draw(const bContext *C, ARegion *ar)
{
SpaceButs *sbuts = CTX_wm_space_buts(C);
- /* Needed for RNA to get the good values! */
- buttons_context_compute(C, sbuts);
+ if (sbuts->space_subtype == SB_SUBTYPE_DATA) {
+ /* Needed for RNA to get the good values! */
+ buttons_context_compute(C, sbuts);
+ }
ED_region_header(C, ar);
}
@@ -510,6 +590,24 @@ static void buttons_id_remap(ScrArea *UNUSED(sa), SpaceLink *slink, ID *old_id,
}
}
+static int buttons_space_subtype_get(ScrArea *sa)
+{
+ SpaceButs *sbuts = sa->spacedata.first;
+ return sbuts->space_subtype;
+}
+
+static void buttons_space_subtype_set(ScrArea *sa, int value)
+{
+ SpaceButs *sbuts = sa->spacedata.first;
+ sbuts->space_subtype = value;
+}
+
+static void buttons_space_subtype_item_extend(
+ bContext *UNUSED(C), EnumPropertyItem **item, int *totitem)
+{
+ RNA_enum_items_add(item, totitem, rna_enum_space_button_mode_items);
+}
+
/* only called once, from space/spacetypes.c */
void ED_spacetype_buttons(void)
{
@@ -528,6 +626,9 @@ void ED_spacetype_buttons(void)
st->listener = buttons_area_listener;
st->context = buttons_context;
st->id_remap = buttons_id_remap;
+ st->space_subtype_item_extend = buttons_space_subtype_item_extend;
+ st->space_subtype_get = buttons_space_subtype_get;
+ st->space_subtype_set = buttons_space_subtype_set;
/* regions: main window */
art = MEM_callocN(sizeof(ARegionType), "spacetype buttons region");
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index cd92418d17d..bbea3b168e3 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -131,12 +131,14 @@ typedef struct SpaceButs {
View2D v2d DNA_DEPRECATED; /* deprecated, copied to region */
+ /* For different kinds of property editors (exposed in the space type selector). */
+ short space_subtype;
+
short mainb, mainbo, mainbuser; /* context tabs */
short re_align, align; /* align for panels */
short preview; /* preview is signal to refresh */
char flag;
char collection_context;
- char pad[2];
void *path; /* runtime */
int pathflag, dataicon; /* runtime */
@@ -215,6 +217,12 @@ typedef enum eSpaceButtons_Align {
BUT_AUTO = 3,
} eSpaceButtons_Align;
+/* SpaceButs.flag */
+typedef enum eSpaceButtons_SubType {
+ SB_SUBTYPE_DATA = 0,
+ SB_SUBTYPE_TOOL = 1,
+} eSpaceButtons_SubType;
+
/** \} */
/* -------------------------------------------------------------------- */
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index da2705d4660..788b1372fc8 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -57,6 +57,7 @@ extern const EnumPropertyItem rna_enum_mesh_select_mode_items[];
extern const EnumPropertyItem rna_enum_mesh_delimit_mode_items[];
extern const EnumPropertyItem rna_enum_space_type_items[];
extern const EnumPropertyItem rna_enum_space_image_mode_items[];
+extern const EnumPropertyItem rna_enum_space_button_mode_items[];
extern const EnumPropertyItem rna_enum_region_type_items[];
extern const EnumPropertyItem rna_enum_object_modifier_type_items[];
extern const EnumPropertyItem rna_enum_constraint_type_items[];
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 19fd87c0735..6b54740a7a1 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -114,6 +114,12 @@ const EnumPropertyItem rna_enum_space_image_mode_items[] = {
{0, NULL, 0, NULL, NULL}
};
+/* Expanded into the Space.ui_type enum. */
+const EnumPropertyItem rna_enum_space_button_mode_items[] = {
+ {SB_SUBTYPE_DATA, "DATA_PROPERTIES", ICON_BUTS, "Data Properties", "Edit properties of active object and related data-blocks"},
+ {SB_SUBTYPE_TOOL, "TOOL_PROPERTIES", ICON_PREFERENCES, "Tool Properties", "Edit tool settings"},
+ {0, NULL, 0, NULL, NULL}
+};
#define V3D_S3D_CAMERA_LEFT {STEREO_LEFT_ID, "LEFT", ICON_RESTRICT_RENDER_OFF, "Left", ""},
#define V3D_S3D_CAMERA_RIGHT {STEREO_RIGHT_ID, "RIGHT", ICON_RESTRICT_RENDER_OFF, "Right", ""},
@@ -3000,6 +3006,13 @@ static void rna_def_space_buttons(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "SpaceButs");
RNA_def_struct_ui_text(srna, "Properties Space", "Properties space data");
+ /* Not exposed to the UI (access via space-type selector). */
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "space_subtype");
+ RNA_def_property_enum_items(prop, rna_enum_space_button_mode_items);
+ RNA_def_property_ui_text(prop, "Mode", "Arrangement of the panels");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_PROPERTIES, NULL);
+
prop = RNA_def_property(srna, "context", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "mainb");
RNA_def_property_enum_items(prop, buttons_context_items);