Skip to content
This repository was archived by the owner on May 9, 2025. It is now read-only.

Commit 9693e68

Browse files
sigmikeGermano Cavalcante
authored and
Germano Cavalcante
committed
Curve tools: Calculate length on multiple curves
Added support for multiple curves on the curve length tool. Pull Request: https://projects.blender.org/blender/blender-addons/pulls/104836
1 parent 35824c3 commit 9693e68

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

curve_tools/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"name": "Curve Tools",
77
"description": "Adds some functionality for bezier/nurbs curve/surface modeling",
88
"author": "Mackraken, Spivak Vladimir (cwolf3d)",
9-
"version": (0, 4, 5),
9+
"version": (0, 4, 6),
1010
"blender": (2, 80, 0),
1111
"location": "View3D > Tool Shelf > Edit Tab",
1212
"doc_url": "{BLENDER_MANUAL_URL}/addons/add_curve/curve_tools.html",

curve_tools/operators.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,23 @@ def execute(self, context):
5252
class OperatorCurveLength(bpy.types.Operator):
5353
bl_idname = "curvetools.operatorcurvelength"
5454
bl_label = "Length"
55-
bl_description = "Calculates the length of the active/selected curve"
55+
bl_description = "Calculates the length of the active/selected curves"
5656

5757

5858
@classmethod
5959
def poll(cls, context):
60-
return util.Selected1Curve()
60+
return util.Selected1OrMoreCurves()
6161

6262

6363
def execute(self, context):
64-
curve = curves.Curve(context.active_object)
64+
selCurves = util.GetSelectedCurves()
65+
66+
length = 0
67+
for blCurve in selCurves:
68+
curve = curves.Curve(blCurve)
69+
length += curve.length
6570

66-
context.scene.curvetools.CurveLength = curve.length
71+
context.scene.curvetools.CurveLength = length
6772

6873
return {'FINISHED'}
6974

0 commit comments

Comments
 (0)