mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
fixed Hidden decotator in edit mode
This commit is contained in:
@@ -6,6 +6,7 @@ from itertools import chain
|
||||
from bpy.types import SpaceView3D
|
||||
from mathutils import Vector, Matrix
|
||||
import bpy
|
||||
import bmesh
|
||||
import blf
|
||||
from bpy_extras.view3d_utils import location_3d_to_region_2d
|
||||
import gpu
|
||||
@@ -175,6 +176,22 @@ class BaseDecorator():
|
||||
indices = [e.vertices for e in obj.data.edges]
|
||||
return vertices, indices
|
||||
|
||||
def get_editmesh_geom(self, obj):
|
||||
"""Parses editmode mesh geometry into line segments
|
||||
"""
|
||||
mesh = bmesh.from_edit_mesh(obj.data)
|
||||
vertices = []
|
||||
indices = []
|
||||
idx = 0
|
||||
|
||||
for edge in mesh.edges:
|
||||
vertices.extend(edge.verts)
|
||||
indices.append((idx, idx+1))
|
||||
idx += 2
|
||||
vertices = [obj.matrix_world @ v.co for v in vertices]
|
||||
|
||||
return vertices, indices
|
||||
|
||||
def decorate(self, object):
|
||||
"""perform actuall drawing stuff"""
|
||||
raise NotImplementedError()
|
||||
@@ -528,5 +545,8 @@ class HiddenDecorator(BaseDecorator):
|
||||
"""
|
||||
|
||||
def decorate(self, obj):
|
||||
verts, idxs = self.get_mesh_geom(obj)
|
||||
if obj.data.is_editmode:
|
||||
verts, idxs = self.get_editmesh_geom(obj)
|
||||
else:
|
||||
verts, idxs = self.get_mesh_geom(obj)
|
||||
self.draw_lines(obj, verts, idxs)
|
||||
|
||||
Reference in New Issue
Block a user