UI: expose gizmo orientation as a single enum

Avoids awkward logic from the popover,
by faking an extra item in the enum.
This commit is contained in:
Campbell Barton
2018-12-20 07:43:50 +11:00
parent 2bc27d3dc5
commit 1ce9a142b6
4 changed files with 57 additions and 62 deletions

View File

@@ -69,23 +69,7 @@ class _template_widget:
def draw_settings_with_index(context, layout, index):
scene = context.scene
orient_slot = scene.transform_orientation_slots[index]
use_global = orient_slot.use_global
row = layout.row(align=True)
row.label(text="Orientation:")
popover_kw = {
"panel": "VIEW3D_PT_transform_orientations_gizmo_" f"{index}",
}
if use_global:
popover_kw["text"], popover_kw["icon"] = "Scene", 'OBJECT_ORIGIN'
else:
popover_kw["text"], popover_kw["icon_value"] = orient_slot.ui_info()
sub = layout.row()
sub.ui_units_x = 4
sub.popover(**popover_kw)
layout.prop(orient_slot, "type")
class _defs_view3d_generic: