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:
authorAntonioya <blendergit@gmail.com>2016-09-30 22:42:51 +0300
committerAntonioya <blendergit@gmail.com>2016-09-30 22:42:51 +0300
commitb13fa5d81cb68c375e2e0ab3776dcdedc501eb25 (patch)
treefe01bb9643208da9169150b7daf77a05c5c45f96 /measureit/measureit_main.py
parent5929cc941927b9d8feac092c799cdb9ff2e93641 (diff)
MeasureIt: Cleanup code
Clean and reformat code for better reading
Diffstat (limited to 'measureit/measureit_main.py')
-rw-r--r--measureit/measureit_main.py274
1 files changed, 139 insertions, 135 deletions
diff --git a/measureit/measureit_main.py b/measureit/measureit_main.py
index 9b3b8e3d..64137fcd 100644
--- a/measureit/measureit_main.py
+++ b/measureit/measureit_main.py
@@ -30,8 +30,8 @@ from bmesh import from_edit_mesh
# noinspection PyUnresolvedReferences
import bgl
from bpy.types import PropertyGroup, Panel, Object, Operator, SpaceView3D
-from bpy.props import IntProperty, CollectionProperty, FloatVectorProperty, BoolProperty, StringProperty, FloatProperty, \
- EnumProperty
+from bpy.props import IntProperty, CollectionProperty, FloatVectorProperty, BoolProperty, StringProperty, \
+ FloatProperty, EnumProperty
from bpy.app.handlers import persistent
# noinspection PyUnresolvedReferences
from .measureit_geometry import *
@@ -78,6 +78,7 @@ def save_handler(dummy):
except:
pass
+
bpy.app.handlers.load_post.append(load_handler)
bpy.app.handlers.save_pre.append(save_handler)
@@ -87,7 +88,8 @@ bpy.app.handlers.save_pre.append(save_handler)
# ------------------------------------------------------------------
class MeasureitIndex(PropertyGroup):
glidx = IntProperty(name="index",
- description="vertex index")
+ description="vertex index")
+
# Register
bpy.utils.register_class(MeasureitIndex)
@@ -98,10 +100,11 @@ bpy.utils.register_class(MeasureitIndex)
# ------------------------------------------------------------------
class MeasureitFaces(PropertyGroup):
glface = IntProperty(name="glface",
- description="Face number")
+ description="Face number")
# Array of index
measureit_index = CollectionProperty(type=MeasureitIndex)
+
# Register
bpy.utils.register_class(MeasureitFaces)
@@ -111,184 +114,185 @@ bpy.utils.register_class(MeasureitFaces)
# ------------------------------------------------------------------
class MeasureitProperties(PropertyGroup):
gltype = IntProperty(name="gltype",
- description="Measure type (1-Segment, 2-Label, etc..)", default=1)
+ description="Measure type (1-Segment, 2-Label, etc..)", default=1)
glpointa = IntProperty(name="glpointa",
- description="Hidden property for opengl")
+ description="Hidden property for opengl")
glpointb = IntProperty(name="glpointb",
- description="Hidden property for opengl")
+ description="Hidden property for opengl")
glpointc = IntProperty(name="glpointc",
- description="Hidden property for opengl")
+ description="Hidden property for opengl")
glcolor = FloatVectorProperty(name="glcolor",
- description="Color for the measure",
- default=(0.173, 0.545, 1.0, 1.0),
- min=0.1,
- max=1,
- subtype='COLOR',
- size=4)
+ description="Color for the measure",
+ default=(0.173, 0.545, 1.0, 1.0),
+ min=0.1,
+ max=1,
+ subtype='COLOR',
+ size=4)
glview = BoolProperty(name="glview",
- description="Measure visible/hide",
- default=True)
+ description="Measure visible/hide",
+ default=True)
glspace = FloatProperty(name='glspace', min=-100, max=100, default=0.1,
- precision=3,
- description='Distance to display measure')
+ precision=3,
+ description='Distance to display measure')
glwidth = IntProperty(name='glwidth', min=1, max=10, default=1,
- description='line width')
+ description='line width')
glfree = BoolProperty(name="glfree",
- description="This measure is free and can be deleted",
- default=False)
+ description="This measure is free and can be deleted",
+ default=False)
gltxt = StringProperty(name="gltxt", maxlen=256,
- description="Short description (use | for line break)")
+ description="Short description (use | for line break)")
gladvance = BoolProperty(name="gladvance",
- description="Advanced options as line width or position",
- default=False)
+ description="Advanced options as line width or position",
+ default=False)
gldefault = BoolProperty(name="gldefault",
- description="Display measure in position calculated by default",
- default=True)
+ description="Display measure in position calculated by default",
+ default=True)
glnormalx = FloatProperty(name="glnormalx",
- description="Change orientation in X axis",
- default=1, min=-1, max=1, precision=2)
+ description="Change orientation in X axis",
+ default=1, min=-1, max=1, precision=2)
glnormaly = FloatProperty(name="glnormaly",
- description="Change orientation in Y axis",
- default=0, min=-1, max=1, precision=2)
+ description="Change orientation in Y axis",
+ default=0, min=-1, max=1, precision=2)
glnormalz = FloatProperty(name="glnormalz",
- description="Change orientation in Z axis",
- default=0, min=-1, max=1, precision=2)
+ description="Change orientation in Z axis",
+ default=0, min=-1, max=1, precision=2)
glfont_size = IntProperty(name="Text Size",
- description="Text size",
- default=14, min=6, max=150)
+ description="Text size",
+ default=14, min=6, max=150)
gllink = StringProperty(name="gllink",
- description="linked object for linked measures")
+ description="linked object for linked measures")
glocwarning = BoolProperty(name="glocwarning",
- description="Display a warning if some axis is not used in distance",
- default=True)
+ description="Display a warning if some axis is not used in distance",
+ default=True)
glocx = BoolProperty(name="glocx",
- description="Include changes in X axis for calculating the distance",
- default=True)
+ description="Include changes in X axis for calculating the distance",
+ default=True)
glocy = BoolProperty(name="glocy",
- description="Include changes in Y axis for calculating the distance",
- default=True)
+ description="Include changes in Y axis for calculating the distance",
+ default=True)
glocz = BoolProperty(name="glocz",
- description="Include changes in Z axis for calculating the distance",
- default=True)
+ description="Include changes in Z axis for calculating the distance",
+ default=True)
glfontx = IntProperty(name="glfontx",
- description="Change font position in X axis",
- default=0, min=-3000, max=3000)
+ description="Change font position in X axis",
+ default=0, min=-3000, max=3000)
glfonty = IntProperty(name="glfonty",
- description="Change font position in Y axis",
- default=0, min=-3000, max=3000)
+ description="Change font position in Y axis",
+ default=0, min=-3000, max=3000)
gldist = BoolProperty(name="gldist",
- description="Display distance for this measure",
- default=True)
+ description="Display distance for this measure",
+ default=True)
glnames = BoolProperty(name="glnames",
- description="Display text for this measure",
- default=True)
+ description="Display text for this measure",
+ default=True)
gltot = EnumProperty(items=(('99', "-", "Select a group for sum"),
- ('0', "A", ""),
- ('1', "B", ""),
- ('2', "C", ""),
- ('3', "D", ""),
- ('4', "E", ""),
- ('5', "F", ""),
- ('6', "G", ""),
- ('7', "H", ""),
- ('8', "I", ""),
- ('9', "J", ""),
- ('10', "K", ""),
- ('11', "L", ""),
- ('12', "M", ""),
- ('13', "N", ""),
- ('14', "O", ""),
- ('15', "P", ""),
- ('16', "Q", ""),
- ('17', "R", ""),
- ('18', "S", ""),
- ('19', "T", ""),
- ('20', "U", ""),
- ('21', "V", ""),
- ('22', "W", ""),
- ('23', "X", ""),
- ('24', "Y", ""),
- ('25', "Z", "")),
- name="Sum in Group",
- description="Add segment length in selected group")
+ ('0', "A", ""),
+ ('1', "B", ""),
+ ('2', "C", ""),
+ ('3', "D", ""),
+ ('4', "E", ""),
+ ('5', "F", ""),
+ ('6', "G", ""),
+ ('7', "H", ""),
+ ('8', "I", ""),
+ ('9', "J", ""),
+ ('10', "K", ""),
+ ('11', "L", ""),
+ ('12', "M", ""),
+ ('13', "N", ""),
+ ('14', "O", ""),
+ ('15', "P", ""),
+ ('16', "Q", ""),
+ ('17', "R", ""),
+ ('18', "S", ""),
+ ('19', "T", ""),
+ ('20', "U", ""),
+ ('21', "V", ""),
+ ('22', "W", ""),
+ ('23', "X", ""),
+ ('24', "Y", ""),
+ ('25', "Z", "")),
+ name="Sum in Group",
+ description="Add segment length in selected group")
glorto = EnumProperty(items=(('99', "None", ""),
- ('0', "A", "Point A must use selected point B location"),
- ('1', "B", "Point B must use selected point A location")),
- name="Orthogonal",
- description="Display point selected as orthogonal (select axis to copy)")
+ ('0', "A", "Point A must use selected point B location"),
+ ('1', "B", "Point B must use selected point A location")),
+ name="Orthogonal",
+ description="Display point selected as orthogonal (select axis to copy)")
glorto_x = BoolProperty(name="ox",
- description="Copy X location",
- default=False)
+ description="Copy X location",
+ default=False)
glorto_y = BoolProperty(name="oy",
- description="Copy Y location",
- default=False)
+ description="Copy Y location",
+ default=False)
glorto_z = BoolProperty(name="oz",
- description="Copy Z location",
- default=False)
+ description="Copy Z location",
+ default=False)
glarrow_a = EnumProperty(items=(('99', "--", "No arrow"),
- ('1', "Line", "The point of the arrow are lines"),
- ('2', "Triangle", "The point of the arrow is triangle"),
- ('3', "TShape", "The point of the arrow is a T")),
- name="A end",
- description="Add arrows to point A")
+ ('1', "Line", "The point of the arrow are lines"),
+ ('2', "Triangle", "The point of the arrow is triangle"),
+ ('3', "TShape", "The point of the arrow is a T")),
+ name="A end",
+ description="Add arrows to point A")
glarrow_b = EnumProperty(items=(('99', "--", "No arrow"),
- ('1', "Line", "The point of the arrow are lines"),
- ('2', "Triangle", "The point of the arrow is triangle"),
- ('3', "TShape", "The point of the arrow is a T")),
- name="B end",
- description="Add arrows to point B")
+ ('1', "Line", "The point of the arrow are lines"),
+ ('2', "Triangle", "The point of the arrow is triangle"),
+ ('3', "TShape", "The point of the arrow is a T")),
+ name="B end",
+ description="Add arrows to point B")
glarrow_s = IntProperty(name="Size",
- description="Arrow size",
- default=15, min=6, max=500)
+ description="Arrow size",
+ default=15, min=6, max=500)
glarc_full = BoolProperty(name="arcfull",
- description="Create full circunference",
- default=False)
+ description="Create full circunference",
+ default=False)
glarc_extrad = BoolProperty(name="arcextrad",
- description="Adapt radio lengh to arc line",
- default=True)
+ description="Adapt radio lengh to arc line",
+ default=True)
glarc_rad = BoolProperty(name="arc rad",
- description="Show arc radius",
- default=True)
+ description="Show arc radius",
+ default=True)
glarc_len = BoolProperty(name="arc len",
- description="Show arc length",
- default=True)
+ description="Show arc length",
+ default=True)
glarc_ang = BoolProperty(name="arc ang",
- description="Show arc angle",
- default=True)
+ description="Show arc angle",
+ default=True)
glarc_a = EnumProperty(items=(('99', "--", "No arrow"),
- ('1', "Line", "The point of the arrow are lines"),
- ('2', "Triangle", "The point of the arrow is triangle"),
- ('3', "TShape", "The point of the arrow is a T")),
- name="Ar end",
- description="Add arrows to point A")
+ ('1', "Line", "The point of the arrow are lines"),
+ ('2', "Triangle", "The point of the arrow is triangle"),
+ ('3', "TShape", "The point of the arrow is a T")),
+ name="Ar end",
+ description="Add arrows to point A")
glarc_b = EnumProperty(items=(('99', "--", "No arrow"),
- ('1', "Line", "The point of the arrow are lines"),
- ('2', "Triangle", "The point of the arrow is triangle"),
- ('3', "TShape", "The point of the arrow is a T")),
- name="Br end",
- description="Add arrows to point B")
+ ('1', "Line", "The point of the arrow are lines"),
+ ('2', "Triangle", "The point of the arrow is triangle"),
+ ('3', "TShape", "The point of the arrow is a T")),
+ name="Br end",
+ description="Add arrows to point B")
glarc_s = IntProperty(name="Size",
- description="Arrow size",
- default=15, min=6, max=500)
+ description="Arrow size",
+ default=15, min=6, max=500)
glarc_txradio = StringProperty(name="txradio",
- description="Text for radius", default="r=")
+ description="Text for radius", default="r=")
glarc_txlen = StringProperty(name="txlen",
- description="Text for length", default="L=")
+ description="Text for length", default="L=")
glarc_txang = StringProperty(name="txang",
- description="Text for angle", default="A=")
+ description="Text for angle", default="A=")
glcolorarea = FloatVectorProperty(name="glcolorarea",
- description="Color for the measure of area",
- default=(0.1, 0.1, 0.1, 1.0),
- min=0.1,
- max=1,
- subtype='COLOR',
- size=4)
+ description="Color for the measure of area",
+ default=(0.1, 0.1, 0.1, 1.0),
+ min=0.1,
+ max=1,
+ subtype='COLOR',
+ size=4)
# Array of faces
measureit_faces = CollectionProperty(type=MeasureitFaces)
+
# Register
bpy.utils.register_class(MeasureitProperties)
@@ -299,7 +303,7 @@ bpy.utils.register_class(MeasureitProperties)
# ------------------------------------------------------------------
class MeasureContainer(PropertyGroup):
measureit_num = IntProperty(name='Number of measures', min=0, max=1000, default=0,
- description='Number total of measureit elements')
+ description='Number total of measureit elements')
# Array of segments
measureit_segments = CollectionProperty(type=MeasureitProperties)
@@ -1796,8 +1800,8 @@ class RunHintDisplayButton(Operator):
def handle_add(self, context):
if RunHintDisplayButton._handle is None:
RunHintDisplayButton._handle = SpaceView3D.draw_handler_add(draw_callback_px, (self, context),
- 'WINDOW',
- 'POST_PIXEL')
+ 'WINDOW',
+ 'POST_PIXEL')
context.window_manager.measureit_run_opengl = True
# ------------------------------------