diff options
author | mano-wii <germano.costa@ig.com.br> | 2018-12-20 07:44:47 +0300 |
---|---|---|
committer | mano-wii <germano.costa@ig.com.br> | 2018-12-20 07:44:47 +0300 |
commit | 5731c6385eb243e6536a5a384a24f43f812573e1 (patch) | |
tree | 2818147c26d77bca3670cd3f807eee7296224f4f /mesh_snap_utilities_line/snap_context_l | |
parent | ce4fead3d96ecc2b9a6f6962017c266edf4e353b (diff) |
mesh_snap_utilities_line: fix error messages when undo
Diffstat (limited to 'mesh_snap_utilities_line/snap_context_l')
-rw-r--r-- | mesh_snap_utilities_line/snap_context_l/__init__.py | 5 | ||||
-rw-r--r-- | mesh_snap_utilities_line/snap_context_l/mesh_drawing.py | 16 |
2 files changed, 14 insertions, 7 deletions
diff --git a/mesh_snap_utilities_line/snap_context_l/__init__.py b/mesh_snap_utilities_line/snap_context_l/__init__.py index c4b03156..86e2f19c 100644 --- a/mesh_snap_utilities_line/snap_context_l/__init__.py +++ b/mesh_snap_utilities_line/snap_context_l/__init__.py @@ -33,6 +33,7 @@ class _Internal: gpu_Indices_restore_state, gpu_Indices_use_clip_planes, gpu_Indices_set_ProjectionMatrix, + gpu_Indices_mesh_cache_clear, ) from .utils_projection import ( @@ -294,6 +295,10 @@ class SnapContext(): ## PUBLIC ## + def clear_snap_objects(self): + self.snap_objects.clear() + _Internal.gpu_Indices_mesh_cache_clear() + def update_all(self): self.drawn_count = 0 self._offset_cur = 1 diff --git a/mesh_snap_utilities_line/snap_context_l/mesh_drawing.py b/mesh_snap_utilities_line/snap_context_l/mesh_drawing.py index 6ef0b0a0..0b0b099c 100644 --- a/mesh_snap_utilities_line/snap_context_l/mesh_drawing.py +++ b/mesh_snap_utilities_line/snap_context_l/mesh_drawing.py @@ -22,8 +22,6 @@ import numpy as np from mathutils import Matrix import gpu -_Hash = {} - def load_shader(shadername): from os import path with open(path.join(path.dirname(__file__), 'shaders', shadername), 'r') as f: @@ -177,6 +175,7 @@ class GPU_Indices_Mesh(): "users" ) + _Hash = {} shader = None @classmethod @@ -218,8 +217,8 @@ class GPU_Indices_Mesh(): def __init__(self, obj, draw_tris, draw_edges, draw_verts): self.obj = obj - if obj.data in _Hash: - src = _Hash[obj.data] + if obj.data in GPU_Indices_Mesh._Hash: + src = GPU_Indices_Mesh._Hash[obj.data] dst = self dst.draw_tris = src.draw_tris @@ -238,7 +237,7 @@ class GPU_Indices_Mesh(): update = obj.type == 'MESH' and obj.data.is_editmode else: - _Hash[obj.data] = self + GPU_Indices_Mesh._Hash[obj.data] = self self.users = [self] update = True; @@ -372,8 +371,7 @@ class GPU_Indices_Mesh(): def __del__(self): if len(self.users) == 1: - self.free_gl() - _Hash.pop(obj.data) + GPU_Indices_Mesh._Hash.pop(obj.data) self.user.remove(self) #print('mesh_del', self.obj.name) @@ -410,3 +408,7 @@ def gpu_Indices_use_clip_planes(rv3d, value): def gpu_Indices_set_ProjectionMatrix(P): gpu.matrix.load_projection_matrix(P) GPU_Indices_Mesh.P[:] = P + + +def gpu_Indices_mesh_cache_clear(): + GPU_Indices_Mesh._Hash.clear() |