Changeset View
Changeset View
Standalone View
Standalone View
mesh_extra_tools/mesh_edgetools.py
| Context not available. | |||||
| """ | """ | ||||
| # @todo | # @todo | ||||
| # - Figure out how to deal with n-gons | # - Figure out how to deal with n-gons | ||||
| # How the heck is a face with 8 verts definied mathematically? | # How the heck is a face with 8 verts defined mathematically? | ||||
| # How do I then find the intersection point of a line with said vert? | # How do I then find the intersection point of a line with said vert? | ||||
| # How do I know if that point is "inside" all the verts? | # How do I know if that point is "inside" all the verts? | ||||
| # I have no clue, and haven't been able to find anything on it so far | # I have no clue, and haven't been able to find anything on it so far | ||||
| Context not available. | |||||
| ) | ) | ||||
| flip = BoolProperty( | flip = BoolProperty( | ||||
| name="Flip Second Edge", | name="Flip Second Edge", | ||||
| description="Flip the percieved direction of the second edge", | description="Flip the perceived direction of the second edge", | ||||
| default=False | default=False | ||||
| ) | ) | ||||
| radius = FloatProperty( | radius = FloatProperty( | ||||
| Context not available. | |||||
| # the user has changed selection. | # the user has changed selection. | ||||
| # We then need to make sure that the active object really is an edge | # We then need to make sure that the active object really is an edge | ||||
| # (robustness check) | # (robustness check) | ||||
| # Finally, if the active edge is not the inital one, we flip them | # Finally, if the active edge is not the initial one, we flip them | ||||
| # and have the GUI reflect that | # and have the GUI reflect that | ||||
| if self.last_edge == self.edge: | if self.last_edge == self.edge: | ||||
| if isinstance(bm.select_history.active, bmesh.types.BMEdge): | if isinstance(bm.select_history.active, bmesh.types.BMEdge): | ||||
| Context not available. | |||||
| for i in range(len(verts) - 2): | for i in range(len(verts) - 2): | ||||
| init_vec = distance_point_line(verts[i + 2].co, verts[0].co, verts[1].co) | init_vec = distance_point_line(verts[i + 2].co, verts[0].co, verts[1].co) | ||||
| co = init_vec + verts[i + 2].co | co = init_vec + verts[i + 2].co | ||||
| # These will be rotated about the orgin so will need to be shifted: | # These will be rotated about the origin so will need to be shifted: | ||||
| for j in range(numV): | for j in range(numV): | ||||
| verts_out.append(co - (matrices[j] * init_vec)) | verts_out.append(co - (matrices[j] * init_vec)) | ||||
| elif self.shaftType == 1: | elif self.shaftType == 1: | ||||
| for i in verts: | for i in verts: | ||||
| init_vec = distance_point_line(i.co, active.verts[0].co, active.verts[1].co) | init_vec = distance_point_line(i.co, active.verts[0].co, active.verts[1].co) | ||||
| co = init_vec + i.co | co = init_vec + i.co | ||||
| # These will be rotated about the orgin so will need to be shifted: | # These will be rotated about the origin so will need to be shifted: | ||||
| for j in range(numV): | for j in range(numV): | ||||
| verts_out.append(co - (matrices[j] * init_vec)) | verts_out.append(co - (matrices[j] * init_vec)) | ||||
| # Else if a line and a point was selected: | # Else if a line and a point was selected: | ||||
| elif self.shaftType == 2: | elif self.shaftType == 2: | ||||
| init_vec = distance_point_line(verts[2].co, verts[0].co, verts[1].co) | init_vec = distance_point_line(verts[2].co, verts[0].co, verts[1].co) | ||||
| # These will be rotated about the orgin so will need to be shifted: | # These will be rotated about the origin so will need to be shifted: | ||||
| verts_out = [ | verts_out = [ | ||||
| (verts[i].co - (matrices[j] * init_vec)) for i in range(2) for j in range(numV) | (verts[i].co - (matrices[j] * init_vec)) for i in range(2) for j in range(numV) | ||||
| ] | ] | ||||
| Context not available. | |||||
| else: | else: | ||||
| vec = verts[0].co + Vector((0, self.radius, 0)) | vec = verts[0].co + Vector((0, self.radius, 0)) | ||||
| init_vec = distance_point_line(vec, verts[0].co, verts[1].co) | init_vec = distance_point_line(vec, verts[0].co, verts[1].co) | ||||
| # These will be rotated about the orgin so will need to be shifted: | # These will be rotated about the origin so will need to be shifted: | ||||
| verts_out = [ | verts_out = [ | ||||
| (verts[i].co - (matrices[j] * init_vec)) for i in range(2) for j in range(numV) | (verts[i].co - (matrices[j] * init_vec)) for i in range(2) for j in range(numV) | ||||
| ] | ] | ||||
| Context not available. | |||||
| make_copy = BoolProperty( | make_copy = BoolProperty( | ||||
| name="Make Copy", | name="Make Copy", | ||||
| description="Make new vertices at intersection points instead of spliting the edge", | description="Make new vertices at intersection points instead of splitting the edge", | ||||
| default=False | default=False | ||||
| ) | ) | ||||
| rip = BoolProperty( | rip = BoolProperty( | ||||
| Context not available. | |||||