[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2780] contrib/py/scripts/addons/ geodesic_domes: moving geodesic_domes from branches/geodesic_domes/ geodesic_domes
Brendon Murphy
meta.androcto1 at gmail.com
Thu Dec 15 10:44:15 CET 2011
Revision: 2780
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2780
Author: meta-androcto
Date: 2011-12-15 09:44:14 +0000 (Thu, 15 Dec 2011)
Log Message:
-----------
moving geodesic_domes from branches/geodesic_domes/geodesic_domes
to contrib/py/scripts/addons/geodesic_domes.
congratulations to pkgh for the months of work put into this script.
Added Paths:
-----------
contrib/py/scripts/addons/geodesic_domes/
contrib/py/scripts/addons/geodesic_domes/__init__.py
contrib/py/scripts/addons/geodesic_domes/add_shape_geodesic.py
contrib/py/scripts/addons/geodesic_domes/forms_259.py
contrib/py/scripts/addons/geodesic_domes/geodesic_classes_259.py
contrib/py/scripts/addons/geodesic_domes/read_me.txt
contrib/py/scripts/addons/geodesic_domes/third_domes_panel.py
contrib/py/scripts/addons/geodesic_domes/tmp/
contrib/py/scripts/addons/geodesic_domes/tmp/GD_0.GD
contrib/py/scripts/addons/geodesic_domes/tmp/GD_start.GD
contrib/py/scripts/addons/geodesic_domes/vefm_259.py
Removed Paths:
-------------
branches/geodesic_domes/geodesic_domes/
Added: contrib/py/scripts/addons/geodesic_domes/__init__.py
===================================================================
--- contrib/py/scripts/addons/geodesic_domes/__init__.py (rev 0)
+++ contrib/py/scripts/addons/geodesic_domes/__init__.py 2011-12-15 09:44:14 UTC (rev 2780)
@@ -0,0 +1,55 @@
+# ##### 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": "Geodesic Domes",
+ "author": "PKHG , Meta Androcto, original for 2.49 from Andy Houston",
+ "version": (0,2,1),
+ "blender": (2, 6, 0),
+ "api": 41431,
+ "location": "View3D > UI > Geodesic...",
+ "description": "Choice for objects",
+ "warning": "not yet finished",
+ "wiki_url": "http://wiki.blender.org/index.php?title=Extensions:2.5/Py/Scripts/Modeling/Geodesic_Domes",
+ "tracker_url": "",
+ "category": "Mesh"}
+
+"""
+Rev 0.5 building gui
+"""
+if "bpy" in locals():
+ import imp
+ imp.reload(third_domes_panel)
+
+else:
+ from geodesic_domes import third_domes_panel
+
+import bpy
+from bpy.props import *
+
+def register():
+ bpy.utils.register_module(__name__)
+
+def unregister():
+ bpy.utils.unregister_module(__name__)
+
+if __name__ == "__main__":
+ register()
+
+
+
Added: contrib/py/scripts/addons/geodesic_domes/add_shape_geodesic.py
===================================================================
--- contrib/py/scripts/addons/geodesic_domes/add_shape_geodesic.py (rev 0)
+++ contrib/py/scripts/addons/geodesic_domes/add_shape_geodesic.py 2011-12-15 09:44:14 UTC (rev 2780)
@@ -0,0 +1,100 @@
+import bpy
+import mathutils
+
+def reset_transform(ob):
+ m = mathutils.Matrix()
+ ob.matrix_local = m
+
+def func_add_corrective_pose_shape_fast(source, target):
+ result = ""
+ reset_transform(target)
+ # If target object doesn't have Basis shape key, create it.
+ try:
+ num_keys = len( target.data.shape_keys.key_blocks )
+ except:
+ basis = target.shape_key_add()
+ basis.name = "Basis"
+ target.data.update()
+ key_index = target.active_shape_key_index
+ if key_index == 0:
+ # Insert new shape key
+ new_shapekey = target.shape_key_add()
+ new_shapekey.name = "Shape_" + source.name
+ new_shapekey_name = new_shapekey.name
+ key_index = len(target.data.shape_keys.key_blocks)-1
+ target.active_shape_key_index = key_index
+ # else, the active shape will be used (updated)
+ target.show_only_shape_key = True
+ shape_key_verts = target.data.shape_keys.key_blocks[ key_index ].data
+ try:
+ vgroup = target.active_shape_key.vertex_group
+ target.active_shape_key.vertex_group = ''
+ except:
+ print("blub")
+ result = "***ERROR*** blub"
+ pass
+ # copy the local vertex positions to the new shape
+ verts = source.data.vertices
+ try:
+ for n in range( len(verts)):
+ shape_key_verts[n].co = verts[n].co
+ # go to all armature modifies and unpose the shape
+ except:
+ message = "***ERROR***, meshes have different number of vertices"
+ result = message
+ for n in target.modifiers:
+ if n.type == 'ARMATURE' and n.show_viewport:
+ #~ print("got one")
+ n.use_bone_envelopes = False
+ n.use_deform_preserve_volume = False
+ n.use_vertex_groups = True
+ armature = n.object
+ unposeMesh( shape_key_verts, target, armature)
+ break
+
+ # set the new shape key value to 1.0, so we see the result instantly
+ target.data.shape_keys.key_blocks[ target.active_shape_key_index].value = 1.0
+ try:
+ target.active_shape_key.vertex_group = vgroup
+ except:
+ print("bluba")
+ result = result + "bluba"
+ pass
+ target.show_only_shape_key = False
+ target.data.update()
+ return result
+
+class add_corrective_pose_shape_fast(bpy.types.Operator):
+ '''Adds 1st object as shape to 2nd object as pose shape (only 1 armature)'''
+ bl_idname = "object.add_corrective_pose_shape_fast"
+ bl_label = "Add object as corrective shape faster"
+
+ @classmethod
+ def poll(cls, context):
+ return context.active_object != None
+
+ def execute(self, context):
+
+ if len(context.selected_objects) > 2:
+ print("Select source and target objects please")
+ return {'FINISHED'}
+
+ selection = context.selected_objects
+ target = context.active_object
+ if context.active_object == selection[0]:
+ source = selection[1]
+ else:
+ source = selection[0]
+ print(source)
+ print(target)
+ func_add_corrective_pose_shape_fast( source, target)
+ return {'FINISHED'}
+
+def register():
+ bpy.utils.register_module(__name__)
+
+def unregister():
+ bpy.utils.unregister_module(__name__)
+
+if __name__ == "__main__":
+ register()
Added: contrib/py/scripts/addons/geodesic_domes/forms_259.py
===================================================================
--- contrib/py/scripts/addons/geodesic_domes/forms_259.py (rev 0)
+++ contrib/py/scripts/addons/geodesic_domes/forms_259.py 2011-12-15 09:44:14 UTC (rev 2780)
@@ -0,0 +1,222 @@
+import math
+from math import pi,sin,cos,atan,tan,fabs
+from geodesic_domes.vefm_259 import *
+class form(mesh):
+ def __init__(self,uresolution,vresolution,uscale,vscale,upart,vpart,uphase,vphase,utwist,vtwist,xscale,yscale,sform):
+ mesh.__init__(self)
+ #PKHG alredey in vefm259 mesh: self.a360 = pi * 2.0
+ self.PKHG_parameters = [uresolution,vresolution,uscale,vscale,upart,vpart,uphase,vphase,utwist,vtwist,xscale,yscale,sform]
+ self.ures = uresolution
+ self.vres = vresolution
+
+ self.uscale = uscale
+ self.vscale = vscale
+ self.upart = upart
+ self.vpart = vpart
+ self.uphase = uphase * self.a360
+ self.vphase = vphase * self.a360
+ self.utwist = utwist
+ self.vtwist = vtwist
+
+ self.xscale = xscale
+ self.yscale = yscale
+ self.sform = sform
+
+ if self.upart != 1.0: ## there is a gap in the major radius
+ self.uflag = 1
+ else:
+ self.uflag = 0
+ if self.vpart != 1.0: ## there is a gap in the minor radius
+ self.vflag = 1
+ else:
+ self.vflag = 0
+ if self.uflag:
+ self.ufinish = self.ures + 1
+ else:
+ self.ufinish = self.ures
+ if self.vflag:
+ self.vfinish = self.vres + 1
+ else:
+ self.vfinish = self.vres
+ self.ustep = (self.a360 / self.ures) * self.upart
+ self.vstep = (self.a360 / self.vres) * self.vpart
+ if self.xscale != 1.0:
+ self.xscaleflag = 1
+ else:
+ self.xscaleflag = 0
+ if self.yscale != 1.0:
+ self.yscaleflag = 1
+ else:
+ self.yscaleflag = 0
+ self.rowlist=[]
+
+ def generatepoints(self):
+ for i in range(self.ufinish):
+ row=[]
+ for j in range(self.vfinish):
+ u = self.ustep * i + self.uphase
+ v = self.vstep * j + self.vphase
+ # if self.xscaleflag:
+ # u = self.ellipsecomp(self.xscale,u)
+ # if self.yscaleflag:
+ # v = self.ellipsecomp(self.yscale,v)
+ if self.sform[12]:
+ r1 = self.superform(self.sform[0],self.sform[1],self.sform[2],self.sform[3],self.sform[14] + u,self.sform[4],self.sform[5],self.sform[16] * v)
+ else:
+ r1 = 1.0
+ if self.sform[13]:
+ r2 = self.superform(self.sform[6],self.sform[7],self.sform[8],self.sform[9],self.sform[15] + v,self.sform[10],self.sform[11],self.sform[17] * v)
+ else:
+ r2 = 1.0
+ x,y,z = self.formula(u,v,r1,r2)
+ point = vertex((x,y,z))
+ row.append(point)
+ self.verts.append(point)
+ self.rowlist.append(row)
+ if self.vflag:
+ pass
+ else:
+ for i in range(len(self.rowlist)):
+ self.rowlist[i].append(self.rowlist[i][0])
+ if self.uflag:
+ pass
+ else:
+ self.rowlist.append(self.rowlist[0])
+
+# def formula(self,u,v,r1,r2):
+# pass
+
+ def generatefaces(self):
+ ufin = len(self.rowlist) - 1
+ vfin = len(self.rowlist[0]) - 1
+ for i in range(ufin):
+ for j in range(vfin):
+ top = i
+ bottom = i + 1
+ left = j
+ right = j + 1
+ a = self.rowlist[top][left]
+ b = self.rowlist[top][right]
+ c = self.rowlist[bottom][right]
+ d = self.rowlist[bottom][left]
+ face1 = face([a,b,c,d])
+ self.faces.append(face1)
+ edge1 = edge(a,b)
+ edge2 = edge(a,d)
+ self.edges.append(edge1)
+ self.edges.append(edge2)
+ if i + 1 == ufin:
+ edge3 = edge(d,c)
+ self.edges.append(edge3)
+ if j + 1 == vfin:
+ edge4 = edge(b,c)
+ self.edges.append(edge4)
+
+class grid(form):
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list