Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Odom <clockmender@icloud.com>2020-01-07 10:57:32 +0300
committerRune Morling <ermo.blender.org@spammesenseless.net>2020-01-15 00:26:56 +0300
commit20598a3ac66c9fe76e418d86bf4047c79f2c9818 (patch)
treec863e153c3466eb5b55b763d429e4b2c8c797e93 /precision_drawing_tools
parent2af992e5181d1a739d433b1255e2e1547a6b420b (diff)
PDT: Re-Arrange Menus to UI Panel Width
The menus now are re-arranged according to the width of the UI. A cut-off value is set in the Add-on Preferences. Remove vestiges of automatic UI highlighting experiment.
Diffstat (limited to 'precision_drawing_tools')
-rw-r--r--precision_drawing_tools/__init__.py7
-rw-r--r--precision_drawing_tools/pdt_menus.py70
-rw-r--r--precision_drawing_tools/pdt_msg_strings.py4
-rw-r--r--precision_drawing_tools/pdt_view.py24
4 files changed, 73 insertions, 32 deletions
diff --git a/precision_drawing_tools/__init__.py b/precision_drawing_tools/__init__.py
index a0e254c9..35e55158 100644
--- a/precision_drawing_tools/__init__.py
+++ b/precision_drawing_tools/__init__.py
@@ -442,6 +442,12 @@ class PDTPreferences(AddonPreferences):
description="NOTE: Does not enable debugging globally in Blender (only in PDT scripts)"
)
+ pdt_ui_width : IntProperty(
+ name='UI Width Cut-off',
+ default=350,
+ description="Cutoff width for shrinking items per line in menus"
+ )
+
def draw(self, context):
layout = self.layout
@@ -449,6 +455,7 @@ class PDTPreferences(AddonPreferences):
row1 = box.row()
row2 = box.row()
row1.prop(self, "debug")
+ row1.prop(self, "pdt_ui_width")
row2.prop(self, "pdt_library_path")
diff --git a/precision_drawing_tools/pdt_menus.py b/precision_drawing_tools/pdt_menus.py
index f91c068b..01cd5d09 100644
--- a/precision_drawing_tools/pdt_menus.py
+++ b/precision_drawing_tools/pdt_menus.py
@@ -21,6 +21,7 @@
# Author: Alan Odom (Clockmender), Rune Morling (ermo) Copyright (c) 2019
# -----------------------------------------------------------------------
#
+import bpy
from bpy.types import Panel
from .pdt_msg_strings import (
PDT_LAB_ABS,
@@ -64,6 +65,23 @@ from .pdt_msg_strings import (
PDT_LAB_VARIABLES
)
+def ui_width():
+ """Return the Width of the UI Panel.
+
+ Args:
+ None.
+
+ Returns:
+ UI Width.
+ """
+
+ area = bpy.context.area
+ resolution = bpy.context.preferences.system.ui_scale
+
+ for reg in area.regions:
+ if reg.type == "UI":
+ region_width = reg.width
+ return region_width
# PDT Panel menus
#
@@ -76,6 +94,7 @@ class PDT_PT_PanelDesign(Panel):
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
+ ui_cutoff = bpy.context.preferences.addons[__package__].preferences.pdt_ui_width
layout = self.layout
pdt_pg = context.scene.pdt_pg
#
@@ -112,9 +131,10 @@ class PDT_PT_PanelDesign(Panel):
# cartesian input coordinates in a box
row = box_1a.row()
box = row.box()
- #box.label(text="Cartesian Coordinates:")
row = box.row()
- row.prop(pdt_pg, "cartesian_coords", text=PDT_LAB_CVALUE)
+ split = row.split(factor=0.35, align=True)
+ split.label(text=PDT_LAB_CVALUE)
+ split.prop(pdt_pg, "cartesian_coords", text="")
row = box.row()
row.operator("pdt.absolute", icon="EMPTY_AXIS", text=f"{PDT_LAB_ABS} »")
row.operator("pdt.delta", icon="EMPTY_AXIS", text=f"{PDT_LAB_DEL} »")
@@ -145,6 +165,8 @@ class PDT_PT_PanelDesign(Panel):
box = box_1b.box()
row = box.row()
row.operator("pdt.intersect", text=f"|4| {PDT_LAB_INTERSECT} »")
+ if ui_width() < ui_cutoff:
+ row = box.row()
row.prop(pdt_pg, "object_order", text=PDT_LAB_ORDER)
#
# percentage row
@@ -154,6 +176,8 @@ class PDT_PT_PanelDesign(Panel):
row = box.row()
row.operator("pdt.percent", text=f"|2| % »")
row.prop(pdt_pg, "percent", text=PDT_LAB_PERCENTS)
+ if ui_width() < ui_cutoff:
+ row = box.row()
row.prop(pdt_pg, "flip_percent", text=PDT_LAB_FLIPPERCENT)
# -----
@@ -200,24 +224,30 @@ class PDT_PT_PanelPivotPoint(Panel):
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
+ ui_cutoff = bpy.context.preferences.addons[__package__].preferences.pdt_ui_width
pdt_pg = context.scene.pdt_pg
layout = self.layout
row = layout.row()
- split = row.split(factor=0.4, align=True)
+ col = row.column()
if context.window_manager.pdt_run_opengl is False:
icon = "PLAY"
txt = "Show"
else:
icon = "PAUSE"
txt = "Hide"
- split.operator("pdt.modaldraw", icon=icon, text=txt)
- split.prop(pdt_pg, "pivot_size", text=PDT_LAB_PIVOTSIZE)
- split.prop(pdt_pg, "pivot_width", text=PDT_LAB_PIVOTWIDTH)
- split.prop(pdt_pg, "pivot_alpha", text=PDT_LAB_PIVOTALPHA)
- row = layout.row()
- row.label(text=PDT_LAB_PIVOTLOCH)
+ col.operator("pdt.modaldraw", icon=icon, text=txt)
+ col = row.column()
+ col.prop(pdt_pg, "pivot_size", text=PDT_LAB_PIVOTSIZE)
+ if ui_width() < ui_cutoff:
+ row = layout.row()
+ col = row.column()
+ col.prop(pdt_pg, "pivot_width", text=PDT_LAB_PIVOTWIDTH)
+ col = row.column()
+ col.prop(pdt_pg, "pivot_alpha", text=PDT_LAB_PIVOTALPHA)
row = layout.row()
- row.prop(pdt_pg, "pivot_loc", text=PDT_LAB_PIVOTLOC)
+ split = row.split(factor=0.35, align=True)
+ split.label(text=PDT_LAB_PIVOTLOCH)
+ split.prop(pdt_pg, "pivot_loc", text=PDT_LAB_PIVOTLOC)
row = layout.row()
col = row.column()
col.operator("pdt.pivotselected", icon="EMPTY_AXIS", text="Selection")
@@ -241,9 +271,9 @@ class PDT_PT_PanelPivotPoint(Panel):
col = row.column()
col.prop(pdt_pg, "distance", text="System Distance")
row = layout.row()
- row.label(text="Pivot Point Scale Factors")
- row = layout.row()
- row.prop(pdt_pg, "pivot_scale", text="")
+ split = row.split(factor=0.35, align=True)
+ split.label(text="Scale")
+ split.prop(pdt_pg, "pivot_scale", text="")
row = layout.row()
col = row.column()
col.operator("pdt.pivotwrite", icon="FILE_TICK", text="PP Write")
@@ -260,6 +290,7 @@ class PDT_PT_PanelPartsLibrary(Panel):
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
+ ui_cutoff = context.preferences.addons[__package__].preferences.pdt_ui_width
layout = self.layout
pdt_pg = context.scene.pdt_pg
row = layout.row()
@@ -267,6 +298,8 @@ class PDT_PT_PanelPartsLibrary(Panel):
col.operator("pdt.append", text="Append")
col = row.column()
col.operator("pdt.link", text="Link")
+ if ui_width() < ui_cutoff:
+ row = layout.row()
col = row.column()
col.prop(pdt_pg, "lib_mode", text="")
box = layout.box()
@@ -305,8 +338,13 @@ class PDT_PT_PanelViewControl(Panel):
bl_category = "PDT"
bl_options = {'DEFAULT_CLOSED'}
+ # Sub-layout highlight states
+ _ui_groups = [False, False]
+
def draw(self, context):
+ ui_cutoff = context.preferences.addons[__package__].preferences.pdt_ui_width
layout = self.layout
+ ui_groups = self._ui_groups
pdt_pg = context.scene.pdt_pg
box = layout.box()
row = box.row()
@@ -315,10 +353,14 @@ class PDT_PT_PanelViewControl(Panel):
col = row.column()
col.operator("pdt.viewrot", text="Rotate Abs")
row = box.row()
- row.prop(pdt_pg, "rotation_coords", text="Rotation")
+ split = row.split(factor=0.35, align=True)
+ split.label(text="Rotation")
+ split.prop(pdt_pg, "rotation_coords", text="")
row = box.row()
col = row.column()
col.prop(pdt_pg, "vrotangle", text="Angle")
+ if ui_width() < ui_cutoff:
+ row = box.row()
col = row.column()
col.operator("pdt.viewleft", text="", icon="TRIA_LEFT")
col = row.column()
diff --git a/precision_drawing_tools/pdt_msg_strings.py b/precision_drawing_tools/pdt_msg_strings.py
index 703a0b7b..46d8d635 100644
--- a/precision_drawing_tools/pdt_msg_strings.py
+++ b/precision_drawing_tools/pdt_msg_strings.py
@@ -43,7 +43,7 @@ PDT_LAB_FLIPANGLE = "Flip Angle"
PDT_LAB_FLIPPERCENT = "Flip %"
PDT_LAB_ALLACTIVE = "All/Active"
PDT_LAB_VARIABLES = "Coordinates/Delta Offsets & Other Variables"
-PDT_LAB_CVALUE = "" # Intentionally left blank
+PDT_LAB_CVALUE = "Coordinates"
PDT_LAB_DISVALUE = "Distance"
PDT_LAB_ANGLEVALUE = "Angle"
PDT_LAB_PERCENTS = "%"
@@ -66,7 +66,7 @@ PDT_LAB_PIVOTSIZE = "" # Intentionally left blank
PDT_LAB_PIVOTWIDTH = "" # Intentionally left blank
PDT_LAB_PIVOTALPHA = "" # Intentionally left blank
PDT_LAB_PIVOTLOC = "" # Intentionally left blank
-PDT_LAB_PIVOTLOCH = "Pivot Point Location"
+PDT_LAB_PIVOTLOCH = "Location"
#
# Error Message
#
diff --git a/precision_drawing_tools/pdt_view.py b/precision_drawing_tools/pdt_view.py
index 5257515f..85de8959 100644
--- a/precision_drawing_tools/pdt_view.py
+++ b/precision_drawing_tools/pdt_view.py
@@ -32,11 +32,10 @@ from .pdt_functions import debug, euler_to_quaternion
class PDT_OT_ViewRot(Operator):
- """Rotate View using X Y Z Absolute Rotations."""
-
bl_idname = "pdt.viewrot"
bl_label = "Rotate View"
bl_options = {"REGISTER", "UNDO"}
+ bl_description = "View Rotation by Absolute Values"
def execute(self, context):
"""View Rotation by Absolute Values.
@@ -68,11 +67,10 @@ class PDT_OT_ViewRot(Operator):
class PDT_OT_vRotL(Operator):
- """Orbit View to Left by Angle."""
-
bl_idname = "pdt.viewleft"
bl_label = "Rotate Left"
bl_options = {"REGISTER", "UNDO"}
+ bl_description = "View Orbit Left by Delta Value"
def execute(self, context):
"""View Orbit Left by Delta Value.
@@ -97,11 +95,10 @@ class PDT_OT_vRotL(Operator):
class PDT_OT_vRotR(Operator):
- """Orbit View to Right by Angle."""
-
bl_idname = "pdt.viewright"
bl_label = "Rotate Right"
bl_options = {"REGISTER", "UNDO"}
+ bl_description = "View Orbit Right by Delta Value"
def execute(self, context):
"""View Orbit Right by Delta Value.
@@ -127,11 +124,10 @@ class PDT_OT_vRotR(Operator):
class PDT_OT_vRotU(Operator):
- """Orbit View to Up by Angle."""
-
bl_idname = "pdt.viewup"
bl_label = "Rotate Up"
bl_options = {"REGISTER", "UNDO"}
+ bl_description = "View Orbit Up by Delta Value"
def execute(self, context):
"""View Orbit Up by Delta Value.
@@ -157,11 +153,10 @@ class PDT_OT_vRotU(Operator):
class PDT_OT_vRotD(Operator):
- """Orbit View to Down by Angle."""
-
bl_idname = "pdt.viewdown"
bl_label = "Rotate Down"
bl_options = {"REGISTER", "UNDO"}
+ bl_description = "View Orbit Down by Delta Value"
def execute(self, context):
"""View Orbit Down by Delta Value.
@@ -187,11 +182,10 @@ class PDT_OT_vRotD(Operator):
class PDT_OT_vRoll(Operator):
- """Roll View by Angle."""
-
bl_idname = "pdt.viewroll"
bl_label = "Roll View"
bl_options = {"REGISTER", "UNDO"}
+ bl_description = "View Roll by Delta Value"
def execute(self, context):
"""View Roll by Delta Value.
@@ -217,11 +211,10 @@ class PDT_OT_vRoll(Operator):
class PDT_OT_viso(Operator):
- """Isometric View."""
-
bl_idname = "pdt.viewiso"
bl_label = "Isometric View"
bl_options = {"REGISTER", "UNDO"}
+ bl_description = "Isometric View."
def execute(self, context):
"""Set Isometric View.
@@ -245,11 +238,10 @@ class PDT_OT_viso(Operator):
class PDT_OT_Reset3DView(Operator):
- """Reset 3D View to Blender Defaults."""
-
bl_idname = "pdt.reset_3d_view"
bl_label = "Reset 3D View"
bl_options = {'REGISTER', 'UNDO'}
+ bl_description = "Reset 3D View to Blender Defaults."
def execute(self, context):
"""Reset 3D View to Blender Defaults.