[Bf-extensions-cvs] [f4f651c1] blender-v2.82-release: PDT: Fix Small Error in Absolute based Functions

Alan Odom noreply at git.blender.org
Tue Feb 4 22:23:07 CET 2020


Commit: f4f651c1e956776e4e37cb7b5245c3341d93660a
Author: Alan Odom
Date:   Tue Feb 4 19:58:04 2020 +0000
Branches: blender-v2.82-release
https://developer.blender.org/rBAf4f651c1e956776e4e37cb7b5245c3341d93660a

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.

===================================================================

M	precision_drawing_tools/pdt_command.py

===================================================================

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]



More information about the Bf-extensions-cvs mailing list