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:
authorNBurn <nbwashburn@gmail.com>2017-08-02 13:16:26 +0300
committerNBurn <nbwashburn@gmail.com>2017-08-02 13:16:26 +0300
commit69cb19cf71bf62fddb5e43e1aa31a807e839eb41 (patch)
treef44bb0df47c8cba527e681b8b87f55a817dc5fe9
parent9d3a25cac02a56afa898e930e6f4dfa270fd4c28 (diff)
MeasureIt: Fix for ensure_lookup_table bug mentioned in T52236
-rw-r--r--measureit/measureit_geometry.py21
-rw-r--r--measureit/measureit_main.py5
2 files changed, 10 insertions, 16 deletions
diff --git a/measureit/measureit_geometry.py b/measureit/measureit_geometry.py
index 14328a9e..87b97a20 100644
--- a/measureit/measureit_geometry.py
+++ b/measureit/measureit_geometry.py
@@ -470,16 +470,6 @@ def draw_segments(context, myobj, op, region, rv3d):
txtpoint2d = tmp_point[0] + ms.glfontx, tmp_point[1] + ms.glfonty
draw_text(myobj, txtpoint2d, tx_dist, rgb, fsize)
- '''
- try:
- tx_dist = ms.gltxt
- gap3d = (vn1[0], vn1[1], vn1[2])
- txtpoint2d = get_2d_point(region, rv3d, gap3d)
- draw_text(myobj, (txtpoint2d[0] + ms.glfontx, txtpoint2d[1] + ms.glfonty),
- tx_dist, rgb, fsize)
- except:
- pass
- '''
# ------------------------------------
# Draw lines
# ------------------------------------
@@ -1195,12 +1185,11 @@ def draw_faces(context, myobj, region, rv3d):
b2d = get_2d_point(region, rv3d, a_p2)
c2d = get_2d_point(region, rv3d, a_p3)
# draw vectors
- if None not in (a2d, b2d, c2d):
- draw_arrow(a2d, b2d, 10, "99", "1")
- draw_arrow(b2d, c2d, 10, "99", "1")
- # Normal vector data
- txt = format_point(normal, precision)
- draw_text(myobj, point2, txt, rgb2, fsize)
+ draw_arrow(a2d, b2d, 10, "99", "1")
+ draw_arrow(b2d, c2d, 10, "99", "1")
+ # Normal vector data
+ txt = format_point(normal, precision)
+ draw_text(myobj, point2, txt, rgb2, fsize)
except:
print("Unexpected error:" + str(exc_info()))
diff --git a/measureit/measureit_main.py b/measureit/measureit_main.py
index 5476931c..633a1754 100644
--- a/measureit/measureit_main.py
+++ b/measureit/measureit_main.py
@@ -26,6 +26,7 @@
# ----------------------------------------------------------
# noinspection PyUnresolvedReferences
import bpy
+import bmesh
from bmesh import from_edit_mesh
# noinspection PyUnresolvedReferences
import bgl
@@ -411,6 +412,10 @@ class MeasureitEditPanel(Panel):
if (ms.gltype == 1 or ms.gltype == 12
or ms.gltype == 13 or ms.gltype == 14) and ms.gltot != '99' \
and ms.glfree is False: # only segments
+ if bpy.context.mode == "EDIT_MESH":
+ bm = bmesh.from_edit_mesh(bpy.context.edit_object.data)
+ if hasattr(bm.verts, "ensure_lookup_table"):
+ bm.verts.ensure_lookup_table()
if ms.glpointa <= len(obverts) and ms.glpointb <= len(obverts):
p1 = get_point(obverts[ms.glpointa].co, myobj)
if ms.gltype == 1: