[Bf-extensions-cvs] [6451d10f] master: MeasureIt: Refactored code and added align options

NBurn noreply at git.blender.org
Sat Aug 12 07:05:04 CEST 2017


Commit: 6451d10ff48f0bf4d95b504da295f760f64df14e
Author: NBurn
Date:   Sat Aug 12 01:01:05 2017 -0400
Branches: master
https://developer.blender.org/rBA6451d10ff48f0bf4d95b504da295f760f64df14e

MeasureIt: Refactored code and added align options

Added option to rotate measurements to be align to specified angles in degrees
Added option to horizontally align text to left, center, or right
Added option to expand or collapse all measurement subpanels
Redesign of Number panel option so its easier to match colors with measurements
Hid various measurement adjustment options when disabled and would have no affect
Redesign of button layout to reduce text truncation and improve visibility
Minor cleanup of comments and code for better readability and pep8 compliance

===================================================================

M	measureit/__init__.py
M	measureit/measureit_geometry.py
M	measureit/measureit_main.py

===================================================================

diff --git a/measureit/__init__.py b/measureit/__init__.py
index bc9ce20f..a07eb662 100644
--- a/measureit/__init__.py
+++ b/measureit/__init__.py
@@ -141,6 +141,8 @@ def register():
     bpy.utils.register_class(measureit_main.MeasureitConfPanel)
     bpy.utils.register_class(measureit_main.MeasureitRenderPanel)
     bpy.utils.register_class(measureit_main.RenderSegmentButton)
+    bpy.utils.register_class(measureit_main.ExpandAllSegmentButton)
+    bpy.utils.register_class(measureit_main.CollapseAllSegmentButton)
     bpy.utils.register_class(Measure_Pref)
     update_panel(None, bpy.context)
     # Define properties
@@ -190,12 +192,12 @@ def register():
     Scene.measureit_scale_font = IntProperty(name="Font",
                                              description="Text size",
                                              default=14, min=10, max=150)
-    Scene.measureit_scale_pos_x = IntProperty(name="Position X",
+    Scene.measureit_scale_pos_x = IntProperty(name="X Position",
                                               description="Margin on the X axis",
                                               default=5,
                                               min=0,
                                               max=100)
-    Scene.measureit_scale_pos_y = IntProperty(name="Position Y",
+    Scene.measureit_scale_pos_y = IntProperty(name="Y Position",
                                               description="Margin on the Y axis",
                                               default=5,
                                               min=0,
@@ -205,7 +207,6 @@ def register():
                                                  default="Scale:")
     Scene.measureit_scale_precision = IntProperty(name='Precision', min=0, max=5, default=0,
                                                   description="Number of decimal precision")
-
     Scene.measureit_ovr = BoolProperty(name="Override",
                                        description="Override colors and fonts",
                                        default=False)
@@ -222,6 +223,13 @@ def register():
     Scene.measureit_ovr_width = IntProperty(name='Override width', min=1, max=10, default=1,
                                             description='override line width')
 
+    Scene.measureit_ovr_font_rotation = IntProperty(name='Rotate', min=0, max=360, default=0,
+                                                    description="Text rotation in degrees")
+    Scene.measureit_ovr_font_align = EnumProperty(items=(('L', "Left Align", "Use current render"),
+                                                         ('C', "Center Align", ""),
+                                                         ('R', "Right Align", "")),
+                                                  name="Align Font",
+                                                  description="Set Font Alignment")
     Scene.measureit_units = EnumProperty(items=(('1', "Automatic", "Use scene units"),
                                                 ('2', "Meters", ""),
                                                 ('3', "Centimeters", ""),
@@ -326,14 +334,14 @@ def register():
                                                   description="Display vertex index number",
                                                   default=True)
     Scene.measureit_debug_objects = BoolProperty(name="Objects",
-                                                  description="Display object scene index number",
-                                                  default=False)
+                                                 description="Display object scene index number",
+                                                 default=False)
     Scene.measureit_debug_vert_loc = BoolProperty(name="Location",
                                                   description="Display vertex location",
                                                   default=False)
     Scene.measureit_debug_object_loc = BoolProperty(name="Location",
-                                                  description="Display object location",
-                                                  default=False)
+                                                    description="Display object location",
+                                                    default=False)
     Scene.measureit_debug_edges = BoolProperty(name="Edges",
                                                description="Display edge index number",
                                                default=False)
@@ -351,40 +359,40 @@ def register():
                                              description="Debug text size",
                                              default=14, min=10, max=150)
     Scene.measureit_debug_vert_color = FloatVectorProperty(name="Debug color",
-                                                      description="Debug Color",
-                                                      default=(1, 0, 0, 1.0),
-                                                      min=0.1,
-                                                      max=1,
-                                                      subtype='COLOR',
-                                                      size=4)
+                                                           description="Debug Color",
+                                                           default=(1, 0, 0, 1.0),
+                                                           min=0.1,
+                                                           max=1,
+                                                           subtype='COLOR',
+                                                           size=4)
     Scene.measureit_debug_face_color = FloatVectorProperty(name="Debug face color",
-                                                       description="Debug face Color",
-                                                       default=(0, 1, 0, 1.0),
-                                                       min=0.1,
-                                                       max=1,
-                                                       subtype='COLOR',
-                                                       size=4)
+                                                           description="Debug face Color",
+                                                           default=(0, 1, 0, 1.0),
+                                                           min=0.1,
+                                                           max=1,
+                                                           subtype='COLOR',
+                                                           size=4)
     Scene.measureit_debug_norm_color = FloatVectorProperty(name="Debug vector color",
-                                                       description="Debug vector Color",
-                                                       default=(1.0, 1.0, 0.1, 1.0),
-                                                       min=0.1,
-                                                       max=1,
-                                                       subtype='COLOR',
-                                                       size=4)
+                                                           description="Debug vector Color",
+                                                           default=(1.0, 1.0, 0.1, 1.0),
+                                                           min=0.1,
+                                                           max=1,
+                                                           subtype='COLOR',
+                                                           size=4)
     Scene.measureit_debug_edge_color = FloatVectorProperty(name="Debug vector color",
-                                                       description="Debug vector Color",
-                                                       default=(0.1, 1.0, 1.0, 1.0),
-                                                       min=0.1,
-                                                       max=1,
-                                                       subtype='COLOR',
-                                                       size=4)
+                                                           description="Debug vector Color",
+                                                           default=(0.1, 1.0, 1.0, 1.0),
+                                                           min=0.1,
+                                                           max=1,
+                                                           subtype='COLOR',
+                                                           size=4)
     Scene.measureit_debug_obj_color = FloatVectorProperty(name="Debug vector color",
-                                                       description="Debug vector Color",
-                                                       default=(1.0, 1.0, 1.0, 1.0),
-                                                       min=0.1,
-                                                       max=1,
-                                                       subtype='COLOR',
-                                                       size=4)
+                                                          description="Debug vector Color",
+                                                          default=(1.0, 1.0, 1.0, 1.0),
+                                                          min=0.1,
+                                                          max=1,
+                                                          subtype='COLOR',
+                                                          size=4)
     Scene.measureit_debug_normal_size = FloatProperty(name='Len', min=0.001, max=9,
                                                       default=0.5,
                                                       precision=2,
@@ -394,11 +402,18 @@ def register():
     Scene.measureit_debug_precision = IntProperty(name='Precision', min=0, max=5, default=1,
                                                   description="Number of decimal precision")
     Scene.measureit_debug_vert_loc_toggle = EnumProperty(items=(('1', "Local",
-                                                     "Uses local coordinates"

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list