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-03-15 00:32:37 +0300
committerRune Morling <ermo.blender.org@spammesenseless.net>2020-03-28 20:56:27 +0300
commitc06f76b0122cb8e952f0da06ff26cef261f3b698 (patch)
tree49906128eba8a0e2d1cbab42d9b647fa48fef5b8
parentee577f162df26669b9851be64a2a9ace44917496 (diff)
PDT: Revise Docstrings
Made functions more understandable by improving DocStrings
-rw-r--r--pdt_tangent.py39
-rw-r--r--precision_drawing_tools/pdt_command.py2
2 files changed, 36 insertions, 5 deletions
diff --git a/pdt_tangent.py b/pdt_tangent.py
index d292a7ff..d743d3eb 100644
--- a/pdt_tangent.py
+++ b/pdt_tangent.py
@@ -113,6 +113,7 @@ def get_tangent_points(context, hloc_0, vloc_0, radius_0, hloc_p, vloc_p):
vloc_t1: Vertical Location of First Tangent Point
vloc_t2: Vertical Location of Second Tangent Point
"""
+
numerator = (radius_0 ** 2 * (hloc_p - hloc_0)) + (
radius_0
* (vloc_p - vloc_0)
@@ -202,7 +203,23 @@ def make_vectors(coords, a1, a2, a3, pg):
def tangent_setup(context, pg, plane, obj_data, centre_0, centre_1, centre_2, radius_0, radius_1):
- # Depth is a3
+ """This section sets up all the variables required for the tangent functions.
+
+ Args:
+ context: Blender bpy.context instance
+ pg: PDT Parameter Group of variables
+ plane: Working plane
+ obj_data: All the data of the chosen object
+ centre_0: Centre coordinates of the first arc
+ centre_1: Centre coordinates of the second arc
+ centre_2: Coordinates fo the point
+ radius_0: Radius if the first Arc
+ radius_1: Radius of the second Arc
+
+ Returns:
+ Status Set.
+ """
+
a1, a2, a3 = set_mode(plane)
mode = pg.tangent_mode
if plane == "LO":
@@ -226,6 +243,11 @@ def tangent_setup(context, pg, plane, obj_data, centre_0, centre_1, centre_2, ra
context.window_manager.popup_menu(oops, title="Error", icon="ERROR")
return {"FINISHED"}
+ """This next section will draw Point based Tangents.
+
+ These are drawn from a point to an Arc
+ """
+
if mode == "point":
if (
(centre_2[a1] - centre_0[a1]) ** 2 + (centre_2[a2] - centre_0[a2]) ** 2 - radius_0 ** 2
@@ -259,8 +281,12 @@ def tangent_setup(context, pg, plane, obj_data, centre_0, centre_1, centre_2, ra
return {"FINISHED"}
+ """This next section will draw Arc based Outer Tangents.
+
+ These are drawn from an Arc to another Arc
+ """
+
if mode in {"outer", "both"}:
- # Outer Tangents
if radius_0 == radius_1:
# No intersection point for outer tangents
sin_angle = (centre_1[a2] - centre_0[a2]) / distance
@@ -310,8 +336,12 @@ def tangent_setup(context, pg, plane, obj_data, centre_0, centre_1, centre_2, ra
tangent_vectors = make_vectors(coords_in, a1, a2, a3, pg)
draw_tangents(tangent_vectors, obj_data)
+ """This next section will draw Arc based Inner Tangents.
+
+ These are drawn from an Arc to another Arc
+ """
+
if mode in {"inner", "both"}:
- # Inner Tangents
hloc_pi, vloc_pi = get_tangent_intersect_inner(
centre_0[a1], centre_0[a2], centre_1[a1], centre_1[a2], radius_0, radius_1
)
@@ -347,6 +377,8 @@ def tangent_setup(context, pg, plane, obj_data, centre_0, centre_1, centre_2, ra
tangent_vectors = make_vectors(coords_in, a1, a2, a3, pg)
draw_tangents(tangent_vectors, obj_data)
+ return {"FINISHED"}
+
def draw_tangents(tangent_vectors, obj_data):
"""Add Edges Representing the Tangents.
@@ -452,7 +484,6 @@ class PDT_OT_TangentOperate(Operator):
Returns:
Nothing.
"""
-
scene = context.scene
pg = scene.pdt_pg
plane = pg.plane
diff --git a/precision_drawing_tools/pdt_command.py b/precision_drawing_tools/pdt_command.py
index fa7d43bf..0ae7e820 100644
--- a/precision_drawing_tools/pdt_command.py
+++ b/precision_drawing_tools/pdt_command.py
@@ -460,7 +460,7 @@ def command_parse(context):
obj_loc = obj.matrix_world.decompose()[0]
verts = []
else:
- if operation not in {"G"}:
+ if operation != "G":
pg.error = PDT_OBJ_MODE_ERROR
context.window_manager.popup_menu(oops, title="Error", icon="ERROR")
raise PDT_ObjectModeError