Paste Code
Paste Blends
Paste Images
# First import bpy to get access to well... everything in blender
import bpy
import math, mathutils, random
# Set Up Parameters --------------------------------------->
bMainLevel = 3
bStepAngle = 30
bModLevel = 3.0
bModRate = 10.0

pMainLevel = 0.3
pStepAngle = 1.0
pModLevel = 1.0
pModRate = 5.0
# Set Up Parameter(END) -----------------------------------<

# Extrude One Step ---------------------------------------->
def transStep(dA, sA, rA, axis_x, axis_y, axis_z):
bpy.ops.transform.shrink_fatten(value=dA, mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), release_confirm=False)
bpy.ops.transform.resize(value=(sA, sA, sA), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=0.0762767, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)

# Get the mesh
me = ob.data
# Loop through the faces to find the center
for f in me.faces:
if f.select == True:
center = f.center
if center[0] > 0.0:
rotDir = 1.0
else:
rotDir = -1.0

bpy.ops.transform.rotate(value=(rA*rotDir,), axis=(axis_x, axis_y, axis_z), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=0.0762767, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), release_confirm=False)

# TransformFaces(Multi Step) ------------------------------------------------------->
def transformFaces(vGroup, mainLevel, stepNum, stepDist, stepRot, startAngle, stepAngle, modLevel, modRate, axis):
# Make sure nothing is selected
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='DESELECT')

# Select the vertex group
selPart(vGroup)

# Go into object mode so that we are sure we have the current list of faces
bpy.ops.object.mode_set(mode='OBJECT')

# Make a nice list to keep the vertex groups in
groupList = []

# Now loop through all the faces
for i, f in enumerate(ob.data.faces):

# If this face is selected~
if ob.data.faces[i].select == True:

# Create a new vertex group!
newGroup = ob.vertex_groups.new('mygroup')
groupList.append(newGroup)

# Get all the vertices in the current face and add them to the new group
for v in f.vertices:
newGroup.add([v], 1.0, 'REPLACE')

# Now we loop through the groups and do what we want.
for g in groupList:

# Make sure nothing is selected
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='DESELECT')

# Make the group in our list the active one
ob.vertex_groups.active_index = g.index

# Select all the verts in the active group
bpy.ops.object.vertex_group_select()

bpy.ops.object.vertex_group_remove(all=False)

# AND NOW WE CAN DO OUR STUFF... little test example follows
t = startAngle
oldRatio = 1.0
# Shape
for i in range(stepNum):

bpy.ops.mesh.extrude(type='REGION')

# An added trick... remove the extruded face from all vertex groups after the first extrusion (i == 0)
# This way it can't get extruded again
# Because the edge of the first face can be part of multiple groups
if not i:
bpy.ops.object.vertex_group_remove_from(all=True)

bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.mode_set(mode='EDIT')

newRatio = mainLevel*(math.sin(math.radians(t)+modLevel*math.sin(math.radians(t+modRate)))+2.0)/oldRatio
dA = stepDist
sA = newRatio
rA = math.sin(math.radians(t*2))*stepRot
axis_x = axis[0]
axis_y = axis[1]
axis_z = axis[2]
transStep(dA, sA, rA, axis_x, axis_y, axis_z)
t = t + stepAngle
oldRatio = oldRatio*newRatio

# transformFaces!(END) --------------------------------------------------<

# bodyShape ------------------------------------------------------>
def bodyShape(vGroup, mainLevel, stepNum, stepDist, stepRot, startAngle, stepAngle, modLevel, modRate, axis):
newGroup = ob.vertex_groups.new(vGroup)
bpy.ops.object.mode_set(mode='OBJECT')

# Lets loop through all the faces in the mesh
for f in ob.data.faces:

# See if the current face's centre is above 0.0 on the Z axis
if f.center[1] > -0.1:
# Set select to true
f.select = True
else:
f.select = False

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.object.vertex_group_set_active(group=vGroup)
bpy.ops.object.vertex_group_assign(new=False)

transformFaces(vGroup, mainLevel, stepNum, stepDist, stepRot, startAngle, stepAngle, modLevel, modRate, axis)
bpy.ops.mesh.select_all(action='DESELECT')
# bodyShape(END) ---------------------------------------------------<

# select faces from Groups --------------------------------------------->
def selPart(vGroup):
bpy.ops.object.vertex_group_set_active(group=vGroup)
bpy.ops.object.vertex_group_select()
bpy.ops.object.vertex_group_remove(all=False)
# select faces from Groups (END)----------------------------------------<

# cell subdivide --------------------------------------------->
def cellSubdiv():
bpy.ops.object.modifier_add(type='SUBSURF')
bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Subsurf")
# cell subdivide (END)----------------------------------------<

# assignFaces ----------------------------------------------->
def assignFaces(vGroup, xMin, xMax, yMin, yMax, zMin, zMax):
newGroup = ob.vertex_groups.new(vGroup)
bpy.ops.object.mode_set(mode='OBJECT')

for f in ob.data.faces:

if f.center[0] > xMin and f.center[0] < xMax and f.center[1] > yMin and f.center[1] < yMax and f.center[2] > zMin and f.center[2] < zMax:
f.select = True
else:
f.select = False

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.object.vertex_group_set_active(group=vGroup)
bpy.ops.object.vertex_group_assign(new=False)
bpy.ops.mesh.select_all(action='DESELECT')
# assignFaces (END)------------------------------------------<

# assignFacesAngle--------------------------------------------->
def assignFacesAngle(vGroup, fAngleMin, fAngleMax, yMin, yMax):
newGroup = ob.vertex_groups.new(vGroup)
bpy.ops.object.mode_set(mode='OBJECT')

up = mathutils.Vector((0.0,0.0,1.0))

# Lets loop through all the faces in the mesh
for f in ob.data.faces:
# If the angle between up and the face's normal (direction) is smaller than 45...
# The face must be pointing up
# To compare the angle we need 45 degrees in radians, not in degrees!
# Math with angles is usually all in radians
if f.normal.angle(up) > math.radians(fAngleMin) and f.normal.angle(up) < math.radians(fAngleMax) and f.center[1] > yMin and f.center[1] < yMax :
# Set select to true
f.select = True
else:
f.select = False

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.object.vertex_group_set_active(group=vGroup)
bpy.ops.object.vertex_group_assign(new=False)
bpy.ops.mesh.select_all(action='DESELECT')
# assignFacesAngle(END)--------------------------------------<

# Generate Object ----------------------------------------->
for sRot in range(-10, 10, 2):
for sAngle in range(0, 180, 15):

# -- Set Up(START) ------------------------------------------>
bpy.ops.mesh.primitive_plane_add(view_align=False, enter_editmode=False, location=(sRot*3, sAngle-90, 0), rotation=(0, 0, 0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.transform.rotate(value=(-1.5708,), axis=(-1, -2.22045e-16, -4.93038e-32), constraint_axis=(False, False, False), constraint_orientation='LOCAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), release_confirm=False)
bpy.ops.transform.resize(value=(0.05, 1, 0.05), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=0.0762767, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
bpy.ops.object.mode_set(mode='OBJECT')

# Now we want to get the active object
# To do this we go through bpy.context... because that is basicly "what you are working on right now"
# bpy.data could work too, but then you'd need to do more work to find your current active object
ob = bpy.context.active_object

# A new trick... lets go into edit mode and deselect everything ('SELECT' works too)
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='DESELECT')

# Get the screen areas we are working in right now
areas = bpy.context.screen.areas

# Loop through all the areas
for area in areas:

# See if the current area is a 3D view
if area.type == 'VIEW_3D':

# Set the pivot point to individual origins
area.active_space.pivot_point = 'INDIVIDUAL_ORIGINS'

# -- Set Up(END) ------------------------------------------<


# bodyShape(vGroup, mainLevel, stepNum, stepDist, stepRot, startAngle, stepAngle, modLevel, modRate, axisArray)
bodyShape('body', bMainLevel, 12, -0.5, sRot/10, sAngle, bStepAngle, bModLevel, bModRate, [-1, -2.22045e-16, -0])
bpy.ops.object.mode_set(mode='OBJECT')

cellSubdiv()
# spine
#transformFaces(vGroup, mainLevel, stepNum, stepDist, stepRot, startAngle, stepAngle, modLevel, modRate, axis)
#assignFaces('spine', -5.0, 5.0, 2.5, 20.0, 0.0, 10.0)
#transformFaces('spine', 0.3, 10, -0.2, -0.5, sAngle, 10, 5, 20, [-2.22045e-16, -1, -0])
assignFacesAngle('arm', 0, 45, 2.5, 20.0)
assignFacesAngle('horn', 0, 45, 0.5, 1.5)
assignFacesAngle('leg', 135, 180, 2.0, 4.0)

transformFaces('arm', pMainLevel, 10, -0.2, sRot/10, sAngle, pStepAngle*6, pModLevel*5, pModRate*4, [-2.22045e-16, -1, -0])
transformFaces('horn', pMainLevel, 4, -0.1, sRot/10, sAngle, pStepAngle*8, pModLevel*5, pModRate*4, [-2.22045e-16, -1, -0])
transformFaces('leg', pMainLevel, 10, -0.2, sRot/10, sAngle, -pStepAngle*5, pModLevel*2, pModRate*2, [-2.22045e-16, -1, -0])

bpy.ops.object.modifier_add(type='SUBSURF')
bpy.ops.object.modifier_add(type='SUBSURF')
bpy.ops.object.mode_set(mode='OBJECT')

#fileName = '/Users/shige/Documents/BlenderPJ/GMP_model3/A_Life_'+str(sRot)+'_'+str(sAngle)
#fileName = '/Users/shige/Documents/BlenderPJ/GMP_model/A_Life_sRot_-10_10_2_sAngle_0_180_15)'

# Save the current file! (with a specific fileName)
#bpy.ops.wm.save_as_mainfile(filepath=fileName, check_existing=False, compress=True)

#bpy.ops.object.delete()
  1. # First import bpy to get access to well... everything in blender
  2. import bpy
  3. import math, mathutils, random
  4. # Set Up Parameters     --------------------------------------->
  5. bMainLevel = 3
  6. bStepAngle = 30
  7. bModLevel = 3.0
  8. bModRate =      10.0
  9.  
  10. pMainLevel = 0.3
  11. pStepAngle = 1.0
  12. pModLevel = 1.0
  13. pModRate = 5.0
  14. # Set Up Parameter(END) -----------------------------------<
  15.        
  16. # Extrude One Step ---------------------------------------->
  17. def transStep(dA, sA, rA, axis_x, axis_y, axis_z):
  18.         bpy.ops.transform.shrink_fatten(value=dA, mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), release_confirm=False)
  19.         bpy.ops.transform.resize(value=(sA, sA, sA), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=0.0762767, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  20.        
  21.         # Get the mesh
  22.         me = ob.data
  23.         # Loop through the faces to find the center
  24.         for f in me.faces:
  25.                 if f.select == True:
  26.                         center = f.center
  27.         if center[0] > 0.0:
  28.                 rotDir = 1.0
  29.         else:
  30.                 rotDir = -1.0
  31.        
  32.         bpy.ops.transform.rotate(value=(rA*rotDir,), axis=(axis_x, axis_y, axis_z), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=0.0762767, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), release_confirm=False)
  33.        
  34. # TransformFaces(Multi Step) ------------------------------------------------------->
  35. def transformFaces(vGroup, mainLevel, stepNum, stepDist, stepRot, startAngle, stepAngle, modLevel, modRate, axis):
  36.         # Make sure nothing is selected
  37.         bpy.ops.object.mode_set(mode='EDIT')
  38.         bpy.ops.mesh.select_all(action='DESELECT')
  39.        
  40.         # Select the vertex group
  41.         selPart(vGroup)
  42.        
  43.         # Go into object mode so that we are sure we have the current list of faces
  44.         bpy.ops.object.mode_set(mode='OBJECT')
  45.  
  46.         # Make a nice list to keep the vertex groups in
  47.         groupList = []
  48.  
  49.         # Now loop through all the faces
  50.         for i, f in enumerate(ob.data.faces):
  51.                
  52.                 # If this face is selected~
  53.                 if ob.data.faces[i].select == True:
  54.  
  55.                         # Create a new vertex group!
  56.                         newGroup = ob.vertex_groups.new('mygroup')
  57.                         groupList.append(newGroup)
  58.  
  59.                         # Get all the vertices in the current face and add them to the new group
  60.                         for v in f.vertices:
  61.                                 newGroup.add([v], 1.0, 'REPLACE')
  62.                        
  63.         # Now we loop through the groups and do what we want.
  64.         for g in groupList:
  65.  
  66.                 # Make sure nothing is selected
  67.                 bpy.ops.object.mode_set(mode='EDIT')
  68.                 bpy.ops.mesh.select_all(action='DESELECT')
  69.  
  70.                 # Make the group in our list the active one
  71.                 ob.vertex_groups.active_index = g.index
  72.  
  73.                 # Select all the verts in the active group
  74.                 bpy.ops.object.vertex_group_select()
  75.  
  76.                 bpy.ops.object.vertex_group_remove(all=False)
  77.  
  78.                 # AND NOW WE CAN DO OUR STUFF... little test example follows
  79.                 t = startAngle
  80.                 oldRatio = 1.0
  81.                 # Shape
  82.                 for i in range(stepNum):
  83.      
  84.                         bpy.ops.mesh.extrude(type='REGION')
  85.                        
  86.                         # An added trick... remove the extruded face from all vertex groups after the first extrusion (i == 0)
  87.                         # This way it can't get extruded again
  88.                         # Because the edge of the first face can be part of multiple groups
  89.                         if not i:
  90.                                 bpy.ops.object.vertex_group_remove_from(all=True)
  91.                        
  92.                         bpy.ops.object.mode_set(mode='OBJECT')
  93.                         bpy.ops.object.mode_set(mode='EDIT')
  94.                        
  95.                         newRatio = mainLevel*(math.sin(math.radians(t)+modLevel*math.sin(math.radians(t+modRate)))+2.0)/oldRatio
  96.                         dA = stepDist
  97.                         sA = newRatio
  98.                         rA = math.sin(math.radians(t*2))*stepRot
  99.                         axis_x = axis[0]
  100.                         axis_y = axis[1]
  101.                         axis_z = axis[2]
  102.                         transStep(dA, sA, rA, axis_x, axis_y, axis_z)
  103.                         t = t + stepAngle
  104.                         oldRatio = oldRatio*newRatio
  105.        
  106. # transformFaces!(END) --------------------------------------------------<
  107.  
  108. # bodyShape ------------------------------------------------------>
  109. def bodyShape(vGroup, mainLevel, stepNum, stepDist, stepRot, startAngle, stepAngle, modLevel, modRate, axis):
  110.         newGroup = ob.vertex_groups.new(vGroup)
  111.         bpy.ops.object.mode_set(mode='OBJECT')
  112.        
  113.         # Lets loop through all the faces in the mesh
  114.         for f in ob.data.faces:
  115.        
  116.                 # See if the current face's centre is above 0.0 on the Z axis
  117.                 if f.center[1] > -0.1:
  118.                         # Set select to true
  119.                         f.select = True
  120.                 else:
  121.                         f.select = False
  122.                
  123.         bpy.ops.object.mode_set(mode='EDIT')                   
  124.         bpy.ops.object.vertex_group_set_active(group=vGroup)
  125.         bpy.ops.object.vertex_group_assign(new=False)
  126.        
  127.         transformFaces(vGroup, mainLevel, stepNum, stepDist, stepRot, startAngle, stepAngle, modLevel, modRate, axis)
  128.         bpy.ops.mesh.select_all(action='DESELECT')
  129. # bodyShape(END) ---------------------------------------------------<
  130.  
  131. # select faces from Groups --------------------------------------------->
  132. def selPart(vGroup):
  133.         bpy.ops.object.vertex_group_set_active(group=vGroup)
  134.         bpy.ops.object.vertex_group_select()
  135.         bpy.ops.object.vertex_group_remove(all=False)
  136. # select faces from Groups (END)----------------------------------------<
  137.        
  138. # cell subdivide --------------------------------------------->
  139. def cellSubdiv():
  140.         bpy.ops.object.modifier_add(type='SUBSURF')
  141.         bpy.ops.object.mode_set(mode='OBJECT')
  142.         bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Subsurf")
  143. # cell subdivide (END)----------------------------------------<
  144.  
  145. # assignFaces ----------------------------------------------->
  146. def assignFaces(vGroup, xMin, xMax, yMin, yMax, zMin, zMax):
  147.         newGroup = ob.vertex_groups.new(vGroup)
  148.         bpy.ops.object.mode_set(mode='OBJECT')
  149.        
  150.         for f in ob.data.faces:
  151.                
  152.                 if f.center[0] > xMin and f.center[0] < xMax and f.center[1] > yMin and f.center[1] < yMax and f.center[2] > zMin and f.center[2] < zMax:
  153.                         f.select = True
  154.                 else:
  155.                         f.select = False       
  156.                                        
  157.         bpy.ops.object.mode_set(mode='EDIT')                   
  158.         bpy.ops.object.vertex_group_set_active(group=vGroup)
  159.         bpy.ops.object.vertex_group_assign(new=False)
  160.         bpy.ops.mesh.select_all(action='DESELECT')
  161. # assignFaces (END)------------------------------------------<
  162.  
  163. # assignFacesAngle--------------------------------------------->
  164. def assignFacesAngle(vGroup, fAngleMin, fAngleMax, yMin, yMax):
  165.         newGroup = ob.vertex_groups.new(vGroup)
  166.         bpy.ops.object.mode_set(mode='OBJECT')
  167.        
  168.         up = mathutils.Vector((0.0,0.0,1.0))
  169.  
  170.         # Lets loop through all the faces in the mesh
  171.         for f in ob.data.faces:
  172.                 # If the angle between up and the face's normal (direction) is smaller than 45...
  173.                 # The face must be pointing up
  174.                 # To compare the angle we need 45 degrees in radians, not in degrees!
  175.                 # Math with angles is usually all in radians
  176.                 if f.normal.angle(up) > math.radians(fAngleMin) and f.normal.angle(up) < math.radians(fAngleMax) and f.center[1] > yMin and f.center[1] < yMax :
  177.                         # Set select to true
  178.                         f.select = True
  179.                 else:
  180.                         f.select = False
  181.                        
  182.         bpy.ops.object.mode_set(mode='EDIT')                   
  183.         bpy.ops.object.vertex_group_set_active(group=vGroup)
  184.         bpy.ops.object.vertex_group_assign(new=False)
  185.         bpy.ops.mesh.select_all(action='DESELECT')
  186. # assignFacesAngle(END)--------------------------------------<
  187.                
  188. # Generate Object ----------------------------------------->
  189. for sRot in range(-10, 10, 2):
  190.         for sAngle in range(0, 180, 15):
  191.  
  192. # -- Set Up(START) ------------------------------------------>
  193.                 bpy.ops.mesh.primitive_plane_add(view_align=False, enter_editmode=False, location=(sRot*3, sAngle-90, 0), rotation=(0, 0, 0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
  194.                 bpy.ops.object.mode_set(mode='EDIT')
  195.                 bpy.ops.transform.rotate(value=(-1.5708,), axis=(-1, -2.22045e-16, -4.93038e-32), constraint_axis=(False, False, False), constraint_orientation='LOCAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), release_confirm=False)
  196.                 bpy.ops.transform.resize(value=(0.05, 1, 0.05), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=0.0762767, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
  197.                 bpy.ops.object.mode_set(mode='OBJECT')
  198.  
  199. # Now we want to get the active object
  200. # To do this we go through bpy.context... because that is basicly "what you are working on right now"
  201. # bpy.data could work too, but then you'd need to do more work to find your current active object
  202.                 ob = bpy.context.active_object
  203.  
  204. # A new trick... lets go into edit mode and deselect everything ('SELECT' works too)
  205.                 bpy.ops.object.mode_set(mode='EDIT')
  206.                 bpy.ops.mesh.select_all(action='DESELECT')
  207.  
  208. # Get the screen areas we are working in right now
  209.                 areas = bpy.context.screen.areas
  210.  
  211. # Loop through all the areas
  212.                 for area in areas:
  213.  
  214.         # See if the current area is a 3D view
  215.                         if area.type == 'VIEW_3D':
  216.  
  217.                 # Set the pivot point to individual origins
  218.                                 area.active_space.pivot_point = 'INDIVIDUAL_ORIGINS'
  219.  
  220. # -- Set Up(END) ------------------------------------------<
  221.  
  222.        
  223.         # bodyShape(vGroup, mainLevel, stepNum, stepDist, stepRot, startAngle, stepAngle, modLevel, modRate, axisArray)
  224.                 bodyShape('body', bMainLevel, 12, -0.5, sRot/10, sAngle, bStepAngle, bModLevel, bModRate, [-1, -2.22045e-16, -0])
  225.                 bpy.ops.object.mode_set(mode='OBJECT')
  226.        
  227.                 cellSubdiv()
  228. # spine
  229.         #transformFaces(vGroup, mainLevel, stepNum, stepDist, stepRot, startAngle, stepAngle, modLevel, modRate, axis)
  230.         #assignFaces('spine', -5.0, 5.0, 2.5, 20.0, 0.0, 10.0)
  231.         #transformFaces('spine', 0.3, 10, -0.2, -0.5, sAngle, 10, 5, 20, [-2.22045e-16, -1, -0])
  232.                 assignFacesAngle('arm', 0, 45, 2.5, 20.0)
  233.                 assignFacesAngle('horn', 0, 45, 0.5, 1.5)
  234.                 assignFacesAngle('leg', 135, 180, 2.0, 4.0)
  235.        
  236.                 transformFaces('arm', pMainLevel, 10, -0.2, sRot/10, sAngle, pStepAngle*6, pModLevel*5, pModRate*4, [-2.22045e-16, -1, -0])
  237.                 transformFaces('horn', pMainLevel, 4, -0.1, sRot/10, sAngle, pStepAngle*8, pModLevel*5, pModRate*4, [-2.22045e-16, -1, -0])
  238.                 transformFaces('leg', pMainLevel, 10, -0.2, sRot/10, sAngle, -pStepAngle*5, pModLevel*2, pModRate*2, [-2.22045e-16, -1, -0])
  239.        
  240.                 bpy.ops.object.modifier_add(type='SUBSURF')
  241.                 bpy.ops.object.modifier_add(type='SUBSURF')
  242.                 bpy.ops.object.mode_set(mode='OBJECT')
  243.        
  244.                 #fileName = '/Users/shige/Documents/BlenderPJ/GMP_model3/A_Life_'+str(sRot)+'_'+str(sAngle)
  245. #fileName = '/Users/shige/Documents/BlenderPJ/GMP_model/A_Life_sRot_-10_10_2_sAngle_0_180_15)'
  246.  
  247. # Save the current file! (with a specific fileName)            
  248. #bpy.ops.wm.save_as_mainfile(filepath=fileName, check_existing=False, compress=True)
  249.        
  250.                 #bpy.ops.object.delete()
  251.  
go to heaven