Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Odom <clockmender@icloud.com>2020-02-04 22:58:04 +0300
committerRune Morling <ermo.blender.org@spammesenseless.net>2020-02-05 00:21:09 +0300
commitf4f651c1e956776e4e37cb7b5245c3341d93660a (patch)
treea62f8b03729d0d2b57b66dd1818b7ba4f6265940 /precision_drawing_tools
parentae250bd102e4c16934897b6675d48462b4e2fd4f (diff)
PDT: Fix Small Error in Absolute based Functions
This fixes a small obscure error in Absolute mode whereby Bmesh was not always found if Absolute mode was used. This became apparent if no object was selected and an attempt was made to add a new vertex, or extrude vertices. Other checks did not trap for this error. These traps were originally stored in the individual functions, now all traps are moved to the command parse function.
Diffstat (limited to 'precision_drawing_tools')
-rw-r--r--precision_drawing_tools/pdt_command.py30
1 files changed, 23 insertions, 7 deletions
diff --git a/precision_drawing_tools/pdt_command.py b/precision_drawing_tools/pdt_command.py
index e2c4c5dc..dbcb76c2 100644
--- a/precision_drawing_tools/pdt_command.py
+++ b/precision_drawing_tools/pdt_command.py
@@ -62,6 +62,7 @@ from .pdt_msg_strings import (
PDT_ERR_SEL_4_VERTS,
PDT_ERR_INT_LINES,
PDT_LAB_PLANE,
+ PDT_ERR_NO_ACT_OBJ,
)
from .pdt_bix import add_line_to_bisection
from .pdt_etof import extend_vertex
@@ -74,6 +75,7 @@ PDT_CommandFailure = pdt_exception.CommandFailure
PDT_ObjectModeError = pdt_exception.ObjectModeError
PDT_MathsError = pdt_exception.MathsError
PDT_IntersectionError = pdt_exception.IntersectionError
+PDT_NoObjectError = pdt_exception.NoObjectError
class PDT_OT_CommandReRun(Operator):
@@ -436,14 +438,28 @@ def command_parse(context):
obj_loc = Vector((0,0,0))
verts = []
- if mode_sel == 'REL' and operation not in {"C", "P"}:
- pg.select = 'SEL'
+ if mode == "a" and operation not in {"C", "P"}:
+ # Place new Vetex, or Extrude Vertices by Absolute Coords.
+ if mode_sel == 'REL':
+ pg.select = 'SEL'
+ if obj is not None:
+ if obj.mode == "EDIT":
+ bm = bmesh.from_edit_mesh(obj.data)
+ obj_loc = obj.matrix_world.decompose()[0]
+ verts = []
+ else:
+ pg.error = PDT_OBJ_MODE_ERROR
+ context.window_manager.popup_menu(oops, title="Error", icon="ERROR")
+ raise PDT_ObjectModeError
+ else:
+ pg.error = PDT_ERR_NO_ACT_OBJ
+ context.window_manager.popup_menu(oops, title="Error", icon="ERROR")
+ raise PDT_NoObjectError
- if (
- (mode_sel == 'SEL' and mode not in {"a"})
- or
- (mode == "a" and operation not in {"C", "P"})
- ):
+
+ if mode_sel == 'SEL' and mode not in {"a"}:
+ # All other options except Cursor or Pivot by Absolute
+ # These options require no object, etc.
bm, good = obj_check(obj, scene, operation)
if good and obj.mode == 'EDIT':
obj_loc = obj.matrix_world.decompose()[0]