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
b796cafc
Commit
b796cafc
authored
15 years ago
by
Martin Buerbaum
Browse files
Options
Downloads
Patches
Plain Diff
v0.10.5 - createFaces can now create fan/star like faces.
parent
ba413906
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
add_mesh_pipe_joint.py
+45
-12
45 additions, 12 deletions
add_mesh_pipe_joint.py
with
45 additions
and
12 deletions
add_mesh_pipe_joint.py
+
45
−
12
View file @
b796cafc
...
@@ -24,7 +24,7 @@ from bpy.props import *
...
@@ -24,7 +24,7 @@ from bpy.props import *
bl_addon_info
=
{
bl_addon_info
=
{
'
name
'
:
'
Add Mesh: Pipe Joints
'
,
'
name
'
:
'
Add Mesh: Pipe Joints
'
,
'
author
'
:
'
Buerbaum Martin (Pontiac)
'
,
'
author
'
:
'
Buerbaum Martin (Pontiac)
'
,
'
version
'
:
'
0.10.
4
'
,
'
version
'
:
'
0.10.
5
'
,
'
blender
'
:
(
2
,
5
,
3
),
'
blender
'
:
(
2
,
5
,
3
),
'
location
'
:
'
View3D > Add > Mesh > Pipe Joint
'
,
'
location
'
:
'
View3D > Add > Mesh > Pipe Joint
'
,
'
description
'
:
'
Adds 5 pipe Joint types to the Add Mesh menu
'
,
'
description
'
:
'
Adds 5 pipe Joint types to the Add Mesh menu
'
,
...
@@ -48,6 +48,7 @@ The functionality can then be accessed via the
...
@@ -48,6 +48,7 @@ The functionality can then be accessed via the
Note: Currently only the
"
Elbow
"
type supports odd number of vertices.
Note: Currently only the
"
Elbow
"
type supports odd number of vertices.
Version history:
Version history:
v0.10.5 - createFaces can now create fan/star like faces.
v0.10.4 - Updated the function
"
createFaces
"
a bit. No functional changes.
v0.10.4 - Updated the function
"
createFaces
"
a bit. No functional changes.
v0.10.3 - Updated store_recall_properties, apply_object_align
v0.10.3 - Updated store_recall_properties, apply_object_align
and create_mesh_object.
and create_mesh_object.
...
@@ -248,37 +249,69 @@ def create_mesh_object(context, verts, edges, faces, name, edit):
...
@@ -248,37 +249,69 @@ def create_mesh_object(context, verts, edges, faces, name, edit):
# A very simple "bridge" tool.
# A very simple "bridge" tool.
# Connects two equally long vertex rows with faces.
# Connects two equally long vertex rows with faces.
# Returns a list of the new faces (list of lists)
# Returns a list of the new faces (list of
lists)
#
#
# vertIdx1 ... First vertex list (list of vertex indices).
# vertIdx1 ... First vertex list (list of vertex indices).
# vertIdx2 ... Second vertex list (list of vertex indices).
# vertIdx2 ... Second vertex list (list of vertex indices).
# closed ... Creates a loop (first & last are closed).
# closed ... Creates a loop (first & last are closed).
# flipped ... Invert the normal of the face(s).
# flipped ... Invert the normal of the face(s).
#
# Note: You can set vertIdx1 to a single vertex index to create
# a fan/star of faces.
# Note: If both vertex idx list are the same length they have
# to have at least 2 vertices.
def
createFaces
(
vertIdx1
,
vertIdx2
,
closed
=
False
,
flipped
=
False
):
def
createFaces
(
vertIdx1
,
vertIdx2
,
closed
=
False
,
flipped
=
False
):
faces
=
[]
faces
=
[]
if
(
len
(
vertIdx1
)
!=
len
(
vertIdx2
))
or
(
len
(
vertIdx1
)
<
2
):
if
not
vertIdx1
or
not
vertIdx2
:
return
None
if
len
(
vertIdx1
)
<
2
and
len
(
vertIdx2
)
<
2
:
return
None
return
None
total
=
len
(
vertIdx1
)
fan
=
False
if
(
len
(
vertIdx1
)
!=
len
(
vertIdx2
)):
if
(
len
(
vertIdx1
)
==
1
and
len
(
vertIdx2
)
>
1
):
fan
=
True
else
:
return
None
total
=
len
(
vertIdx2
)
if
closed
:
if
closed
:
# Bridge the start with the end.
# Bridge the start with the end.
if
flipped
:
if
flipped
:
faces
.
append
([
vertIdx1
[
0
],
vertIdx2
[
0
],
face
=
[
vertIdx2
[
total
-
1
],
vertIdx1
[
total
-
1
]])
vertIdx1
[
0
],
vertIdx2
[
0
],
vertIdx2
[
total
-
1
]]
if
not
fan
:
face
.
append
(
vertIdx1
[
total
-
1
])
faces
.
append
(
face
)
else
:
else
:
faces
.
append
([
vertIdx2
[
0
],
vertIdx1
[
0
],
face
=
[
vertIdx2
[
0
],
vertIdx1
[
0
]]
vertIdx1
[
total
-
1
],
vertIdx2
[
total
-
1
]])
if
not
fan
:
face
.
append
(
vertIdx1
[
total
-
1
])
face
.
append
(
vertIdx2
[
total
-
1
])
faces
.
append
(
face
)
# Bridge the rest of the faces.
# Bridge the rest of the faces.
for
num
in
range
(
total
-
1
):
for
num
in
range
(
total
-
1
):
if
flipped
:
if
flipped
:
faces
.
append
([
vertIdx2
[
num
],
vertIdx1
[
num
],
if
fan
:
vertIdx1
[
num
+
1
],
vertIdx2
[
num
+
1
]])
face
=
[
vertIdx2
[
num
],
vertIdx1
[
0
],
vertIdx2
[
num
+
1
]]
else
:
face
=
[
vertIdx2
[
num
],
vertIdx1
[
num
],
vertIdx1
[
num
+
1
],
vertIdx2
[
num
+
1
]]
faces
.
append
(
face
)
else
:
else
:
faces
.
append
([
vertIdx1
[
num
],
vertIdx2
[
num
],
if
fan
:
vertIdx2
[
num
+
1
],
vertIdx1
[
num
+
1
]])
face
=
[
vertIdx1
[
0
],
vertIdx2
[
num
],
vertIdx2
[
num
+
1
]]
else
:
face
=
[
vertIdx1
[
num
],
vertIdx2
[
num
],
vertIdx2
[
num
+
1
],
vertIdx1
[
num
+
1
]]
faces
.
append
(
face
)
return
faces
return
faces
...
...
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