[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2781] contrib/py/scripts/addons/ geodesic_domes: SVN maintenance.
gsr b3d
gsr.b3d at infernal-iceberg.com
Thu Dec 15 21:26:27 CET 2011
Revision: 2781
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2781
Author: gsrb3d
Date: 2011-12-15 20:26:13 +0000 (Thu, 15 Dec 2011)
Log Message:
-----------
SVN maintenance.
Modified Paths:
--------------
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/vefm_259.py
Property Changed:
----------------
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/vefm_259.py
Property changes on: contrib/py/scripts/addons/geodesic_domes/__init__.py
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: contrib/py/scripts/addons/geodesic_domes/add_shape_geodesic.py
===================================================================
--- contrib/py/scripts/addons/geodesic_domes/add_shape_geodesic.py 2011-12-15 09:44:14 UTC (rev 2780)
+++ contrib/py/scripts/addons/geodesic_domes/add_shape_geodesic.py 2011-12-15 20:26:13 UTC (rev 2781)
@@ -1,100 +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()
+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()
Property changes on: contrib/py/scripts/addons/geodesic_domes/add_shape_geodesic.py
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: contrib/py/scripts/addons/geodesic_domes/forms_259.py
===================================================================
--- contrib/py/scripts/addons/geodesic_domes/forms_259.py 2011-12-15 09:44:14 UTC (rev 2780)
+++ contrib/py/scripts/addons/geodesic_domes/forms_259.py 2011-12-15 20:26:13 UTC (rev 2781)
@@ -1,222 +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]:
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list