From b212e27a71968f38215341ff77fe96f8aeea03e6 Mon Sep 17 00:00:00 2001 From: Julien Heijmans Date: Mon, 25 Mar 2024 09:55:16 +0100 Subject: [PATCH 1/2] replaced deprecated numpy types --- __init__.py | 2 +- quicksnap_snapdata.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/__init__.py b/__init__.py index 987190c..9783d04 100644 --- a/__init__.py +++ b/__init__.py @@ -7,7 +7,7 @@ "name": "QuickSnap", "author": "Julien Heijmans", "blender": (2, 93, 0), - 'version': (1, 4, 5), + 'version': (1, 4, 6), "category": "3D View", "description": "Quickly snap objects/vertices/curve points", "warning": "", diff --git a/quicksnap_snapdata.py b/quicksnap_snapdata.py index e8cf522..dfa24a8 100644 --- a/quicksnap_snapdata.py +++ b/quicksnap_snapdata.py @@ -77,7 +77,7 @@ def __init__(self, obj, object_id, perspective_matrix, width, height, width_half edges = obj.data.edges edge_count = len(edges) edges_vertid_shape = (edge_count, 2) - edges_vertid = np.zeros((edge_count * 2), dtype=np.int) # [0.0, 0.0] * len(mesh.edges) + edges_vertid = np.zeros((edge_count * 2), dtype=int) # [0.0, 0.0] * len(mesh.edges) edges.foreach_get('vertices', edges_vertid) edges_vertid.shape = edges_vertid_shape # Get edges center points @@ -119,9 +119,9 @@ def __init__(self, obj, object_id, perspective_matrix, width, height, width_half polygons.foreach_get('loop_total', polygon_vert_count) polygon_vert_start_index = np.concatenate( - [np.zeros(1, dtype=np.int), np.cumsum(polygon_vert_count[1:])]) + [np.zeros(1, dtype=int), np.cumsum(polygon_vert_count[1:])]) - polygon_verts = np.empty(np.sum(polygon_vert_count), dtype=np.int) + polygon_verts = np.empty(np.sum(polygon_vert_count), dtype=int) polygons.foreach_get('vertices', polygon_verts) selected_polygon_verts = verts_selected[polygon_verts] From 23d96f401ef1e0da9071cc6e47f43c1c0002614b Mon Sep 17 00:00:00 2001 From: Julien Heijmans Date: Mon, 25 Mar 2024 11:50:58 +0100 Subject: [PATCH 2/2] Fix some missing highlighting, and fix line width that was ignored (gllinewidth has been deprecated) --- quicksnap_render.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/quicksnap_render.py b/quicksnap_render.py index 36d5663..e052af1 100644 --- a/quicksnap_render.py +++ b/quicksnap_render.py @@ -161,6 +161,7 @@ def draw_line_3d_smooth_blend(source, target, color_a=(1, 0, 0, 1), color_b=(0, color_fade = (color_a, color_b) batch = batch_for_shader(shader_3d_polyline_smooth_color, 'LINES', {"pos": vertices, "color": color_fade}) + shader_3d_polyline_smooth_color.uniform_float("lineWidth", line_width) shader_3d_polyline_smooth_color.bind() batch.draw(shader_3d_polyline_smooth_color) if line_width != 1: @@ -566,7 +567,7 @@ def draw_edge_highlight(context, if target_object not in npdata: npdata[target_object] = {} if "edge_verts" not in npdata[target_object]: - arr = np.zeros(len(data.edges) * 2, dtype=np.int) + arr = np.zeros(len(data.edges) * 2, dtype=int) data.edges.foreach_get('vertices', arr) arr.shape = (len(data.edges), 2) npdata[target_object]["edge_verts"] = arr @@ -602,10 +603,10 @@ def draw_edge_highlight(context, npdata[target_object] = {} if "polygon_loop_tri_idx" not in npdata[target_object]: data.calc_loop_triangles() - arr = np.zeros(len(data.loop_triangles), dtype=np.int) + arr = np.zeros(len(data.loop_triangles), dtype=int) data.loop_triangles.foreach_get('polygon_index', arr) npdata[target_object]["polygon_loop_tri_idx"] = arr - arr2 = np.zeros(len(data.loop_triangles) * 3, dtype=np.int) + arr2 = np.zeros(len(data.loop_triangles) * 3, dtype=int) data.loop_triangles.foreach_get('vertices', arr2) arr2.shape = (len(data.loop_triangles), 3) npdata[target_object]["polygon_loop_verts"] = arr2