text stringlengths 1 93.6k |
|---|
def draw_face_center(self, context,
|
target_object,
|
face_index,
|
allowed_indices,
|
snap_type,
|
ignore_modifiers,
|
color):
|
"""
|
Store necessary information and draw points of the target point/edge/face.
|
"""
|
if face_index < 0 or target_object == '':
|
return
|
obj = bpy.data.objects[target_object]
|
if obj.type != 'MESH':
|
return
|
if ignore_modifiers:
|
data = obj.data
|
else:
|
data = obj.evaluated_get(context.evaluated_depsgraph_get()).data
|
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
|
if snap_type == 'FACES':
|
# and face_index in allowed_indices
|
# print(f"face index:{face_index}")
|
# print(f"len(data.polygons):{len(data.polygons)}")
|
if face_index < len(data.polygons) and (allowed_indices is None or face_index in allowed_indices):
|
target_polygon = data.polygons[face_index]
|
center = obj.matrix_world @ target_polygon.center
|
region3d = context.space_data.region_3d
|
camera_position = region3d.view_matrix.inverted().translation
|
center = add_camera_offset(center,
|
camera_position,
|
camera_vector,
|
is_ortho)
|
draw_points_3d([center], color=(*color, 1), point_width=4,
|
depth_test=True)
|
elif snap_type == 'MIDPOINTS':
|
if face_index < len(data.polygons):
|
target_polygon = data.polygons[face_index]
|
camera_position = context.space_data.region_3d.view_matrix.inverted().translation
|
midpoints = []
|
for loop_index in range(0, target_polygon.loop_total):
|
current_loop = data.loops[target_polygon.loop_start + loop_index]
|
if allowed_indices is not None and current_loop.edge_index not in allowed_indices:
|
continue
|
loop_second = data.loops[target_polygon.loop_start + ((loop_index + 1) % target_polygon.loop_total)]
|
midpoint = obj.matrix_world @ ((data.vertices[current_loop.vertex_index].co +
|
data.vertices[loop_second.vertex_index].co) / 2)
|
midpoint = add_camera_offset(midpoint,
|
camera_position,
|
camera_vector,
|
is_ortho)
|
midpoints.append(midpoint)
|
draw_points_3d(midpoints, color=(*color, 1), point_width=4, depth_test=True)
|
# Draw verts points if not in edit mode + vertex mode
|
elif snap_type == 'POINTS' and not (not self.object_mode and context.scene.tool_settings.mesh_select_mode[0]):
|
if face_index < len(data.polygons):
|
target_polygon = data.polygons[face_index]
|
camera_position = context.space_data.region_3d.view_matrix.inverted().translation
|
points = []
|
for vert_id in target_polygon.vertices:
|
if allowed_indices is not None and vert_id not in allowed_indices:
|
continue
|
point = obj.matrix_world @ data.vertices[vert_id].co
|
point = add_camera_offset(point,
|
camera_position,
|
camera_vector,
|
is_ortho)
|
points.append(point)
|
draw_points_3d(points, color=(*color, 1), point_width=4, depth_test=True)
|
def get_icons_dir():
|
return Path(os.path.dirname(__file__)) / "icons"
|
# <FILESEP>
|
#!/usr/bin/python3
|
from typing import List
|
from instr_helpers import *
|
COMPARE = 'compare' # name of register target for comparef
|
SHIFT_TEMP = 'shift_temp'
|
OP2_OVERSIZE = 'shift_temp' # OP2 Imm / Shift should be mutually exclusive?
|
TEMP = 'temp'
|
class Arm64Instruction:
|
imm_width = 12
|
num_reg_writes = 1
|
def is_oversized_imm(self, x) -> bool:
|
if 'immediate' in x.keys():
|
x = x['immediate']
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.