diff options
author | Alan Odom <clockmender@icloud.com> | 2020-01-26 13:52:00 +0300 |
---|---|---|
committer | Rune Morling <ermo.blender.org@spammesenseless.net> | 2020-02-01 18:41:11 +0300 |
commit | 4d0298a3f9240cff351f7225819f55dbe29836a9 (patch) | |
tree | 1235ad364455bfc6809e55f93d4d916c3842b718 /precision_drawing_tools/pdt_functions.py | |
parent | 0e62a382183b02799dda7e48d5a3f97dd2321be9 (diff) |
PDT: Refactor - Stage 4
- Check Object Mode is either EDIT or OBJECT as appropriate.
- Change If loop to check command values - error if D, E, For M commands.
- Remove surplus command check in command_maths function.
- Added import of exceptions file.
- Check for Mesh Objects in Object or Edit Mode first and exit with error
message if not.
- Some minor changes for obscure failures in unusual circumstances.
- Fixes and changes to code to correct minor errors and remove unnecessary
checks.
- Refactored Command File structure.
- Add more checks to Fillet Operation to check selection and make sure
current selected vertices/edges are always used. Previous version could
use wrong selection if Bmesh SelectHistory was in place for Faces, or Edges.
Diffstat (limited to 'precision_drawing_tools/pdt_functions.py')
-rw-r--r-- | precision_drawing_tools/pdt_functions.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/precision_drawing_tools/pdt_functions.py b/precision_drawing_tools/pdt_functions.py index d6462852..65b4069a 100644 --- a/precision_drawing_tools/pdt_functions.py +++ b/precision_drawing_tools/pdt_functions.py @@ -175,12 +175,12 @@ def check_selection(num, bm, obj): elif num == 3: vector_b = bm.select_history[-2].co vector_c = bm.select_history[-3].co - return vector_a, vector_b, vector_d + return vector_a, vector_b, vector_c elif num == 4: vector_b = bm.select_history[-2].co vector_c = bm.select_history[-3].co vector_d = bm.select_history[-4].co - return vector_a, vector_b, vector_d, vector_c + return vector_a, vector_b, vector_c, vector_d else: for f in bm.faces: f.select_set(False) @@ -319,7 +319,7 @@ def euler_to_quaternion(roll, pitch, yaw): return Quaternion((qw, qx, qy, qz)) -def arc_centre(vector_a, vector_b, vector_d): +def arc_centre(vector_a, vector_b, vector_c): """Calculates Centre of Arc from 3 Vector Locations using standard Numpy routine Args: @@ -333,7 +333,7 @@ def arc_centre(vector_a, vector_b, vector_d): A = np.array([vector_a.x, vector_a.y, vector_a.z]) B = np.array([vector_b.x, vector_b.y, vector_b.z]) - C = np.array([vector_d.x, vector_d.y, vector_d.z]) + C = np.array([vector_c.x, vector_c.y, vector_c.z]) a = np.linalg.norm(C - B) b = np.linalg.norm(C - A) c = np.linalg.norm(B - A) @@ -370,11 +370,11 @@ def intersection(vertex_a, vertex_b, vertex_c, vertex_d, plane): vertex_d = view_coords_i(vertex_offset.x, vertex_offset.y, vertex_offset.z) vertex_offset = vertex_c - vertex_a vertex_c = view_coords_i(vertex_offset.x, vertex_offset.y, vertex_offset.z) - refV = Vector((0, 0, 0)) + vector_ref = Vector((0, 0, 0)) ap1 = (vertex_c.x, vertex_c.y) ap2 = (vertex_d.x, vertex_d.y) bp1 = (vertex_b.x, vertex_b.y) - bp2 = (refV.x, refV.y) + bp2 = (vector_ref.x, vector_ref.y) else: a1, a2, a3 = set_mode(plane) ap1 = (vertex_c[a1], vertex_c[a2]) @@ -473,7 +473,7 @@ def get_percent(obj, flip_p, per_v, data, scene): return Vector((V[0], V[1], V[2])) -def obj_check(obj, scene, operator): +def obj_check(context, obj, scene, operator): """Check Object & Selection Validity. Args: @@ -515,7 +515,7 @@ def obj_check(obj, scene, operator): bpy.context.window_manager.popup_menu(oops, title="Error", icon="ERROR") return None, False return bm, True - elif obj.mode == "OBJECT": + else: return None, True @@ -549,7 +549,6 @@ def dis_ang(vals, flip_a, plane, scene): # fmt: off vector_delta[a1] = vector_delta[a1] + (dis_v * cos(ang_v * pi/180)) vector_delta[a2] = vector_delta[a2] + (dis_v * sin(ang_v * pi/180)) - # FIXME: Is a3 just ignored? # fmt: on return vector_delta |