Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blender-addons
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
blender-addons
Commits
9714cfe4
Commit
9714cfe4
authored
5 years ago
by
Spivak Vladimir (cwolf3d)
Browse files
Options
Downloads
Patches
Plain Diff
Addon: Curve Tools: Outline now works for all curve types
parent
9f1b91ca
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
curve_tools/outline.py
+55
-14
55 additions, 14 deletions
curve_tools/outline.py
with
55 additions
and
14 deletions
curve_tools/outline.py
+
55
−
14
View file @
9714cfe4
...
...
@@ -24,8 +24,8 @@ bl_info = {
"
name
"
:
"
Curve Outline
"
,
"
description
"
:
"
creates an Outline
"
,
"
category
"
:
"
Object
"
,
"
author
"
:
"
Yann Bertrand (jimflim)
"
,
"
version
"
:
(
0
,
4
),
"
author
"
:
"
Yann Bertrand (jimflim)
, Vladimir Spivak (cwolf3d)
"
,
"
version
"
:
(
0
,
5
),
"
blender
"
:
(
2
,
69
,
0
),
}
...
...
@@ -41,20 +41,27 @@ def createOutline(curve, outline):
for
spline
in
curve
.
data
.
splines
[:]:
if
spline
.
type
==
'
BEZIER
'
:
p
=
spline
.
bezier_points
if
len
(
p
)
<
2
:
return
out
=
[]
n
=
((
p
[
0
].
handle_right
-
p
[
0
].
co
).
normalized
()
-
(
p
[
0
].
handle_left
-
p
[
0
].
co
).
normalized
()).
normalized
()
n
=
((
p
[
0
].
handle_right
-
p
[
0
].
co
).
normalized
()
-
(
p
[
0
].
handle_left
-
p
[
0
].
co
).
normalized
()).
normalized
()
n
=
Vector
((
-
n
[
1
],
n
[
0
],
n
[
2
]))
o
=
p
[
0
].
co
+
outline
*
n
o
=
p
[
0
].
co
+
outline
*
n
out
.
append
(
o
)
for
i
in
range
(
1
,
len
(
p
)):
n
=
((
p
[
i
].
handle_right
-
p
[
i
].
co
).
normalized
()
-
(
p
[
i
].
handle_left
-
p
[
i
].
co
).
normalized
()).
normalized
()
for
i
in
range
(
1
,
len
(
p
)
-
1
):
n
=
((
p
[
i
].
handle_right
-
p
[
i
].
co
).
normalized
()
-
(
p
[
i
].
handle_left
-
p
[
i
].
co
).
normalized
()).
normalized
()
n
=
Vector
((
-
n
[
1
],
n
[
0
],
n
[
2
]))
o
=
intersect_line_line
(
out
[
-
1
],
(
out
[
-
1
]
+
p
[
i
].
co
-
p
[
i
-
1
].
co
),
p
[
i
].
co
,
p
[
i
].
co
+
n
)[
0
]
o
=
intersect_line_line
(
out
[
-
1
],
(
out
[
-
1
]
+
p
[
i
].
co
-
p
[
i
-
1
].
co
),
p
[
i
].
co
,
p
[
i
].
co
+
n
)[
0
]
out
.
append
(
o
)
n
=
((
p
[
-
1
].
handle_right
-
p
[
-
1
].
co
).
normalized
()
-
(
p
[
-
1
].
handle_left
-
p
[
-
1
].
co
).
normalized
()).
normalized
()
n
=
Vector
((
-
n
[
1
],
n
[
0
],
n
[
2
]))
o
=
p
[
-
1
].
co
+
outline
*
n
out
.
append
(
o
)
curve
.
data
.
splines
.
new
(
'
BEZIER
'
)
curve
.
data
.
splines
.
new
(
spline
.
type
)
if
spline
.
use_cyclic_u
:
curve
.
data
.
splines
[
-
1
].
use_cyclic_u
=
True
p_out
=
curve
.
data
.
splines
[
-
1
].
bezier_points
...
...
@@ -67,19 +74,53 @@ def createOutline(curve, outline):
p_out
[
i
].
co
=
out
[
i
]
if
i
<
len
(
out
)
-
1
:
l
=
(
p
[
i
+
1
].
co
-
p
[
i
].
co
).
length
l2
=
(
out
[
i
]
-
out
[
i
+
1
]).
length
l
=
(
p
[
i
+
1
].
co
-
p
[
i
].
co
).
length
l2
=
(
out
[
i
]
-
out
[
i
+
1
]).
length
if
i
==
0
:
p_out
[
i
].
handle_left
=
out
[
i
]
+
((
p
[
i
].
handle_left
-
p
[
i
].
co
)
*
l2
/
l
)
p_out
[
i
].
handle_left
=
out
[
i
]
+
((
p
[
i
].
handle_left
-
p
[
i
].
co
)
*
l2
/
l
)
if
i
<
len
(
out
)
-
1
:
p_out
[
i
+
1
].
handle_left
=
out
[
i
+
1
]
+
((
p
[
i
+
1
].
handle_left
-
p
[
i
+
1
].
co
)
*
l2
/
l
)
p_out
[
i
].
handle_right
=
out
[
i
]
+
((
p
[
i
].
handle_right
-
p
[
i
].
co
)
*
l2
/
l
)
p_out
[
i
+
1
].
handle_left
=
out
[
i
+
1
]
+
((
p
[
i
+
1
].
handle_left
-
p
[
i
+
1
].
co
)
*
l2
/
l
)
p_out
[
i
].
handle_right
=
out
[
i
]
+
((
p
[
i
].
handle_right
-
p
[
i
].
co
)
*
l2
/
l
)
for
i
in
range
(
len
(
p
)):
p_out
[
i
].
handle_left_type
=
p
[
i
].
handle_left_type
p_out
[
i
].
handle_right_type
=
p
[
i
].
handle_right_type
else
:
if
len
(
spline
.
points
)
<
2
:
return
p
=
[]
for
point
in
spline
.
points
:
v
=
Vector
((
point
.
co
[
0
],
point
.
co
[
1
],
point
.
co
[
2
]))
p
.
append
(
v
)
out
=
[]
n
=
((
p
[
1
]
-
p
[
0
]).
normalized
()
-
(
p
[
-
1
]
-
p
[
0
]).
normalized
()).
normalized
()
n
=
Vector
((
-
n
[
1
],
n
[
0
],
n
[
2
]))
o
=
p
[
0
]
+
outline
*
n
out
.
append
(
o
)
for
i
in
range
(
1
,
len
(
p
)
-
1
):
n
=
((
p
[
i
+
1
]
-
p
[
i
]).
normalized
()
-
(
p
[
i
-
1
]
-
p
[
i
]).
normalized
()).
normalized
()
n
=
Vector
((
-
n
[
1
],
n
[
0
],
n
[
2
]))
o
=
intersect_line_line
(
out
[
-
1
],
(
out
[
-
1
]
+
p
[
i
]
-
p
[
i
-
1
]),
p
[
i
],
p
[
i
]
+
n
)[
0
]
out
.
append
(
o
)
n
=
((
p
[
0
]
-
p
[
-
1
]).
normalized
()
-
(
p
[
-
2
]
-
p
[
-
1
]).
normalized
()).
normalized
()
n
=
Vector
((
-
n
[
1
],
n
[
0
],
n
[
2
]))
o
=
p
[
-
1
]
+
outline
*
n
out
.
append
(
o
)
curve
.
data
.
splines
.
new
(
spline
.
type
)
if
spline
.
use_cyclic_u
:
curve
.
data
.
splines
[
-
1
].
use_cyclic_u
=
True
p_out
=
curve
.
data
.
splines
[
-
1
].
points
p_out
.
add
(
len
(
out
)
-
1
)
for
i
in
range
(
len
(
out
)):
p_out
[
i
].
co
=
(
out
[
i
][
0
],
out
[
i
][
1
],
out
[
i
][
2
],
0.0
)
return
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment