[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3355] tags/2_63a_release/py/scripts/ addons: blender 2.63a: merging r3315 through r3354 from trunk into 2. 63a addons tag
Sergey Sharybin
sergey.vfx at gmail.com
Wed May 9 13:08:19 CEST 2012
Revision: 3355
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3355
Author: nazgul
Date: 2012-05-09 11:08:19 +0000 (Wed, 09 May 2012)
Log Message:
-----------
blender 2.63a: merging r3315 through r3354 from trunk into 2.63a addons tag
Revision Links:
--------------
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3315
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3354
Modified Paths:
--------------
tags/2_63a_release/py/scripts/addons/add_mesh_extra_objects/__init__.py
tags/2_63a_release/py/scripts/addons/add_mesh_extra_objects/add_mesh_pyramid.py
tags/2_63a_release/py/scripts/addons/animation_add_corrective_shape_key.py
tags/2_63a_release/py/scripts/addons/io_convert_image_to_mesh_img/__init__.py
tags/2_63a_release/py/scripts/addons/io_convert_image_to_mesh_img/import_img.py
tags/2_63a_release/py/scripts/addons/io_export_directx_x.py
tags/2_63a_release/py/scripts/addons/io_export_unreal_psk_psa.py
tags/2_63a_release/py/scripts/addons/io_import_scene_mhx.py
tags/2_63a_release/py/scripts/addons/io_scene_fbx/export_fbx.py
tags/2_63a_release/py/scripts/addons/io_scene_map/export_map.py
tags/2_63a_release/py/scripts/addons/render_renderfarmfi.py
tags/2_63a_release/py/scripts/addons/texture_paint_layer_manager.py
Added Paths:
-----------
tags/2_63a_release/py/scripts/addons/add_mesh_extra_objects/add_mesh_honeycomb.py
tags/2_63a_release/py/scripts/addons/add_mesh_extra_objects/add_mesh_teapot.py
tags/2_63a_release/py/scripts/addons/add_mesh_extra_objects/add_mesh_torusknot.py
Property Changed:
----------------
tags/2_63a_release/py/scripts/addons/
Property changes on: tags/2_63a_release/py/scripts/addons
___________________________________________________________________
Added: svn:mergeinfo
+ /trunk/py/scripts/addons:3315-3354
Modified: tags/2_63a_release/py/scripts/addons/add_mesh_extra_objects/__init__.py
===================================================================
--- tags/2_63a_release/py/scripts/addons/add_mesh_extra_objects/__init__.py 2012-05-08 18:07:26 UTC (rev 3354)
+++ tags/2_63a_release/py/scripts/addons/add_mesh_extra_objects/__init__.py 2012-05-09 11:08:19 UTC (rev 3355)
@@ -43,6 +43,9 @@
imp.reload(add_mesh_polysphere)
imp.reload(add_mesh_supertoroid)
imp.reload(add_mesh_pyramid)
+ imp.reload(add_mesh_torusknot)
+ imp.reload(add_mesh_honeycomb)
+ imp.reload(add_mesh_teapot)
else:
from . import add_mesh_extra_objects
from . import add_mesh_twisted_torus
@@ -52,6 +55,9 @@
from . import add_mesh_polysphere
from . import add_mesh_supertoroid
from . import add_mesh_pyramid
+ from . import add_mesh_torusknot
+ from . import add_mesh_honeycomb
+ from . import add_mesh_teapot
import bpy
@@ -67,14 +73,8 @@
layout.menu("INFO_MT_mesh_gears_add", text="Gears")
layout.menu("INFO_MT_mesh_math_add", text="Math Function")
layout.menu("INFO_MT_mesh_basic_add", text="Basic Objects")
- layout.operator("mesh.primitive_twisted_torus_add",
- text="Twisted Torus")
- layout.operator("mesh.primitive_polysphere_add",
- text="Polysphere")
- layout.operator("mesh.primitive_supertoroid_add",
- text="Supertoroid")
- layout.operator("mesh.primitive_steppyramid_add",
- text="Pyramid")
+ layout.menu("INFO_MT_mesh_torus_add", text="Torus Objects")
+ layout.menu("INFO_MT_mesh_misc_add", text="Misc Objects")
class INFO_MT_mesh_gemstones_add(bpy.types.Menu):
# Define the "Gemstones" menu
@@ -131,7 +131,38 @@
text="Star")
layout.operator("mesh.primitive_trapezohedron_add",
text="Trapezohedron")
+ layout.operator("mesh.primitive_polysphere_add",
+ text="Polysphere")
+
+class INFO_MT_mesh_torus_add(bpy.types.Menu):
+ # Define the "Simple Objects" menu
+ bl_idname = "INFO_MT_mesh_torus_add"
+ bl_label = "Torus Objects"
+ def draw(self, context):
+ layout = self.layout
+ layout.operator_context = 'INVOKE_REGION_WIN'
+ layout.operator("mesh.primitive_twisted_torus_add",
+ text="Twisted Torus")
+ layout.operator("mesh.primitive_supertoroid_add",
+ text="Supertoroid")
+ layout.operator("mesh.primitive_torusknot_add",
+ text="Torus Knot")
+
+class INFO_MT_mesh_misc_add(bpy.types.Menu):
+ # Define the "Simple Objects" menu
+ bl_idname = "INFO_MT_mesh_misc_add"
+ bl_label = "Misc Objects"
+
+ def draw(self, context):
+ layout = self.layout
+ layout.operator_context = 'INVOKE_REGION_WIN'
+ layout.operator("mesh.primitive_steppyramid_add",
+ text="Step Pyramid")
+ layout.operator("mesh.honeycomb_add",
+ text="Honeycomb")
+ layout.operator("mesh.primitive_teapot_add",
+ text="Teapot+")
# Register all operators and panels
# Define "Extras" menu
Copied: tags/2_63a_release/py/scripts/addons/add_mesh_extra_objects/add_mesh_honeycomb.py (from rev 3354, trunk/py/scripts/addons/add_mesh_extra_objects/add_mesh_honeycomb.py)
===================================================================
--- tags/2_63a_release/py/scripts/addons/add_mesh_extra_objects/add_mesh_honeycomb.py (rev 0)
+++ tags/2_63a_release/py/scripts/addons/add_mesh_extra_objects/add_mesh_honeycomb.py 2012-05-09 11:08:19 UTC (rev 3355)
@@ -0,0 +1,284 @@
+'''# ##### 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 LICENSE BLOCK #####
+
+bl_info = {
+ "name": "HoneyComb",
+ "author": "Kayo Phoenix <kayo at illumium.org>",
+ "version": (0, 1),
+ "blender": (2, 5, 7),
+ "api": 35853,
+ "location": "View3D > Add > Mesh > HoneyComb",
+ "description": "Adds HoneyComb Mesh",
+ "warning": "",
+ "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/Scripts/Add_Mesh/HoneyComb",
+ "category": "Add Mesh"
+ }
+'''
+from math import pi, sin, cos
+
+class honeycomb_geometry():
+ def __init__(self, rows, cols, D, E):
+ self.rows = rows
+ self.cols = cols
+ self.D = D
+ self.E = E
+
+ self.hE = 0.5 * self.E
+ self.R = 0.5 * self.D
+
+ self.a = sin(pi / 3)
+
+ self.d = self.a * self.D
+ self.hd = 0.5 * self.d
+ self.e = self.hE / self.a
+ self.he = 0.5 * self.e
+ self.r = self.R - self.e
+ self.hr = 0.5 * self.r
+
+
+ self.H = self.R * (1.5 * self.rows + 0.5) + self.e
+ if self.rows > 1:
+ self.W = self.d * (self.cols + 0.5) + self.E
+ else:
+ self.W = self.d * self.cols + self.E
+
+ self.hH = 0.5 * self.H
+ self.hW = 0.5 * self.W
+
+ self.sy = -self.hH + self.he + self.R
+ self.sx = -self.hW + self.hE + self.hd
+
+ self.gx = self.hd
+
+ self.dy = 1.5 * self.R
+ self.dx = self.d
+
+ def vert(self, row, col):
+ # full cell
+ if row >= 0 and row < self.rows and col >= 0 and col < self.cols: return [0, 1, 2, 3, 4, 5]
+ # right down corner
+ if row == -1 and col == self.cols - 1: return [1, 2]
+ if row == 0 and self.rows > 1 and col == self.cols: return [1, 2, 3]
+ # left down corner
+ if row == -1 and col == -1: return [0, 1]
+ if self.rows % 2:
+ # left up corner
+ if row == self.rows and col == -1: return [4, 5]
+ # right up corner
+ if row == self.rows and col == self.cols - 1: return [3, 4]
+ if row == self.rows - 1 and self.rows > 1 and col == self.cols: return [2, 3, 4]
+ else:
+ # left up corner
+ if row == self.rows and col == 0: return [4, 5]
+ if row == self.rows - 1 and self.rows > 1 and col == -1: return [0, 4, 5]
+ # right up corner
+ if row == self.rows and col == self.cols: return [3, 4]
+ # horizontal lines
+ if col >= 0 and col < self.cols:
+ if row == -1: return [0, 1, 2]
+ if row == self.rows: return [3, 4, 5]
+ # vertical lines
+ if row >= 0 and row < self.rows:
+ if col == -1:
+ if row % 2: return [0, 1, 4, 5]
+ else: return [0, 5]
+ if col == self.cols:
+ if row % 2 or self.rows == 1: return [2, 3]
+ else: return [1, 2, 3, 4]
+ return []
+
+ def cell(self, row, col, idx):
+ cp = [self.sx + self.dx * col, self.sy + self.dy * row, 0] # central point
+ if row % 2: cp[0] += self.gx
+ co = [] # vertexes coords
+ vi = self.vert(row, col)
+ ap = {}
+
+ for i in vi:
+ a = pi / 6 + i * pi / 3 # angle
+ ap[i] = idx + len(co)
+ co.append((cp[0] + cos(a) * self.r, cp[1] + sin(a) * self.r, cp[2]))
+ return co, ap
+
+ def generate(self):
+ ar = 1
+ ac = 1
+
+ cells = []
+ verts = []
+ faces = []
+
+ for row in range(-ar, self.rows + ar):
+ level = []
+ for col in range(-ac, self.cols + ac):
+ co, ap = self.cell(row, col, len(verts))
+ verts += co
+ level.append(ap)
+ cells.append(level)
+
+ # bottom row
+ row = 0
+ for col in range(1, len(cells[row]) - 1):
+ s = cells[row][col]
+ l = cells[row][col - 1]
+ u = cells[row + 1][col]
+
+ faces.append((s[1], u[5], u[4], s[2]))
+ faces.append((s[2], u[4], l[0]))
+
+ # top row
+ row = len(cells) - 1
+ cs = 0
+ if row % 2: cs += 1
+ for col in range(1 + cs, len(cells[row]) - 1):
+ s = cells[row][col]
+ l = cells[row][col - 1]
+ d = cells[row - 1][col - cs]
+ faces.append((s[3], l[5], d[1]))
+ faces.append([s[3], d[1], d[0], s[4]])
+
+ # middle rows
+ for row in range(1, len(cells) - 1):
+ cs = 0
+ if row % 2: cs += 1
+ for col in range(1, len(cells[row]) - 1):
+ s = cells[row][col]
+ l = cells[row][col - 1]
+ u = cells[row + 1][col - cs]
+ d = cells[row - 1][col - cs]
+
+ faces.append((s[1], u[5], u[4], s[2]))
+ faces.append((s[2], u[4], l[0]))
+ faces.append([s[2], l[0], l[5], s[3]])
+ faces.append((s[3], l[5], d[1]))
+ faces.append([s[3], d[1], d[0], s[4]])
+
+ # right column
+ row = 0
+ col = len(cells[row]) - 1
+ for row in range(1, len(cells) - 1):
+ cs = 0
+ if row % 2: cs += 1
+
+ s = cells[row][col]
+ l = cells[row][col - 1]
+ u = cells[row + 1][col - cs]
+ d = cells[row - 1][col - cs]
+
+ if row % 2 and row < len(cells) - 2:
+ faces.append((s[1], u[5], u[4], s[2]))
+ faces.append((s[2], u[4], l[0]))
+ faces.append([s[2], l[0], l[5], s[3]])
+ faces.append((s[3], l[5], d[1]))
+ if row % 2 and row > 1:
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list