Skip to content

Commit

Permalink
Merge pull request #26 from Clockmender/2.93
Browse files Browse the repository at this point in the history
More fixes for Blender 2.93
  • Loading branch information
ermo authored May 17, 2021
2 parents a607606 + 817d8dd commit 65d10a4
Showing 3 changed files with 40 additions and 49 deletions.
8 changes: 4 additions & 4 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@
bl_info = {
"name": "Precision Drawing Tools (PDT)",
"author": "Alan Odom (Clockmender), Rune Morling (ermo)",
"version": (1, 5, 0),
"version": (1, 5, 1),
"blender": (2, 90, 0),
"location": "View3D > UI > PDT",
"description": "Precision Drawing Tools for Acccurate Modelling",
@@ -430,7 +430,7 @@ class PDTSceneProperties(PropertyGroup):

# Was filletrad
fillet_radius: FloatProperty(
name="Fillet Radius", min=0.0, default=1.0, description=PDT_DES_FILLETRAD
name="Fillet Radius", min=0.0, default=1.0, unit="LENGTH", description=PDT_DES_FILLETRAD
)
# Was filletnum
fillet_segments: IntProperty(
@@ -454,10 +454,10 @@ class PDTSceneProperties(PropertyGroup):
name="Coordst2", default=(0.0, 0.0, 0.0), subtype="XYZ", description=PDT_DES_TANCEN2
)
tangent_radius0: FloatProperty(
name="Arc Radius 1", min=0.00001, default=1, description=PDT_DES_RADIUS1
name="Arc Radius 1", min=0.00001, default=1, unit="LENGTH", description=PDT_DES_RADIUS1
)
tangent_radius1: FloatProperty(
name="Arc Radius 2", min=0.00001, default=1, description=PDT_DES_RADIUS2
name="Arc Radius 2", min=0.00001, default=1, unit="LENGTH", description=PDT_DES_RADIUS2
)
tangent_point2: FloatVectorProperty(
name="Coordst3", default=(0.0, 0.0, 0.0), subtype="XYZ", description=PDT_DES_TANCEN3
59 changes: 25 additions & 34 deletions pdt_command.py
Original file line number Diff line number Diff line change
@@ -220,9 +220,9 @@ def command_run(self, context):
mode = command[1].lower()
if (
(operation == "F" and mode not in {"v", "e", "i"})
or (operation in {"D", "E"} and mode not in {"d", "i", "v"}) #new
or (operation in {"D", "E"} and mode not in {"d", "i", "n"}) #new
or (operation == "M" and mode not in {"a", "d", "i", "p", "o", "x", "y", "z"})
or (operation not in {"D", "E", "F", "M"} and mode not in {"a", "d", "i", "p", "v"}) #new
or (operation not in {"D", "E", "F", "M"} and mode not in {"a", "d", "i", "p", "n"}) #new
):
pg.error = f"'{mode}' {PDT_ERR_NON_VALID} '{operation}'"
context.window_manager.popup_menu(oops, title="Error", icon="ERROR")
@@ -341,7 +341,7 @@ def pdt_help(self, context):
label(text="d: Delta (Relative) Coordinates, e.g. 0.5,0,1.2")
label(text="i: Directional (Polar) Coordinates e.g. 2.6,45")
label(text="p: Percent e.g. 67.5")
label(text="v: Work in View Normal Axis")
label(text="n: Work in View Normal Axis")
label(text="")
label(text="- Fillet Options:")
label(text="v: Fillet Vertices")
@@ -440,7 +440,7 @@ def command_parse(context):
except ValueError:
values[ind] = "0.0"
ind = ind + 1
if mode == "v":
if mode == "n":
# View relative mode
if pg.plane == "XZ":
values = [0.0, values[0], 0.0]
@@ -522,7 +522,7 @@ def move_cursor_pivot(context, pg, operation, mode, obj, verts, values):
"""

# Absolute/Global Coordinates, or Delta/Relative Coordinates
if mode in {"a", "d", "v"}:
if mode in {"a", "d", "n"}:
try:
vector_delta = vector_build(context, pg, obj, operation, values, 3)
except:
@@ -552,8 +552,8 @@ def move_cursor_pivot(context, pg, operation, mode, obj, verts, values):
scene.cursor.location = vector_delta
elif operation == "P":
pg.pivot_loc = vector_delta
elif mode in {"d", "i", "v"}:
if pg.plane == "LO" and mode in {"d", "v"}:
elif mode in {"d", "i", "n"}:
if pg.plane == "LO" and mode in {"d", "n"}:
vector_delta = view_coords(vector_delta.x, vector_delta.y, vector_delta.z)
elif pg.plane == "LO" and mode == "i":
vector_delta = view_dir(pg.distance, pg.angle)
@@ -622,8 +622,8 @@ def move_entities(context, pg, operation, mode, obj, bm, verts, values):
for ob in context.view_layer.objects.selected:
ob.location = vector_delta

elif mode in {"d", "i", "v"}:
if mode in {"d", "v"}:
elif mode in {"d", "i", "n"}:
if mode in {"d", "n"}:
# Delta/Relative Coordinates
try:
vector_delta = vector_build(context, pg, obj, operation, values, 3)
@@ -636,7 +636,7 @@ def move_entities(context, pg, operation, mode, obj, bm, verts, values):
except:
raise PDT_InvalidVector

if pg.plane == "LO" and mode in {"d", "v"}:
if pg.plane == "LO" and mode in {"d", "n"}:
vector_delta = view_coords(vector_delta.x, vector_delta.y, vector_delta.z)
elif pg.plane == "LO" and mode == "i":
vector_delta = view_dir(pg.distance, pg.angle)
@@ -693,7 +693,7 @@ def add_new_vertex(context, pg, operation, mode, obj, bm, verts, values):
raise PDT_InvalidVector
new_vertex = bm.verts.new(vector_delta - obj_loc)
# Delta/Relative Coordinates
elif mode in {"d", "v"}:
elif mode in {"d", "n"}:
try:
vector_delta = vector_build(context, pg, obj, operation, values, 3)
except:
@@ -867,7 +867,7 @@ def extrude_vertices(context, pg, operation, mode, obj, obj_loc, bm, verts, valu
bm, verts=[v for v in bm.verts if v.select], dist=0.0001
)
# Delta/Relative Coordinates
elif mode in {"d", "v"}:
elif mode in {"d", "n"}:
try:
vector_delta = vector_build(context, pg, obj, operation, values, 3)
except:
@@ -935,7 +935,7 @@ def extrude_geometry(context, pg, operation, mode, obj, bm, values):
context.window_manager.popup_menu(oops, title="Error", icon="ERROR")
return
# Delta/Relative Coordinates
if mode in {"d", "v"}:
if mode in {"d", "n"}:
try:
vector_delta = vector_build(context, pg, obj, operation, values, 3)
except:
@@ -962,7 +962,7 @@ def extrude_geometry(context, pg, operation, mode, obj, bm, values):
faces_extr = [f for f in geom_extr if isinstance(f, bmesh.types.BMFace)]
del ret

if pg.plane == "LO" and mode in {"d", "v"}:
if pg.plane == "LO" and mode in {"d", "n"}:
vector_delta = view_coords(vector_delta.x, vector_delta.y, vector_delta.z)
elif pg.plane == "LO" and mode == "i":
vector_delta = view_dir(pg.distance, pg.angle)
@@ -994,7 +994,7 @@ def duplicate_geometry(context, pg, operation, mode, obj, bm, values):
context.window_manager.popup_menu(oops, title="Error", icon="ERROR")
return
# Delta/Relative Coordinates
if mode in {"d", "v"}:
if mode in {"d", "n"}:
try:
vector_delta = vector_build(context, pg, obj, operation, values, 3)
except:
@@ -1021,7 +1021,7 @@ def duplicate_geometry(context, pg, operation, mode, obj, bm, values):
faces_dupe = [f for f in geom_dupe if isinstance(f, bmesh.types.BMFace)]
del ret

if pg.plane == "LO" and mode in {"d", "v"}:
if pg.plane == "LO" and mode in {"d", "n"}:
vector_delta = view_coords(vector_delta.x, vector_delta.y, vector_delta.z)
elif pg.plane == "LO" and mode == "i":
vector_delta = view_dir(pg.distance, pg.angle)
@@ -1053,10 +1053,10 @@ def fillet_geometry(context, pg, mode, obj, bm, verts, values):
context.window_manager.popup_menu(oops, title="Error", icon="ERROR")
return
if mode in {"i", "v"}:
vert_bool = True
affect = 'VERTICES'
else:
# Must be "e"
vert_bool = False
affect = 'EDGES'
# Note that passing an empty parameter results in that parameter being seen as "0"
# _offset <= 0 is ignored since a bevel/fillet radius must be > 0 to make sense
_offset = float(values[0])
@@ -1105,19 +1105,10 @@ def fillet_geometry(context, pg, mode, obj, bm, verts, values):
context.window_manager.popup_menu(oops, title="Error", icon="ERROR")
raise PDT_SelectionError

if vert_bool:
bpy.ops.mesh.bevel(
offset_type="OFFSET",
offset=_offset,
segments=_segments,
profile=_profile,
affect='VERTICES'
)
else:
bpy.ops.mesh.bevel(
offset_type="OFFSET",
offset=_offset,
segments=_segments,
profile=_profile,
affect='EDGES'
)
bpy.ops.mesh.bevel(
offset_type="OFFSET",
offset=_offset,
segments=_segments,
profile=_profile,
affect=affect
)
22 changes: 11 additions & 11 deletions pdt_design.py
Original file line number Diff line number Diff line change
@@ -184,7 +184,7 @@ def execute(self, context):
f",{str(round(pg.cartesian_coords.z, decimal_places))}"
)
elif operation == "EV":
# Extrue Vertices
# Extrude Vertices
pg.command = (
f"vd{str(round(pg.cartesian_coords.x, decimal_places))}"
f",{str(round(pg.cartesian_coords.y, decimal_places))}"
@@ -198,7 +198,7 @@ def execute(self, context):
f",{str(round(pg.cartesian_coords.z, decimal_places))}"
)
elif operation == "EG":
# Extrue Geometry
# Extrude Geometry
pg.command = (
f"ed{str(round(pg.cartesian_coords.x, decimal_places))}"
f",{str(round(pg.cartesian_coords.y, decimal_places))}"
@@ -337,37 +337,37 @@ def execute(self, context):
if operation == "CU":
# Cursor
pg.command = (
f"cv{str(round(pg.distance, decimal_places))}"
f"cn{str(round(pg.distance, decimal_places))}"
)
elif operation == "PP":
# Pivot Point
pg.command = (
f"pv{str(round(pg.distance, decimal_places))}"
f"pn{str(round(pg.distance, decimal_places))}"
)
elif operation == "MV":
# Move Entities
pg.command = (
f"gv{str(round(pg.distance, decimal_places))}"
f"gn{str(round(pg.distance, decimal_places))}"
)
elif operation == "NV":
# New Vertex
pg.command = (
f"nv{str(round(pg.distance, decimal_places))}"
f"nn{str(round(pg.distance, decimal_places))}"
)
elif operation == "EV":
# Extrue Vertices
# Extrude Vertices
pg.command = (
f"vv{str(round(pg.distance, decimal_places))}"
f"vn{str(round(pg.distance, decimal_places))}"
)
elif operation == "DG":
# Duplicate Entities
pg.command = (
f"dv{str(round(pg.distance, decimal_places))}"
f"dn{str(round(pg.distance, decimal_places))}"
)
elif operation == "EG":
# Extrue Geometry
# Extrude Geometry
pg.command = (
f"ev{str(round(pg.distance, decimal_places))}"
f"en{str(round(pg.distance, decimal_places))}"
)
else:
error_message = f"{operation} {PDT_ERR_NON_VALID} {PDT_LAB_DEL}"

0 comments on commit 65d10a4

Please sign in to comment.