UI: move space-mode selectors before menu items

This adds a convention to have a spaces primary mode selector
positioned to at the left of the header.
This commit is contained in:
Campbell Barton 2018-05-01 18:47:26 +02:00
parent 0d61cab7ce
commit 52f1510613
6 changed files with 14 additions and 24 deletions

@ -57,9 +57,6 @@ class CLIP_HT_header(Header):
sc = context.space_data
clip = sc.clip
row = layout.row(align=True)
row.template_header()
CLIP_MT_tracking_editor_menus.draw_collapsible(context, layout)
row = layout.row()
@ -70,8 +67,6 @@ class CLIP_HT_header(Header):
active_object = tracking.objects.active
if sc.view == 'CLIP':
layout.prop(sc, "mode", text="")
layout.prop(sc, "view", text="", expand=True)
layout.prop(sc, "pivot_point", text="", icon_only=True)
r = active_object.reconstruction
@ -80,8 +75,6 @@ class CLIP_HT_header(Header):
layout.label(text="Solve error: %.4f" %
(r.average_error))
elif sc.view == 'GRAPH':
layout.prop(sc, "view", text="", expand=True)
row = layout.row(align=True)
row.prop(sc, "show_graph_only_selected", text="")
row.prop(sc, "show_graph_hidden", text="")
@ -103,7 +96,6 @@ class CLIP_HT_header(Header):
text="Filters")
elif sc.view == 'DOPESHEET':
dopesheet = tracking.dopesheet
layout.prop(sc, "view", text="", expand=True)
row = layout.row(align=True)
row.prop(dopesheet, "show_only_selected", text="")
@ -113,8 +105,6 @@ class CLIP_HT_header(Header):
row.prop(dopesheet, "sort_method", text="")
row.prop(dopesheet, "use_invert_sort",
text="Invert", toggle=True)
else:
layout.prop(sc, "view", text="", expand=True)
def _draw_masking(self, context):
layout = self.layout
@ -123,17 +113,12 @@ class CLIP_HT_header(Header):
sc = context.space_data
clip = sc.clip
row = layout.row(align=True)
row.template_header()
CLIP_MT_masking_editor_menus.draw_collapsible(context, layout)
row = layout.row()
row.template_ID(sc, "clip", open="clip.open")
if clip:
layout.prop(sc, "mode", text="")
row = layout.row()
row.template_ID(sc, "mask", new="mask.new")
@ -151,7 +136,12 @@ class CLIP_HT_header(Header):
sc = context.space_data
row = layout.row(align=True)
row.template_header()
layout.prop(sc, "mode", text="")
if sc.mode == 'TRACKING':
layout.prop(sc, "view", text="", icon_only=True)
self._draw_tracking(context)
else:
self._draw_masking(context)

@ -443,14 +443,14 @@ class IMAGE_HT_header(Header):
row = layout.row(align=True)
row.template_header()
layout.prop(sima, "mode", text="")
MASK_MT_editor_menus.draw_collapsible(context, layout)
layout.template_ID(sima, "image", new="image.new", open="image.open")
if not show_render:
layout.prop(sima, "use_image_pin", text="")
layout.prop(sima, "mode", text="")
if show_maskedit:
row = layout.row()
row.template_ID(sima, "mask", new="mask.new")

@ -48,9 +48,9 @@ class NODE_HT_header(Header):
row = layout.row(align=True)
row.template_header()
NODE_MT_editor_menus.draw_collapsible(context, layout)
layout.prop(snode, "tree_type", text="")
layout.prop(snode, "tree_type", text="", expand=True)
NODE_MT_editor_menus.draw_collapsible(context, layout)
if snode.tree_type == 'ShaderNodeTree':
layout.prop(snode, "shader_type", text="", expand=True)

@ -36,10 +36,10 @@ class OUTLINER_HT_header(Header):
row = layout.row(align=True)
row.template_header()
OUTLINER_MT_editor_menus.draw_collapsible(context, layout)
layout.prop(space, "display_mode", text="")
OUTLINER_MT_editor_menus.draw_collapsible(context, layout)
if space.display_mode == 'DATABLOCKS':
layout.separator()

@ -79,14 +79,14 @@ class SEQUENCER_HT_header(Header):
row = layout.row(align=True)
row.template_header()
layout.prop(st, "view_type", text="")
SEQUENCER_MT_editor_menus.draw_collapsible(context, layout)
row = layout.row(align=True)
row.prop(scene, "use_preview_range", text="", toggle=True)
row.prop(scene, "lock_frame_selection_to_range", text="", toggle=True)
layout.prop(st, "view_type", expand=True, text="")
if st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'}:
layout.prop(st, "display_mode", expand=True, text="")

@ -2969,7 +2969,7 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
static const EnumPropertyItem view_type_items[] = {
{SEQ_VIEW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""},
{SEQ_VIEW_PREVIEW, "PREVIEW", ICON_SEQ_PREVIEW, "Image Preview", ""},
{SEQ_VIEW_SEQUENCE_PREVIEW, "SEQUENCER_PREVIEW", ICON_SEQ_SPLITVIEW, "Sequencer and Image Preview", ""},
{SEQ_VIEW_SEQUENCE_PREVIEW, "SEQUENCER_PREVIEW", ICON_SEQ_SPLITVIEW, "Sequencer/Preview", ""},
{0, NULL, 0, NULL, NULL}
};