MeasureIt: Fix for ensure_lookup_table bug mentioned in T52236
This commit is contained in:
parent
9d3a25cac0
commit
69cb19cf71
Notes:
blender-bot
2023-02-14 19:36:37 +01:00
Referenced by issue #52236, MeasureIt not updating mesh positioning after first render, Error in remapping process, and ensure_lookup_table bugs
|
@ -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()))
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue