[Bf-extensions-cvs] [83ad65d3] blender-v2.82-release: PDT: Update Docstrings per Design Spec Document

Alan Odom noreply at git.blender.org
Sat Feb 1 16:44:50 CET 2020


Commit: 83ad65d377f9899f624277cc90dd838496f0e4f3
Author: Alan Odom
Date:   Thu Jan 30 20:58:48 2020 +0000
Branches: blender-v2.82-release
https://developer.blender.org/rBA83ad65d377f9899f624277cc90dd838496f0e4f3

PDT: Update Docstrings per Design Spec Document

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

M	pdt_command_functions.py
M	pdt_exception.py
M	precision_drawing_tools/pdt_bix.py
M	precision_drawing_tools/pdt_cad_module.py
M	precision_drawing_tools/pdt_command.py
M	precision_drawing_tools/pdt_etof.py
M	precision_drawing_tools/pdt_functions.py
M	precision_drawing_tools/pdt_library.py
M	precision_drawing_tools/pdt_msg_strings.py
M	precision_drawing_tools/pdt_pivot_point.py
M	precision_drawing_tools/pdt_view.py
M	precision_drawing_tools/pdt_xall.py

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

diff --git a/pdt_command_functions.py b/pdt_command_functions.py
index 6a3dc1bf..0e891544 100644
--- a/pdt_command_functions.py
+++ b/pdt_command_functions.py
@@ -87,8 +87,11 @@ def vector_build(context, pg, obj, operation, values, num_values):
 
     Args:
         context: Blender bpy.context instance.
-        PDT parameter group as pg, object, operation,
-        command line values, required number of values.
+        pg: PDT Parameters Group - our variables
+        obj: The Active Object
+        operation: The Operation e.g. Create New Vertex
+        values: The paramters passed e.g. 1,4,3 for Catrtesan Coordinates
+        num_values: The number of values passed - determines the function
 
     Returns:
         Vector to position, or offset items.
@@ -123,19 +126,9 @@ def vector_build(context, pg, obj, operation, values, num_values):
 def placement_normal(context, operation):
     """Manipulates Geometry, or Objects by Normal Intersection between 3 points.
 
-    -- set position of CUrsor       (CU)
-    -- set position of Pivot Point  (PP)
-    -- MoVe geometry/objects        (MV)
-    -- Extrude Vertices             (EV)
-    -- Split Edges                  (SE)
-    -- add a New Vertex             (NV)
-
-    Invalid Options result in "oops" Error.
-
-    Local vector variable 'vector_delta' used to reposition features.
-
     Args:
         context: Blender bpy.context instance.
+        operation: The Operation e.g. Create New Vertex
 
     Returns:
         Status Set.
@@ -186,7 +179,7 @@ def placement_normal(context, operation):
             pg.pivot_loc = vector_delta
     elif operation == "G":
         if obj.mode == "EDIT":
-            if extend_all :
+            if extend_all:
                 for v in [v for v in bm.verts if v.select]:
                     v.co = vector_delta
                 bm.select_history.clear()
@@ -212,7 +205,7 @@ def placement_normal(context, operation):
     elif operation == "V" and obj.mode == "EDIT":
         vector_new = vector_delta
         vertex_new = bm.verts.new(vector_new)
-        if extend_all :
+        if extend_all:
             for v in [v for v in bm.verts if v.select]:
                 bm.edges.new([v, vertex_new])
         else:
@@ -230,18 +223,9 @@ def placement_normal(context, operation):
 def placement_arc_centre(context, operation):
     """Manipulates Geometry, or Objects to an Arc Centre defined by 3 points on an Imaginary Arc.
 
-    -- set position of CUrsor       (CU)
-    -- set position of Pivot Point  (PP)
-    -- MoVe geometry/objects        (MV)
-    -- Extrude Vertices             (EV)
-    -- add a New vertex             (NV)
-
-    Invalid Options result in "oops" Error.
-
-    Local vector variable 'vector_delta' used to reposition features.
-
     Args:
         context: Blender bpy.context instance.
+        operation: The Operation e.g. Create New Vertex
 
     Returns:
         Status Set.
@@ -288,7 +272,7 @@ def placement_arc_centre(context, operation):
             bm.select_history.clear()
             vertex_new.select_set(True)
         elif operation == "G":
-            if extend_all :
+            if extend_all:
                 for v in [v for v in bm.verts if v.select]:
                     v.co = vector_delta
                 bm.select_history.clear()
@@ -299,7 +283,7 @@ def placement_arc_centre(context, operation):
             bmesh.update_edit_mesh(obj.data)
         elif operation == "V":
             vertex_new = bm.verts.new(vector_delta)
-            if extend_all :
+            if extend_all:
                 for v in [v for v in bm.verts if v.select]:
                     bm.edges.new([v, vertex_new])
                     v.select_set(False)
@@ -338,19 +322,9 @@ def placement_arc_centre(context, operation):
 def placement_intersect(context, operation):
     """Manipulates Geometry, or Objects by Convergance Intersection between 4 points, or 2 Edges.
 
-    - Reads pg.plane scene variable and operates in Working Plane to:
-    -- set position of CUrsor       (CU)
-    -- set position of Pivot Point  (PP)
-    -- MoVe geometry/objects        (MV)
-    -- Extrude Vertices             (EV)
-    -- add a New vertex             (NV)
-
-    Invalid Options result in "oops" Error.
-
-    Local vector variable 'vector_delta' used to reposition features.
-
     Args:
         context: Blender bpy.context instance.
+        operation: The Operation e.g. Create New Vertex
 
     Returns:
         Status Set.
@@ -426,32 +400,32 @@ def placement_intersect(context, operation):
                     bm.edges.new([vertex_a, vertex_new])
                     process = True
             else:
-                if operation == "G" and extend_all :
+                if operation == "G" and extend_all:
                     vertex_b.co = vector_delta
-                elif operation == "V" and extend_all :
+                elif operation == "V" and extend_all:
                     vertex_new = bm.verts.new(vector_delta)
                     bm.edges.new([vertex_b, vertex_new])
                 else:
                     return
 
             if (vertex_c.co - vector_delta).length < (vertex_d.co - vector_delta).length:
-                if operation == "G" and extend_all :
+                if operation == "G" and extend_all:
                     vertex_c.co = vector_delta
-                elif operation == "V" and extend_all :
+                elif operation == "V" and extend_all:
                     bm.edges.new([vertex_c, vertex_new])
                 else:
                     return
             else:
-                if operation == "G" and extend_all :
+                if operation == "G" and extend_all:
                     vertex_d.co = vector_delta
-                elif operation == "V" and extend_all :
+                elif operation == "V" and extend_all:
                     bm.edges.new([vertex_d, vertex_new])
                 else:
                     return
             bm.select_history.clear()
             bmesh.ops.remove_doubles(bm, verts=bm.verts, dist=0.0001)
 
-            if not process and not extend_all :
+            if not process and not extend_all:
                 pg.error = PDT_ERR_INT_NO_ALL
                 context.window_manager.popup_menu(oops, title="Error", icon="ERROR")
                 bmesh.update_edit_mesh(obj.data)
diff --git a/pdt_exception.py b/pdt_exception.py
index c33777ab..dd2aea4d 100644
--- a/pdt_exception.py
+++ b/pdt_exception.py
@@ -25,47 +25,59 @@
 
 
 class SelectionError(Exception):
+    """Selection Error Exception."""
     pass
 
 
 class InvalidVector(Exception):
+    """Invalid Vector Exception."""
     pass
 
 
 class CommandFailure(Exception):
+    """Command Failure Exception."""
     pass
 
 
 class ObjectModeError(Exception):
+    """Object Mode Error Exception."""
     pass
 
 
 class MathsError(Exception):
+    """Mathematical Expression Error Exception."""
     pass
 
 
 class InfRadius(Exception):
+    """Infinite Radius Error Exception."""
     pass
 
 
 class NoObjectError(Exception):
+    """No Active Object Exception."""
     pass
 
 
 class IntersectionError(Exception):
+    """Failure to Find Intersect Exception."""
     pass
 
 
 class InvalidOperation(Exception):
+    """Invalid Operation Error Exception."""
     pass
 
 
 class VerticesConnected(Exception):
+    """Vertices Already Connected Exception."""
     pass
 
 
 class InvalidAngle(Exception):
+    """Angle Given was Outside Parameters Exception."""
     pass
 
 class ShaderError(Exception):
+    """GL Shader Error Exception."""
     pass
diff --git a/precision_drawing_tools/pdt_bix.py b/precision_drawing_tools/pdt_bix.py
index f6b5cb66..ec9661d9 100644
--- a/precision_drawing_tools/pdt_bix.py
+++ b/precision_drawing_tools/pdt_bix.py
@@ -117,7 +117,15 @@ class PDT_OT_LineOnBisection(bpy.types.Operator):
 
     @classmethod
     def poll(cls, context):
-        """Only allow operation on a mesh object in EDIT mode."""
+        """Only allow operation on a mesh object in EDIT mode.
+
+        Args:
+            context: Blender bpy.context instance.
+
+        Returns:
+            Boolean.
+        """
+
         obj = context.active_object
         if obj is None:
             return False
diff --git a/precision_drawing_tools/pdt_cad_module.py b/precision_drawing_tools/pdt_cad_module.py
index 880cf84d..74153a1d 100644
--- a/precision_drawing_tools/pdt_cad_module.py
+++ b/precision_drawing_tools/pdt_cad_module.py
@@ -33,7 +33,7 @@ def point_on_edge(point, edge):
     """Find Point on Edge.
 
     Args:
-        point:        vector
+        point:    vector
         edge:     tuple containing 2 vectors.
 
     Returns:
@@ -102,7 +102,7 @@ def test_coplanar(edge1, edge2):
 def closest_idx(intersect_point, edge):
     """Get Closest Vertex to input point.
 
-    If both points in e are equally far from intersect_point, then v1 is returned.
+    If both points in edge are equally far from intersect_point, then v1 is returned.
 
     Args:
         intersect_point:       vector
@@ -146,12 +146,30 @@ def closest_vector(intersect_point, edge):
 
 
 def coords_tuple_from_edge_idx(bm, idx):
-    """Return Tuple from Vertex."""
+    """Return Tuple from Vertices.
+
+    Args:
+        bm: Object Bmesh
+        idx: Index of chosen Edge
+
+    Returns:
+        Tuple from Edge Vertices.
+    """
+
     return tuple(v.co for v in bm.edges[idx].verts)
 
 
 def vectors_from_indices(bm, raw_vert_indices):
-    """Return List of vectors from input indices."""
+    """Return List of vectors from input Vertex Indices.
+
+    Args:
+        bm: Object Bmesh
+        raw_vert_indices: List of Chosen Vertex Indices
+
+    Returns:
+        List of Vertex coordinates.
+    """
+
     return [bm.verts[i].co for i in raw_vert_indices]
 
 
@@ -163,7 +181,7 @@ def vertex_indices_from_edges_tuple(bm, edge_tuple):
         edge_tuple:   contains 2 edge indices.
 
     Returns:
-        The vertex indices of edge_tuple.
+        The vertex indices of edge_tuple as an Integer list.
     """
 
     def find_verts(ind_v, ind_w):
@@ -176,11 +194,12 @@ def get_vert_indices_from_bmedges(edges):
     """Return List of Edges for evaluation.
 
     Args:
-       

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list