UI: Changes to Zoom Menus
For Image, Clip, Sequence editors, try to make their View menus a bit more consistent. Changes to Zoom menus, including showing current level if matching. Pull Request: https://projects.blender.org/blender/blender/pulls/121044
This commit is contained in:
committed by
Harley Acheson
parent
afe13df0b5
commit
7e2075b809
@@ -1287,23 +1287,29 @@ class CLIP_PT_tools_grease_pencil_draw(AnnotationDrawingToolsPanel, Panel):
|
||||
|
||||
|
||||
class CLIP_MT_view_zoom(Menu):
|
||||
bl_label = "Fractional Zoom"
|
||||
bl_label = "Zoom"
|
||||
|
||||
def draw(self, _context):
|
||||
layout = self.layout
|
||||
from math import isclose
|
||||
|
||||
current_zoom = _context.space_data.zoom_percentage
|
||||
ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1))
|
||||
|
||||
for i, (a, b) in enumerate(ratios):
|
||||
if i in {3, 4}: # Draw separators around Zoom 1:1.
|
||||
layout.separator()
|
||||
|
||||
percent = a / b * 100
|
||||
layout.operator(
|
||||
"clip.view_zoom_ratio",
|
||||
text=iface_("Zoom %d:%d") % (a, b),
|
||||
text=iface_("%g%% (%d:%d)") % (percent, a, b),
|
||||
translate=False,
|
||||
icon=('NONE', 'LAYER_ACTIVE')[isclose(percent, current_zoom, abs_tol=0.5)]
|
||||
).ratio = a / b
|
||||
|
||||
layout.separator()
|
||||
layout.operator("clip.view_zoom_in")
|
||||
layout.operator("clip.view_zoom_out")
|
||||
layout.operator("clip.view_all", text="Zoom to Fit").fit_view = True
|
||||
|
||||
|
||||
class CLIP_MT_view(Menu):
|
||||
bl_label = "View"
|
||||
@@ -1319,26 +1325,20 @@ class CLIP_MT_view(Menu):
|
||||
layout.prop(sc, "show_region_hud")
|
||||
layout.separator()
|
||||
|
||||
layout.operator("clip.view_selected")
|
||||
layout.operator("clip.view_all")
|
||||
layout.operator("clip.view_all", text="View Fit").fit_view = True
|
||||
layout.operator("clip.view_center_cursor")
|
||||
layout.menu("CLIP_MT_view_zoom")
|
||||
layout.separator()
|
||||
|
||||
layout.operator("clip.view_zoom_in")
|
||||
layout.operator("clip.view_zoom_out")
|
||||
layout.separator()
|
||||
|
||||
layout.prop(sc, "show_metadata")
|
||||
layout.separator()
|
||||
|
||||
layout.operator("clip.view_all")
|
||||
layout.operator("clip.view_selected")
|
||||
layout.operator("clip.view_center_cursor")
|
||||
|
||||
layout.menu("CLIP_MT_view_zoom")
|
||||
else:
|
||||
layout.operator_context = 'INVOKE_REGION_PREVIEW'
|
||||
layout.operator("clip.graph_view_all")
|
||||
if sc.view == 'GRAPH':
|
||||
layout.operator("clip.graph_center_current_frame")
|
||||
|
||||
layout.operator("view2d.zoom_border", text="Zoom")
|
||||
layout.operator_context = 'INVOKE_DEFAULT'
|
||||
|
||||
layout.separator()
|
||||
|
||||
@@ -83,29 +83,16 @@ class IMAGE_MT_view(Menu):
|
||||
layout.prop(sima, "use_realtime_update")
|
||||
layout.prop(uv, "show_metadata")
|
||||
|
||||
if paint.brush and (context.image_paint_object or sima.mode == 'PAINT'):
|
||||
layout.prop(uv, "show_texpaint")
|
||||
layout.prop(tool_settings, "show_uv_local_view", text="Show Same Material")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("image.view_zoom_in")
|
||||
layout.operator("image.view_zoom_out")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.menu("IMAGE_MT_view_zoom")
|
||||
|
||||
layout.separator()
|
||||
|
||||
if show_uvedit:
|
||||
layout.operator("image.view_selected", text="Frame Selected")
|
||||
|
||||
layout.operator("image.view_all")
|
||||
layout.operator("image.view_all", text="Frame All Fit").fit_view = True
|
||||
|
||||
layout.operator("image.view_center_cursor", text="Center View to Cursor")
|
||||
|
||||
layout.menu("IMAGE_MT_view_zoom")
|
||||
|
||||
layout.separator()
|
||||
|
||||
if show_render:
|
||||
@@ -118,27 +105,38 @@ class IMAGE_MT_view(Menu):
|
||||
layout.operator("image.cycle_render_slot", text="Render Slot Cycle Previous").reverse = True
|
||||
layout.separator()
|
||||
|
||||
if paint.brush and (context.image_paint_object or sima.mode == 'PAINT'):
|
||||
layout.prop(uv, "show_texpaint")
|
||||
layout.prop(tool_settings, "show_uv_local_view", text="Show Same Material")
|
||||
|
||||
layout.menu("INFO_MT_area")
|
||||
|
||||
|
||||
class IMAGE_MT_view_zoom(Menu):
|
||||
bl_label = "Fractional Zoom"
|
||||
bl_label = "Zoom"
|
||||
|
||||
def draw(self, _context):
|
||||
layout = self.layout
|
||||
from math import isclose
|
||||
|
||||
current_zoom = _context.space_data.zoom_percentage
|
||||
ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1))
|
||||
|
||||
for i, (a, b) in enumerate(ratios):
|
||||
if i in {3, 4}: # Draw separators around Zoom 1:1.
|
||||
layout.separator()
|
||||
|
||||
percent = a / b * 100
|
||||
layout.operator(
|
||||
"image.view_zoom_ratio",
|
||||
text=iface_("Zoom %d:%d") % (a, b),
|
||||
text=iface_("%g%% (%d:%d)") % (percent, a, b),
|
||||
translate=False,
|
||||
icon=('NONE', 'LAYER_ACTIVE')[isclose(percent, current_zoom, abs_tol=0.5)]
|
||||
).ratio = a / b
|
||||
|
||||
layout.separator()
|
||||
layout.operator("image.view_zoom_in")
|
||||
layout.operator("image.view_zoom_out")
|
||||
layout.operator("image.view_all", text="Zoom to Fit").fit_view = True
|
||||
layout.operator("image.view_zoom_border", text="Zoom Region...")
|
||||
|
||||
|
||||
class IMAGE_MT_select(Menu):
|
||||
bl_label = "Select"
|
||||
|
||||
@@ -366,24 +366,30 @@ class SEQUENCER_MT_range(Menu):
|
||||
|
||||
|
||||
class SEQUENCER_MT_preview_zoom(Menu):
|
||||
bl_label = "Fractional Zoom"
|
||||
bl_label = "Zoom"
|
||||
|
||||
def draw(self, _context):
|
||||
layout = self.layout
|
||||
layout.operator_context = 'INVOKE_REGION_PREVIEW'
|
||||
from math import isclose
|
||||
|
||||
current_zoom = _context.space_data.zoom_percentage
|
||||
ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1))
|
||||
|
||||
for i, (a, b) in enumerate(ratios):
|
||||
if i in {3, 4}: # Draw separators around Zoom 1:1.
|
||||
layout.separator()
|
||||
percent = a / b * 100
|
||||
|
||||
layout.operator(
|
||||
"sequencer.view_zoom_ratio",
|
||||
text=iface_("Zoom %d:%d") % (a, b),
|
||||
text=iface_("%g%% (%d:%d)") % (percent, a, b),
|
||||
translate=False,
|
||||
icon=('NONE', 'LAYER_ACTIVE')[isclose(percent, current_zoom, abs_tol=0.5)],
|
||||
).ratio = a / b
|
||||
layout.operator_context = 'INVOKE_DEFAULT'
|
||||
|
||||
layout.separator()
|
||||
layout.operator("view2d.zoom_in")
|
||||
layout.operator("view2d.zoom_out")
|
||||
layout.operator("view2d.zoom_border", text="Zoom Region...")
|
||||
|
||||
|
||||
class SEQUENCER_MT_proxy(Menu):
|
||||
@@ -444,7 +450,6 @@ class SEQUENCER_MT_view(Menu):
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
layout.operator("sequencer.view_all")
|
||||
layout.operator("sequencer.view_frame")
|
||||
layout.operator("view2d.zoom_border", text="Zoom to Border")
|
||||
layout.prop(st, "use_clamp_view")
|
||||
|
||||
if is_preview:
|
||||
@@ -453,12 +458,10 @@ class SEQUENCER_MT_view(Menu):
|
||||
layout.operator_context = 'INVOKE_REGION_PREVIEW'
|
||||
layout.operator("sequencer.view_all_preview", text="Fit Preview in Window")
|
||||
if is_sequencer_view:
|
||||
layout.menu("SEQUENCER_MT_preview_zoom", text="Fractional Preview Zoom")
|
||||
layout.menu("SEQUENCER_MT_preview_zoom", text="Preview Zoom")
|
||||
else:
|
||||
layout.operator("view2d.zoom_border", text="Zoom to Border")
|
||||
layout.menu("SEQUENCER_MT_preview_zoom")
|
||||
layout.prop(st, "use_zoom_to_fit")
|
||||
|
||||
layout.prop(st, "use_zoom_to_fit", text="Auto Zoom")
|
||||
layout.separator()
|
||||
layout.menu("SEQUENCER_MT_proxy")
|
||||
layout.operator_context = 'INVOKE_DEFAULT'
|
||||
|
||||
Reference in New Issue
Block a user