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
fec24fc6
Commit
fec24fc6
authored
13 years ago
by
Brendon Murphy
Browse files
Options
Downloads
Patches
Plain Diff
added add_mesh_pyramid.py to add_mesh_extra_objects script
thanks to cotejrp1
parent
db083ab1
No related branches found
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
add_mesh_extra_objects/__init__.py
+7
-5
7 additions, 5 deletions
add_mesh_extra_objects/__init__.py
add_mesh_extra_objects/add_mesh_pyramid.py
+143
-0
143 additions, 0 deletions
add_mesh_extra_objects/add_mesh_pyramid.py
with
150 additions
and
5 deletions
add_mesh_extra_objects/__init__.py
+
7
−
5
View file @
fec24fc6
...
@@ -15,14 +15,14 @@
...
@@ -15,14 +15,14 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
# ##### END GPL LICENSE BLOCK #####
# ##### END GPL LICENSE BLOCK #####
# Contributed to by Pontiac, Fourmadmen, varkenvarken, tuga3d, meta-androcto, metalliandy
#
# Contributed to by Pontiac, Fourmadmen, varkenvarken, tuga3d, meta-androcto, metalliandy
, dreampainter & cotejrp1
#
bl_info
=
{
bl_info
=
{
"
name
"
:
"
Extra Objects
"
,
"
name
"
:
"
Extra Objects
"
,
"
author
"
:
"
Multiple Authors
"
,
"
author
"
:
"
Multiple Authors
"
,
"
version
"
:
(
0
,
2
),
"
version
"
:
(
0
,
3
),
"
blender
"
:
(
2
,
5
,
9
),
"
blender
"
:
(
2
,
5
,
9
),
"
api
"
:
39933
,
"
api
"
:
40638
,
"
location
"
:
"
View3D > Add > Mesh > Extra Objects
"
,
"
location
"
:
"
View3D > Add > Mesh > Extra Objects
"
,
"
description
"
:
"
Adds More Object Types.
"
,
"
description
"
:
"
Adds More Object Types.
"
,
"
warning
"
:
""
,
"
warning
"
:
""
,
...
@@ -42,6 +42,7 @@ if "bpy" in locals():
...
@@ -42,6 +42,7 @@ if "bpy" in locals():
imp
.
reload
(
add_mesh_3d_function_surface
)
imp
.
reload
(
add_mesh_3d_function_surface
)
imp
.
reload
(
add_mesh_polysphere
)
imp
.
reload
(
add_mesh_polysphere
)
imp
.
reload
(
add_mesh_supertoroid
)
imp
.
reload
(
add_mesh_supertoroid
)
imp
.
reload
(
add_mesh_pyramid
)
else
:
else
:
from
.
import
add_mesh_extra_objects
from
.
import
add_mesh_extra_objects
from
.
import
add_mesh_twisted_torus
from
.
import
add_mesh_twisted_torus
...
@@ -50,7 +51,7 @@ else:
...
@@ -50,7 +51,7 @@ else:
from
.
import
add_mesh_3d_function_surface
from
.
import
add_mesh_3d_function_surface
from
.
import
add_mesh_polysphere
from
.
import
add_mesh_polysphere
from
.
import
add_mesh_supertoroid
from
.
import
add_mesh_supertoroid
from
.
import
add_mesh_pyramid
import
bpy
import
bpy
...
@@ -72,7 +73,8 @@ class INFO_MT_mesh_extras_add(bpy.types.Menu):
...
@@ -72,7 +73,8 @@ class INFO_MT_mesh_extras_add(bpy.types.Menu):
text
=
"
Polysphere
"
)
text
=
"
Polysphere
"
)
layout
.
operator
(
"
mesh.primitive_supertoroid_add
"
,
layout
.
operator
(
"
mesh.primitive_supertoroid_add
"
,
text
=
"
Supertoroid
"
)
text
=
"
Supertoroid
"
)
layout
.
operator
(
"
mesh.primative_step_pyramid_add
"
,
text
=
"
Pyramid
"
)
class
INFO_MT_mesh_gemstones_add
(
bpy
.
types
.
Menu
):
class
INFO_MT_mesh_gemstones_add
(
bpy
.
types
.
Menu
):
# Define the "Gemstones" menu
# Define the "Gemstones" menu
...
...
This diff is collapsed.
Click to expand it.
add_mesh_extra_objects/add_mesh_pyramid.py
0 → 100644
+
143
−
0
View file @
fec24fc6
# add_mesh_pyramid.py (c) 2011 Phil Cote (cotejrp1)
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENCE BLOCK *****
'''
bl_info = {
'
name
'
:
'
Mesh Pyramid
'
,
'
author
'
:
'
Phil Cote, cotejrp1, (http://www.blenderpythontutorials.com)
'
,
'
version
'
: (0,1),
"
blender
"
: (2, 5, 7),
"
api
"
: 35853,
'
location
'
:
'
View3D > Add > Mesh
'
,
'
description
'
:
'
Create an egyption-style step pyramid
'
,
'
warning
'
:
''
, # used for warning icon and text in addons panel
'
category
'
:
'
Add Mesh
'
}
'''
import
bpy
from
bpy.props
import
FloatVectorProperty
,
IntProperty
,
FloatProperty
from
add_utils
import
AddObjectHelper
,
add_object_data
from
mathutils
import
Vector
def
makePyramid
(
initialSize
,
stepHeight
,
stepWidth
,
numberSteps
):
vertList
=
[]
faceList
=
[]
curSize
=
initialSize
# how large each step will be overall
# b = buttom, t = top, f = front, b = back, l = left, r = right
x
=
y
=
z
=
0
voffset
=
0
# refers relative vert indices to help make faces fo each step
sn
=
0
# step number
while
sn
<
numberSteps
:
# bottom verts for this iteration
bfl
=
(
x
,
y
,
z
)
bfr
=
(
x
+
curSize
,
y
,
z
)
bbl
=
(
x
,
y
+
curSize
,
z
)
bbr
=
(
x
+
curSize
,
y
+
curSize
,
z
)
# top verts for this iteration.
tfl
=
(
x
,
y
,
z
+
stepHeight
)
tfr
=
(
x
+
curSize
,
y
,
z
+
stepHeight
)
tbl
=
(
x
,
y
+
curSize
,
z
+
stepHeight
)
tbr
=
(
x
+
curSize
,
y
+
curSize
,
z
+
stepHeight
)
# add to the vert buffer
vertList
.
extend
(
(
bfl
,
bfr
,
bbl
,
bbr
,
tfl
,
tfr
,
tbl
,
tbr
,
)
)
# side faces
faceList
.
extend
(
(
(
voffset
+
4
,
voffset
+
5
,
voffset
+
1
,
voffset
+
0
),
)
)
# front
faceList
.
extend
(
(
(
voffset
+
6
,
voffset
+
7
,
voffset
+
3
,
voffset
+
2
),
)
)
# back
faceList
.
extend
(
(
(
voffset
+
2
,
voffset
+
6
,
voffset
+
4
,
voffset
+
0
),
)
)
# left
faceList
.
extend
(
(
(
voffset
+
3
,
voffset
+
7
,
voffset
+
5
,
voffset
+
1
),
)
)
# right
# horizontal connecting faces ( note: not applicable for the first iteration ).
if
voffset
>
0
:
faceList
.
extend
(
(
(
voffset
-
4
,
voffset
-
3
,
voffset
+
1
,
voffset
+
0
),
)
)
# connector front
faceList
.
extend
(
(
(
voffset
-
2
,
voffset
-
1
,
voffset
+
3
,
voffset
+
2
),
)
)
# back
faceList
.
extend
(
(
(
voffset
-
4
,
voffset
-
2
,
voffset
+
2
,
voffset
+
0
),
)
)
# left
faceList
.
extend
(
(
(
voffset
-
3
,
voffset
-
1
,
voffset
+
3
,
voffset
+
1
),
)
)
# right
# set up parameters for the next iteration
curSize
=
curSize
-
(
stepWidth
*
2
)
x
=
x
+
stepWidth
y
=
y
+
stepWidth
z
=
z
+
stepHeight
sn
=
sn
+
1
voffset
=
voffset
+
8
# cap the top.
voffset
=
voffset
-
8
# corrects for the unnecessary voffset change done final iteration
faceList
.
extend
(
(
(
voffset
+
6
,
voffset
+
7
,
voffset
+
5
,
voffset
+
4
),
)
)
# cap the bottom.
faceList
.
extend
(
(
(
2
,
3
,
1
,
0
),
)
)
return
vertList
,
faceList
def
add_pyramid_object
(
self
,
context
):
verts
,
faces
=
makePyramid
(
self
.
initialSize
,
self
.
stepHeight
,
self
.
stepWidth
,
self
.
numberSteps
)
mesh_data
=
bpy
.
data
.
meshes
.
new
(
name
=
"
Pyramid
"
)
mesh_data
.
from_pydata
(
verts
,
[],
faces
)
mesh_data
.
update
()
res
=
add_object_data
(
context
,
mesh_data
,
operator
=
self
)
class
OBJECT_OT_add_pyramid
(
bpy
.
types
.
Operator
,
AddObjectHelper
):
"""
Add a Mesh Object
"""
bl_idname
=
"
mesh.primative_step_pyramid_add
"
bl_label
=
"
Pyramid
"
bl_description
=
"
Create a Pyramid Mesh
"
bl_options
=
{
'
REGISTER
'
,
'
UNDO
'
}
initialSize
=
FloatProperty
(
name
=
"
Initial Size
"
,
default
=
2.0
,
min
=
0.0
,
max
=
20.0
)
stepHeight
=
FloatProperty
(
name
=
"
Step Height
"
,
default
=
0.2
,
min
=
0.0
,
max
=
10.0
)
stepWidth
=
FloatProperty
(
name
=
"
Step Width
"
,
default
=
0.2
,
min
=
0.0
,
max
=
10.0
)
numberSteps
=
IntProperty
(
name
=
"
Number Steps
"
,
default
=
5
,
min
=
1
,
max
=
20
)
def
execute
(
self
,
context
):
add_pyramid_object
(
self
,
context
)
return
{
'
FINISHED
'
}
'''
def menu_func(self, context):
self.layout.operator(OBJECT_OT_add_pyramid.bl_idname, text=
"
Pyramid
"
, icon=
"
MESH_CUBE
"
)
def register():
bpy.utils.register_class(OBJECT_OT_add_pyramid)
bpy.types.INFO_MT_mesh_add.append(menu_func)
def unregister():
bpy.utils.unregister_class(OBJECT_OT_add_pyramid)
bpy.types.INFO_MT_mesh_add.remove(menu_func)
if __name__ ==
"
__main__
"
:
register()
'''
\ No newline at end of file
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