text stringlengths 1 93.6k |
|---|
highlight_data[target_object][vert_index]["edges"].append((matrix @ data.vertices[match[0]].co,
|
matrix @ data.vertices[match[1]].co))
|
for match in filter_right:
|
highlight_data[target_object][vert_index]["edges"].append((matrix @ data.vertices[match[1]].co,
|
matrix @ data.vertices[match[0]].co))
|
elif snapdata.snap_type == 'MIDPOINTS':
|
verts = data.vertices
|
edges = data.edges
|
if len(edges) <= vert_index:
|
return
|
highlight_data[target_object][vert_index] = {}
|
highlight_data[target_object][vert_index]["edges"] = []
|
highlight_data[target_object][vert_index]["edges"].append(
|
(snapdata.world_space[target_id],
|
matrix @ verts[edges[vert_index].vertices[0]].co))
|
highlight_data[target_object][vert_index]["edges"].append(
|
(snapdata.world_space[target_id],
|
matrix @ verts[edges[vert_index].vertices[1]].co))
|
elif snapdata.snap_type == 'FACES':
|
if target_object not in npdata:
|
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=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=int)
|
data.loop_triangles.foreach_get('vertices', arr2)
|
arr2.shape = (len(data.loop_triangles), 3)
|
npdata[target_object]["polygon_loop_verts"] = arr2
|
verts = data.vertices
|
polygons = data.polygons
|
loops = data.loops
|
highlight_data[target_object][vert_index] = {}
|
highlight_data[target_object][vert_index]["edges"] = []
|
highlight_data[target_object][vert_index]["face_co"] = []
|
highlight_data[target_object][vert_index]["face_indices"] = []
|
if len(polygons) <= vert_index:
|
return
|
poly = polygons[vert_index]
|
region3d = context.space_data.region_3d
|
camera_position = region3d.view_matrix.inverted().translation
|
camera_vector = region3d.view_rotation @ Vector((0.0, 0.0, -1.0))
|
is_ortho = not region3d.is_perspective
|
vert_local_index = {}
|
verts_co = {}
|
for idx in range(0, poly.loop_total):
|
current_loop = poly.loop_start + idx
|
loop_second = poly.loop_start + ((idx + 1) % poly.loop_total)
|
vert_index_a = loops[current_loop].vertex_index
|
vert_index_b = loops[loop_second].vertex_index
|
if vert_index_a not in verts_co:
|
verts_co[vert_index_a] = matrix @ verts[vert_index_a].co
|
verts_co[vert_index_a] = add_camera_offset(verts_co[vert_index_a],
|
camera_position,
|
camera_vector,
|
is_ortho)
|
new_index = len(highlight_data[target_object][vert_index]["face_co"])
|
vert_local_index[vert_index_a] = new_index
|
highlight_data[target_object][vert_index]["face_co"].append(verts_co[vert_index_a])
|
if vert_index_b not in verts_co:
|
verts_co[vert_index_b] = matrix @ verts[vert_index_b].co
|
verts_co[vert_index_b] = add_camera_offset(verts_co[vert_index_b],
|
camera_position,
|
camera_vector,
|
is_ortho)
|
new_index = len(highlight_data[target_object][vert_index]["face_co"])
|
vert_local_index[vert_index_b] = new_index
|
highlight_data[target_object][vert_index]["face_co"].append(verts_co[vert_index_b])
|
highlight_data[target_object][vert_index]["edges"].append(
|
(verts_co[vert_index_a], verts_co[vert_index_b]))
|
filtered = np.argwhere(npdata[target_object]["polygon_loop_tri_idx"] == vert_index)
|
for triangle_index in filtered:
|
triangle = npdata[target_object]["polygon_loop_verts"][triangle_index].flatten()
|
highlight_data[target_object][vert_index]["face_indices"].extend(
|
[[vert_local_index[vertid] for vertid in triangle]])
|
if snapdata.snap_type == 'POINTS':
|
alpha_end = 0
|
else:
|
alpha_end = opacity
|
for edge in highlight_data[target_object][vert_index]["edges"]:
|
draw_line_3d_smooth_blend(edge[0],
|
edge[1],
|
color_a=(*color, opacity),
|
color_b=(*color, alpha_end),
|
line_width=width, depth_test=False)
|
if snapdata.snap_type == 'FACES':
|
draw_polygon_smooth_blend(highlight_data[target_object][vert_index]["face_co"],
|
highlight_data[target_object][vert_index]["face_indices"],
|
color=(*color, 0.1),
|
depth_test=True)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.