[Bf-extensions-cvs] [04f482c5] master: Addon: Curve Tools: Refactoring. Added context menu.
Spivak Vladimir cwolf3d
noreply at git.blender.org
Fri Oct 11 01:55:18 CEST 2019
Commit: 04f482c5aa48a1b04a429dafba3e09f7287b9110
Author: Spivak Vladimir (cwolf3d)
Date: Fri Oct 11 02:52:59 2019 +0300
Branches: master
https://developer.blender.org/rBA04f482c5aa48a1b04a429dafba3e09f7287b9110
Addon: Curve Tools: Refactoring. Added context menu.
===================================================================
M curve_tools/Curves.py
M curve_tools/Operators.py
M curve_tools/Properties.py
M curve_tools/Surfaces.py
M curve_tools/__init__.py
M curve_tools/auto_loft.py
M curve_tools/cad.py
D curve_tools/curve_outline.py
D curve_tools/curve_remove_doubles.py
M curve_tools/exports.py
A curve_tools/fillet.py
M curve_tools/internal.py
R094 curve_tools/CurveIntersections.py curve_tools/intersections.py
R100 curve_tools/Math.py curve_tools/mathematics.py
A curve_tools/outline.py
R095 curve_tools/PathFinder.py curve_tools/path_finder.py
A curve_tools/remove_doubles.py
R092 curve_tools/ShowCurveResolution.py curve_tools/show_resolution.py
R096 curve_tools/SplinesSequence.py curve_tools/splines_sequence.py
M curve_tools/toolpath.py
===================================================================
diff --git a/curve_tools/Curves.py b/curve_tools/Curves.py
index d5608e3c..da0b1398 100644
--- a/curve_tools/Curves.py
+++ b/curve_tools/Curves.py
@@ -1,4 +1,4 @@
-from . import Math
+from . import mathematics
import bpy
@@ -390,7 +390,7 @@ class BezierSpline:
self.segments.append(BezierSegment(self.segments[-1].bezierPoint2, spline2.segments[0].bezierPoint1))
for seg2 in spline2.segments: self.segments.append(seg2)
- self.resolution += spline2.resolution # extra segment will usually be short -- impact on resolution negligible
+ self.resolution += spline2.resolution # extra segment will usually be short -- impact on resolution negligable
self.isCyclic = False # is this ok?
@@ -559,11 +559,11 @@ class Curve:
currEndPoint = currentSpline.segments[-1].bezierPoint2.co
nextStartPoint = nextSpline.segments[0].bezierPoint1.co
- if Math.IsSamePoint(currEndPoint, nextStartPoint, threshold): return [currentSpline, nextSpline]
+ if mathematics.IsSamePoint(currEndPoint, nextStartPoint, threshold): return [currentSpline, nextSpline]
nextEndPoint = nextSpline.segments[-1].bezierPoint2.co
currStartPoint = currentSpline.segments[0].bezierPoint1.co
- if Math.IsSamePoint(nextEndPoint, currStartPoint, threshold): return [nextSpline, currentSpline]
+ if mathematics.IsSamePoint(nextEndPoint, currStartPoint, threshold): return [nextSpline, currentSpline]
return None
else:
@@ -575,18 +575,18 @@ class Curve:
currEndPoint = currentSpline.segments[-1].bezierPoint2.co
nextStartPoint = nextSpline.segments[0].bezierPoint1.co
- if Math.IsSamePoint(currEndPoint, nextStartPoint, threshold): return [currentSpline, nextSpline]
+ if mathematics.IsSamePoint(currEndPoint, nextStartPoint, threshold): return [currentSpline, nextSpline]
nextEndPoint = nextSpline.segments[-1].bezierPoint2.co
currStartPoint = currentSpline.segments[0].bezierPoint1.co
- if Math.IsSamePoint(nextEndPoint, currStartPoint, threshold): return [nextSpline, currentSpline]
+ if mathematics.IsSamePoint(nextEndPoint, currStartPoint, threshold): return [nextSpline, currentSpline]
- if Math.IsSamePoint(currEndPoint, nextEndPoint, threshold):
+ if mathematics.IsSamePoint(currEndPoint, nextEndPoint, threshold):
nextSpline.Reverse()
#print("## ", "nextSpline.Reverse()")
return [currentSpline, nextSpline]
- if Math.IsSamePoint(currStartPoint, nextStartPoint, threshold):
+ if mathematics.IsSamePoint(currStartPoint, nextStartPoint, threshold):
currentSpline.Reverse()
#print("## ", "currentSpline.Reverse()")
return [currentSpline, nextSpline]
diff --git a/curve_tools/Operators.py b/curve_tools/Operators.py
index edf16ab1..e4fe24dd 100644
--- a/curve_tools/Operators.py
+++ b/curve_tools/Operators.py
@@ -7,12 +7,12 @@ from bpy_extras import object_utils, view3d_utils
from mathutils import *
from math import *
-from . import Properties
-from . import Curves
-from . import CurveIntersections
-from . import Util
-from . import Surfaces
-from . import Math
+from . import properties
+from . import curves
+from . import intersections
+from . import util
+from . import surfaces
+from . import mathematics
# 1 CURVE SELECTED
# ################
@@ -24,11 +24,11 @@ class OperatorCurveInfo(bpy.types.Operator):
@classmethod
def poll(cls, context):
- return Util.Selected1Curve()
+ return util.Selected1Curve()
def execute(self, context):
- curve = Curves.Curve(context.active_object)
+ curve = curves.Curve(context.active_object)
nrSplines = len(curve.splines)
nrSegments = 0
@@ -52,11 +52,11 @@ class OperatorCurveLength(bpy.types.Operator):
@classmethod
def poll(cls, context):
- return Util.Selected1Curve()
+ return util.Selected1Curve()
def execute(self, context):
- curve = Curves.Curve(context.active_object)
+ curve = curves.Curve(context.active_object)
context.scene.curvetools.CurveLength = curve.length
@@ -72,11 +72,11 @@ class OperatorSplinesInfo(bpy.types.Operator):
@classmethod
def poll(cls, context):
- return Util.Selected1Curve()
+ return util.Selected1Curve()
def execute(self, context):
- curve = Curves.Curve(context.active_object)
+ curve = curves.Curve(context.active_object)
nrSplines = len(curve.splines)
print("")
@@ -105,11 +105,11 @@ class OperatorSegmentsInfo(bpy.types.Operator):
@classmethod
def poll(cls, context):
- return Util.Selected1Curve()
+ return util.Selected1Curve()
def execute(self, context):
- curve = Curves.Curve(context.active_object)
+ curve = curves.Curve(context.active_object)
nrSplines = len(curve.splines)
nrSegments = 0
@@ -146,7 +146,7 @@ class OperatorOriginToSpline0Start(bpy.types.Operator):
@classmethod
def poll(cls, context):
- return Util.Selected1Curve()
+ return util.Selected1Curve()
def execute(self, context):
@@ -183,11 +183,11 @@ class OperatorIntersectCurves(bpy.types.Operator):
@classmethod
def poll(cls, context):
- return Util.Selected2OrMoreCurves()
+ return util.Selected2OrMoreCurves()
def execute(self, context):
- print("### TODO: OperatorIntersectCurves.execute()")
+ print("### TODO: OperatorIntersectcurves.execute()")
algo = context.scene.curvetools.IntersectCurvesAlgorithm
print("-- algo:", algo)
@@ -213,7 +213,7 @@ class OperatorIntersectCurves(bpy.types.Operator):
selected_objects[j].select_set(True)
if selected_objects[i].type == 'CURVE' and selected_objects[j].type == 'CURVE':
- curveIntersector = CurveIntersections.CurvesIntersector.FromSelection()
+ curveIntersector = intersections.CurvesIntersector.FromSelection()
rvIntersectionNrs = curveIntersector.CalcAndApplyIntersections()
self.report({'INFO'}, "Active curve points: %d; other curve points: %d" % (rvIntersectionNrs[0], rvIntersectionNrs[1]))
@@ -234,16 +234,16 @@ class OperatorLoftCurves(bpy.types.Operator):
@classmethod
def poll(cls, context):
- return Util.Selected2Curves()
+ return util.Selected2Curves()
def execute(self, context):
- #print("### TODO: OperatorLoftCurves.execute()")
+ #print("### TODO: OperatorLoftcurves.execute()")
- loftedSurface = Surfaces.LoftedSurface.FromSelection()
+ loftedSurface = surfaces.LoftedSurface.FromSelection()
loftedSurface.AddToScene()
- self.report({'INFO'}, "OperatorLoftCurves.execute()")
+ self.report({'INFO'}, "OperatorLoftcurves.execute()")
return {'FINISHED'}
@@ -259,16 +259,16 @@ class OperatorSweepCurves(bpy.types.Operator):
@classmethod
def poll(cls, context):
- return Util.Selected2Curves()
+ return util.Selected2Curves()
def execute(self, context):
- #print("### TODO: OperatorSweepCurves.execute()")
+ #print("### TODO: OperatorSweepcurves.execute()")
- sweptSurface = Surfaces.SweptSurface.FromSelection()
+ sweptSurface = surfaces.SweptSurface.FromSelection()
sweptSurface.AddToScene()
- self.report({'INFO'}, "OperatorSweepCurves.execute()")
+ self.report({'INFO'}, "OperatorSweepcurves.execute()")
return {'FINISHED'}
@@ -284,11 +284,11 @@ class OperatorBirail(bpy.types.Operator):
@classmethod
def poll(cls, context):
- return Util.Selected3Curves()
+ return util.Selected3Curves()
def execute(self, context):
- birailedSurface = Surfaces.BirailedSurface.FromSelection()
+ birailedSurface = surfaces.BirailedSurface.FromSelection()
birailedSurface.AddToScene()
self.report({'INFO'}, "OperatorBirail.execute()")
@@ -307,12 +307,12 @@ class OperatorSplinesSetResolution(bpy.types.Operator):
@classmethod
def poll(cls, context):
- return Util.Selected1OrMoreCurves()
+ return util.Selected1OrMoreCurves()
def execute(self, context):
splRes = context.scene.curvetools.SplineResolution
- selCurves = Util.GetSelectedCurves()
+ selCurves = util.GetSelectedCurves()
for blCurve in selCurves:
for spline in blCurve.data.splines:
@@ -331,14 +331,14 @@ class OperatorSplinesRemoveZeroSegment(bpy.types.Operator):
@classmethod
def poll(cls, context):
- return Util.Selected1OrMoreCurves()
+ return util.Selected1OrMoreCurves()
def execute(self, context):
- selCurves = Util.GetSelectedCurves()
+ selCurves = util.GetSelectedCurves()
for blCurve in selCurves:
- curve = Curves.Curve(blCurve)
+ curve = curves.Curve(blCurve)
nrSplines = curve.nrSplines
splinesToRemove = []
@@ -365,15 +365,15 @@ class OperatorSplinesRemoveShort(bpy.types.Operator):
@classmethod
def poll(cls, context):
- return Util.Selected1OrMoreCurves()
+ return util.Selected1OrMoreCurves()
def execute(self, context):
threshold = context.scene.curvetools.SplineRemoveLength
- selCurves = Util.GetSelectedCurves()
+ selCurves = util.GetSelectedCurves()
for blCurve in selCurves:
- curve = Curves.Curve(blCurve)
+ curve = curves.Curve(blCurve)
nrSplines = curve.nrSplines
nrRemovedSplines = curve.RemoveShortSplines(threshold)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list