Paste Code
Paste Blends
Paste Images
# First import bpy to get access to well... everything in blender
from bpy import *
import bpy
import math, mathutils, random

class GMP_Panel(bpy.types.Panel):
bl_label = "Generative Modeling"
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
#bl_context = "object"

def draw(self, context):
layout = self.layout

scn = bpy.context.scene

row = layout.row()
row = row.column()

row = row.column()
row.label(text="Body parameter")

row = row.column()
row.prop( scn, "Body_Phase" )
row = row.column()
row.prop( scn, "Body_Wavelength" )
row = row.column()
row.prop( scn, "Body_Amplitude" )
row = row.column()
row.prop( scn, "Body_StepAngle" )
row = row.column()
row.prop( scn, "Body_ModAmplitude" )
row = row.column()
row.prop( scn, "Body_ModWavelength" )

row = row.column()
row.label(text="Arm parameter")

row = row.column()
row.prop( scn, "Arm_Phase" )
row = row.column()
row.prop( scn, "Arm_Wavelength" )
row = row.column()
row.prop( scn, "Arm_Amplitude" )
row = row.column()
row.prop( scn, "Arm_StepAngle" )
row = row.column()
row.prop( scn, "Arm_ModAmplitude" )
row = row.column()
row.prop( scn, "Arm_ModWavelength" )
row = row.column()
row.prop( scn, "Arm_Joint" )

row = row.column()
row.label(text="Leg parameter")

row.prop( scn, "Leg_Phase" )
row = row.column()
row.prop( scn, "Leg_Wavelength" )
row = row.column()
row.prop( scn, "Leg_Amplitude" )
row = row.column()
row.prop( scn, "Leg_StepAngle" )
row = row.column()
row.prop( scn, "Leg_ModAmplitude" )
row = row.column()
row.prop( scn, "Leg_ModWavelength" )
row = row.column()
row.prop( scn, "Leg_Joint" )

row = row.column()
row.label(text="Horn parameter")

row.prop( scn, "Horn_Phase" )
row = row.column()
row.prop( scn, "Horn_Wavelength" )
row = row.column()
row.prop( scn, "Horn_Amplitude" )
row = row.column()
row.prop( scn, "Horn_StepAngle" )
row = row.column()
row.prop( scn, "Horn_ModAmplitude" )
row = row.column()
row.prop( scn, "Horn_ModWavelength" )
row = row.column()
row.prop( scn, "Horn_Joint" )

row = row.column()
row.label(text=" ")

row.operator( "bpt.generate_op" )

class GMP_Operator(bpy.types.Operator):
bl_idname = "bpt.generate_op"
bl_label = "Generate"

def execute(self, context):
Body_Phase = bpy.context.scene.Body_Phase
Body_Wavelength = bpy.context.scene.Body_Wavelength
Body_Amplitude = bpy.context.scene.Body_Amplitude
Body_StepAngle = bpy.context.scene.Body_StepAngle
Body_ModAmplitude = bpy.context.scene.Body_ModAmplitude
Body_ModWavelength = bpy.context.scene.Body_ModWavelength
Body_Joint = 0

Arm_Phase = bpy.context.scene.Arm_Phase
Arm_Wavelength = bpy.context.scene.Arm_Wavelength
Arm_Amplitude = bpy.context.scene.Arm_Amplitude
Arm_StepAngle = bpy.context.scene.Arm_StepAngle
Arm_ModAmplitude = bpy.context.scene.Arm_ModAmplitude
Arm_ModWavelength = bpy.context.scene.Arm_ModWavelength
Arm_Joint = bpy.context.scene.Arm_Joint

Leg_Phase = bpy.context.scene.Leg_Phase
Leg_Wavelength = bpy.context.scene.Leg_Wavelength
Leg_Amplitude = bpy.context.scene.Leg_Amplitude
Leg_StepAngle = bpy.context.scene.Leg_StepAngle
Leg_ModAmplitude = bpy.context.scene.Leg_ModAmplitude
Leg_ModWavelength = bpy.context.scene.Leg_ModWavelength
Leg_Joint = bpy.context.scene.Leg_Joint

Horn_Phase = bpy.context.scene.Horn_Phase
Horn_Wavelength = bpy.context.scene.Horn_Wavelength
Horn_Amplitude = bpy.context.scene.Horn_Amplitude
Horn_StepAngle = bpy.context.scene.Horn_StepAngle
Horn_ModAmplitude = bpy.context.scene.Horn_ModAmplitude
Horn_ModWavelength = bpy.context.scene.Horn_ModWavelength
Horn_Joint = bpy.context.scene.Horn_Joint

generate(Body_Phase, Body_Wavelength, Body_Amplitude, Body_StepAngle, Body_ModAmplitude, Body_ModWavelength, Body_Joint, Arm_Phase, Arm_Wavelength, Arm_Amplitude, Arm_StepAngle, Arm_ModAmplitude, Arm_ModWavelength, Arm_Joint, Leg_Phase, Leg_Wavelength, Leg_Amplitude, Leg_StepAngle, Leg_ModAmplitude, Leg_ModWavelength, Leg_Joint, Horn_Phase, Horn_Wavelength, Horn_Amplitude, Horn_StepAngle, Horn_ModAmplitude, Horn_ModWavelength, Horn_Joint )

self.report( "INFO", "New Life was Generated!" )
return {'FINISHED'}

def register():
bpy.utils.register_class( GMP_Operator )
bpy.utils.register_class( GMP_Panel )

def unregister():
bpy.utils.register_class( GMP_Operator )
bpy.utils.register_class( GMP_Panel )


def generate(body_Phase, body_Wavelength, body_Amplitude, body_StepAngle, body_ModAmplitude, body_ModWavelength, body_Joint, arm_Phase, arm_Wavelength, arm_Amplitude, arm_StepAngle, arm_ModAmplitude, arm_ModWavelength, arm_Joint, leg_Phase, leg_Wavelength, leg_Amplitude, leg_StepAngle, leg_ModAmplitude, leg_ModWavelength, leg_Joint, horn_Phase, horn_Wavelength, horn_Amplitude, horn_StepAngle, horn_ModAmplitude, horn_ModWavelength, horn_Joint ):

# 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, startDeg, stepDeg, modLevel, modRate, axis, jointNum):
# 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 = startDeg
oldRatio = 1.0
# Shape
j = 0
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/10)))+2.0)/oldRatio

dA = stepDist
sA = newRatio
rA = math.sin(math.radians(t*2))*(-stepRot/10)
axis_x = axis[0]
axis_y = axis[1]
axis_z = axis[2]
transStep(dA, sA, rA, axis_x, axis_y, axis_z)
if jointNum != 0:
j = j+1
if j == jointNum:
bpy.ops.mesh.extrude(type='REGION')
transStep(-0.01, 0.6, 0, axis_x, axis_y, axis_z)
bpy.ops.mesh.extrude(type='REGION')
transStep(-0.01, 1.66, 0, axis_x, axis_y, axis_z)
j = 0
t = t + stepDeg
oldRatio = oldRatio*newRatio

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

# bodyShape ------------------------------------------------------>
def bodyShape(vGroup, mainLevel, stepNum, stepDist, stepRot, startDeg, stepDeg, modLevel, modRate, axis, jointNum):
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, startDeg, stepDeg, modLevel, modRate, axis, jointNum)
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)--------------------------------------<

# 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

#sAngle = startDeg
#sRot = stepDeg
# Set Up Parameter(END) -----------------------------------<

# Generate Object ----------------------------------------->
# -- Set Up(START) ------------------------------------------>
bpy.ops.object.delete()

bpy.ops.mesh.primitive_plane_add(view_align=False, enter_editmode=False, location=(0, 0, 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, jointNum)
bodyShape('body', body_Amplitude, 12, -0.5, body_Wavelength, body_Phase, body_StepAngle, body_ModAmplitude, body_ModWavelength, [-1, -2.22045e-16, -0], 0)
#bodyShape('body', 3, 12, -0.5, 0, 5, 30, 3, 10, [-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', arm_Amplitude, 10, -0.2, arm_Wavelength, arm_Phase, arm_StepAngle, arm_ModAmplitude, arm_ModWavelength, [-2.22045e-16, -1, -0], arm_Joint)
transformFaces('horn', horn_Amplitude, 6, -0.1,horn_Wavelength, horn_Phase, horn_StepAngle, horn_ModAmplitude, horn_ModWavelength, [-2.22045e-16, -1, -0], horn_Joint)
transformFaces('leg', leg_Amplitude, 10, -0.2, leg_Wavelength, leg_Phase, leg_StepAngle, leg_ModAmplitude, leg_ModWavelength, [-2.22045e-16, -1, -0], leg_Joint)

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()

if __name__ == '__main__':
bpy.types.Scene.Body_Phase = bpy.props.FloatProperty(name="Body_Phase", default = 0, min = -180, max = 180, description = "Body Phase")
bpy.types.Scene.Body_Wavelength = bpy.props.FloatProperty(name="Body_Wavelength", default = 0, min = -30, max = 30, description = "Body Wavelength")

bpy.types.Scene.Body_Amplitude = bpy.props.FloatProperty(name="Body_Amplitude", default = 1, min = 1, max = 5, description = "Body Amplitude")
bpy.types.Scene.Body_StepAngle = bpy.props.FloatProperty(name="Body_StepAngle", default = 0, min = -20, max = 20, description = "Body StepAngle")
bpy.types.Scene.Body_ModAmplitude = bpy.props.FloatProperty(name="Body_ModAmplitude", default = 0, min = -3, max = 3, description = "Body ModAmplitude")
bpy.types.Scene.Body_ModWavelength = bpy.props.FloatProperty(name="Body_ModWavelength", default = 0, min = -10, max = 10, description = "Body ModWavelength")

bpy.types.Scene.Arm_Phase = bpy.props.FloatProperty(name="Arm_Phase", default = 0, min = -180, max = 180, description = "Arm Phase")
bpy.types.Scene.Arm_Wavelength = bpy.props.FloatProperty(name="Arm_Wavelength", default = 0, min = -10, max = 10, description = "Arm Wavelength")

bpy.types.Scene.Arm_Amplitude = bpy.props.FloatProperty(name="Arm_Amplitude", default = 0.3, min = 0.1, max = 1.0, description = "Arm Amplitude")
bpy.types.Scene.Arm_StepAngle = bpy.props.FloatProperty(name="Arm_StepAngle", default = 0, min = -20, max = 20, description = "Arm StepAngle")
bpy.types.Scene.Arm_ModAmplitude = bpy.props.FloatProperty(name="Arm_ModAmplitude", default = 0, min = 0, max = 5, description = "Arm ModAmplitude")
bpy.types.Scene.Arm_ModWavelength = bpy.props.FloatProperty(name="Arm_ModWavelength", default = 0, min = 0, max = 20, description = "Arm ModWavelength")
bpy.types.Scene.Arm_Joint = bpy.props.IntProperty(name="Arm_Joint", default = 0, min = 0, max = 5, description = "Arm Joint")

bpy.types.Scene.Leg_Phase = bpy.props.FloatProperty(name="Leg_Phase", default = 0, min = -180, max = 180, description = "Leg Phase")
bpy.types.Scene.Leg_Wavelength = bpy.props.FloatProperty(name="Leg_Wavelength", default = 0, min = -10, max = 10, description = "Leg Wavelength")

bpy.types.Scene.Leg_Amplitude = bpy.props.FloatProperty(name="Leg_Amplitude", default = 0.3, min = 0.1, max = 1.0, description = "Leg Amplitude")
bpy.types.Scene.Leg_StepAngle = bpy.props.FloatProperty(name="Leg_StepAngle", default = 0, min = -20, max = 20, description = "Leg StepAngle")
bpy.types.Scene.Leg_ModAmplitude = bpy.props.FloatProperty(name="Leg_ModAmplitude", default = 0, min = 0, max = 5, description = "Leg ModAmplitude")
bpy.types.Scene.Leg_ModWavelength = bpy.props.FloatProperty(name="Leg_ModWavelength", default = 0, min = 0, max = 20, description = "Leg ModWavelength")
bpy.types.Scene.Leg_Joint = bpy.props.IntProperty(name="Leg_Joint", default = 0, min = 0, max = 5, description = "Leg Joint")

bpy.types.Scene.Horn_Phase = bpy.props.FloatProperty(name="Horn_Phase", default = 0, min = -180, max = 180, description = "Horn Phase")
bpy.types.Scene.Horn_Wavelength = bpy.props.FloatProperty(name="Horn_Wavelength", default = 0, min = -10, max = 10, description = "Horn Wavelength")

bpy.types.Scene.Horn_Amplitude = bpy.props.FloatProperty(name="Horn_Amplitude", default = 0.3, min = 0.1, max = 1.0, description = "Horn Amplitude")
bpy.types.Scene.Horn_StepAngle = bpy.props.FloatProperty(name="Horn_StepAngle", default = 0, min = -20, max = 20, description = "Horn StepAngle")
bpy.types.Scene.Horn_ModAmplitude = bpy.props.FloatProperty(name="Horn_ModAmplitude", default = 0, min = 0, max = 5, description = "Horn ModAmplitude")
bpy.types.Scene.Horn_ModWavelength = bpy.props.FloatProperty(name="Horn_ModWavelength", default = 0, min = 0, max = 20, description = "Horn ModWavelength")
bpy.types.Scene.Horn_Joint = bpy.props.IntProperty(name="Horn_Joint", default = 0, min = 0, max = 5, description = "Horn Joint")

register()
  1. # First import bpy to get access to well... everything in blender
  2. from bpy import *
  3. import bpy
  4. import math, mathutils, random
  5.  
  6. class GMP_Panel(bpy.types.Panel):
  7.         bl_label = "Generative Modeling"
  8.         bl_space_type = "VIEW_3D"
  9.         bl_region_type = "TOOLS"
  10.         #bl_context = "object"
  11.  
  12.         def draw(self, context):
  13.                 layout = self.layout
  14.                
  15.                 scn = bpy.context.scene
  16.                
  17.                 row = layout.row()
  18.                 row = row.column()
  19.                
  20.                 row = row.column()
  21.                 row.label(text="Body parameter")
  22.                
  23.                 row = row.column()
  24.                 row.prop( scn, "Body_Phase" )
  25.                 row = row.column()
  26.                 row.prop( scn, "Body_Wavelength" )
  27.                 row = row.column()
  28.                 row.prop( scn, "Body_Amplitude" )
  29.                 row = row.column()
  30.                 row.prop( scn, "Body_StepAngle" )
  31.                 row = row.column()
  32.                 row.prop( scn, "Body_ModAmplitude" )
  33.                 row = row.column()
  34.                 row.prop( scn, "Body_ModWavelength" )
  35.                
  36.                 row = row.column()
  37.                 row.label(text="Arm parameter")
  38.                
  39.                 row = row.column()
  40.                 row.prop( scn, "Arm_Phase" )
  41.                 row = row.column()
  42.                 row.prop( scn, "Arm_Wavelength" )
  43.                 row = row.column()
  44.                 row.prop( scn, "Arm_Amplitude" )
  45.                 row = row.column()
  46.                 row.prop( scn, "Arm_StepAngle" )
  47.                 row = row.column()
  48.                 row.prop( scn, "Arm_ModAmplitude" )
  49.                 row = row.column()
  50.                 row.prop( scn, "Arm_ModWavelength" )
  51.                 row = row.column()
  52.                 row.prop( scn, "Arm_Joint" )
  53.                
  54.                 row = row.column()
  55.                 row.label(text="Leg parameter")
  56.                
  57.                 row.prop( scn, "Leg_Phase" )
  58.                 row = row.column()
  59.                 row.prop( scn, "Leg_Wavelength" )
  60.                 row = row.column()
  61.                 row.prop( scn, "Leg_Amplitude" )
  62.                 row = row.column()
  63.                 row.prop( scn, "Leg_StepAngle" )
  64.                 row = row.column()
  65.                 row.prop( scn, "Leg_ModAmplitude" )
  66.                 row = row.column()
  67.                 row.prop( scn, "Leg_ModWavelength" )
  68.                 row = row.column()
  69.                 row.prop( scn, "Leg_Joint" )
  70.                
  71.                 row = row.column()
  72.                 row.label(text="Horn parameter")
  73.                
  74.                 row.prop( scn, "Horn_Phase" )
  75.                 row = row.column()
  76.                 row.prop( scn, "Horn_Wavelength" )
  77.                 row = row.column()
  78.                 row.prop( scn, "Horn_Amplitude" )
  79.                 row = row.column()
  80.                 row.prop( scn, "Horn_StepAngle" )
  81.                 row = row.column()
  82.                 row.prop( scn, "Horn_ModAmplitude" )
  83.                 row = row.column()
  84.                 row.prop( scn, "Horn_ModWavelength" )
  85.                 row = row.column()
  86.                 row.prop( scn, "Horn_Joint" )
  87.                
  88.                 row = row.column()
  89.                 row.label(text=" ")
  90.                
  91.                 row.operator( "bpt.generate_op" )
  92.                
  93. class GMP_Operator(bpy.types.Operator):
  94.         bl_idname = "bpt.generate_op"
  95.         bl_label = "Generate"
  96.  
  97.         def execute(self, context):
  98.                 Body_Phase = bpy.context.scene.Body_Phase
  99.                 Body_Wavelength = bpy.context.scene.Body_Wavelength
  100.                 Body_Amplitude = bpy.context.scene.Body_Amplitude
  101.                 Body_StepAngle = bpy.context.scene.Body_StepAngle
  102.                 Body_ModAmplitude = bpy.context.scene.Body_ModAmplitude
  103.                 Body_ModWavelength = bpy.context.scene.Body_ModWavelength
  104.                 Body_Joint = 0
  105.                
  106.                 Arm_Phase = bpy.context.scene.Arm_Phase
  107.                 Arm_Wavelength = bpy.context.scene.Arm_Wavelength
  108.                 Arm_Amplitude = bpy.context.scene.Arm_Amplitude
  109.                 Arm_StepAngle = bpy.context.scene.Arm_StepAngle
  110.                 Arm_ModAmplitude = bpy.context.scene.Arm_ModAmplitude
  111.                 Arm_ModWavelength = bpy.context.scene.Arm_ModWavelength
  112.                 Arm_Joint = bpy.context.scene.Arm_Joint
  113.                
  114.                 Leg_Phase = bpy.context.scene.Leg_Phase
  115.                 Leg_Wavelength = bpy.context.scene.Leg_Wavelength
  116.                 Leg_Amplitude = bpy.context.scene.Leg_Amplitude
  117.                 Leg_StepAngle = bpy.context.scene.Leg_StepAngle
  118.                 Leg_ModAmplitude = bpy.context.scene.Leg_ModAmplitude
  119.                 Leg_ModWavelength = bpy.context.scene.Leg_ModWavelength
  120.                 Leg_Joint = bpy.context.scene.Leg_Joint
  121.                
  122.                 Horn_Phase = bpy.context.scene.Horn_Phase
  123.                 Horn_Wavelength = bpy.context.scene.Horn_Wavelength
  124.                 Horn_Amplitude = bpy.context.scene.Horn_Amplitude
  125.                 Horn_StepAngle = bpy.context.scene.Horn_StepAngle
  126.                 Horn_ModAmplitude = bpy.context.scene.Horn_ModAmplitude
  127.                 Horn_ModWavelength = bpy.context.scene.Horn_ModWavelength
  128.                 Horn_Joint = bpy.context.scene.Horn_Joint
  129.                
  130.                 generate(Body_Phase, Body_Wavelength, Body_Amplitude, Body_StepAngle, Body_ModAmplitude, Body_ModWavelength, Body_Joint, Arm_Phase, Arm_Wavelength, Arm_Amplitude, Arm_StepAngle, Arm_ModAmplitude, Arm_ModWavelength, Arm_Joint, Leg_Phase, Leg_Wavelength, Leg_Amplitude, Leg_StepAngle, Leg_ModAmplitude, Leg_ModWavelength, Leg_Joint, Horn_Phase, Horn_Wavelength, Horn_Amplitude, Horn_StepAngle, Horn_ModAmplitude, Horn_ModWavelength, Horn_Joint )
  131.                
  132.                 self.report( "INFO", "New Life was Generated!" )
  133.                 return {'FINISHED'}
  134.  
  135. def register():
  136.         bpy.utils.register_class( GMP_Operator )
  137.         bpy.utils.register_class( GMP_Panel )
  138.  
  139. def unregister():
  140.         bpy.utils.register_class( GMP_Operator )
  141.         bpy.utils.register_class( GMP_Panel )
  142.  
  143.  
  144. def generate(body_Phase, body_Wavelength, body_Amplitude, body_StepAngle, body_ModAmplitude, body_ModWavelength, body_Joint, arm_Phase, arm_Wavelength, arm_Amplitude, arm_StepAngle, arm_ModAmplitude, arm_ModWavelength, arm_Joint, leg_Phase, leg_Wavelength, leg_Amplitude, leg_StepAngle, leg_ModAmplitude, leg_ModWavelength, leg_Joint, horn_Phase, horn_Wavelength, horn_Amplitude, horn_StepAngle, horn_ModAmplitude, horn_ModWavelength, horn_Joint ):
  145.  
  146.         # Extrude One Step ---------------------------------------->
  147.         def transStep(dA, sA, rA, axis_x, axis_y, axis_z):
  148.                 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)
  149.                 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)
  150.        
  151.                 # Get the mesh
  152.                 me = ob.data
  153.                 # Loop through the faces to find the center
  154.                 for f in me.faces:
  155.                         if f.select == True:
  156.                                 center = f.center
  157.                 if center[0] > 0.0:
  158.                         rotDir = 1.0
  159.                 else:
  160.                         rotDir = -1.0
  161.        
  162.                 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)
  163.        
  164.         # TransformFaces(Multi Step) ------------------------------------------------------->
  165.         def transformFaces(vGroup, mainLevel, stepNum, stepDist, stepRot, startDeg, stepDeg, modLevel, modRate, axis, jointNum):
  166.                 # Make sure nothing is selected
  167.                 bpy.ops.object.mode_set(mode='EDIT')
  168.                 bpy.ops.mesh.select_all(action='DESELECT')
  169.        
  170.                 # Select the vertex group
  171.                 selPart(vGroup)
  172.        
  173.                 # Go into object mode so that we are sure we have the current list of faces
  174.                 bpy.ops.object.mode_set(mode='OBJECT')
  175.  
  176.                 # Make a nice list to keep the vertex groups in
  177.                 groupList = []
  178.  
  179.                 # Now loop through all the faces
  180.                 for i, f in enumerate(ob.data.faces):
  181.                
  182.                         # If this face is selected~
  183.                         if ob.data.faces[i].select == True:
  184.  
  185.                                 # Create a new vertex group!
  186.                                 newGroup = ob.vertex_groups.new('mygroup')
  187.                                 groupList.append(newGroup)
  188.  
  189.                                 # Get all the vertices in the current face and add them to the new group
  190.                                 for v in f.vertices:
  191.                                         newGroup.add([v], 1.0, 'REPLACE')
  192.                        
  193.                 # Now we loop through the groups and do what we want.
  194.                 for g in groupList:
  195.  
  196.                         # Make sure nothing is selected
  197.                         bpy.ops.object.mode_set(mode='EDIT')
  198.                         bpy.ops.mesh.select_all(action='DESELECT')
  199.  
  200.                         # Make the group in our list the active one
  201.                         ob.vertex_groups.active_index = g.index
  202.  
  203.                         # Select all the verts in the active group
  204.                         bpy.ops.object.vertex_group_select()
  205.  
  206.                         bpy.ops.object.vertex_group_remove(all=False)
  207.  
  208.                         # AND NOW WE CAN DO OUR STUFF... little test example follows
  209.                         t = startDeg
  210.                         oldRatio = 1.0
  211.                         # Shape
  212.                         j = 0
  213.                         for i in range(stepNum):
  214.      
  215.                                 bpy.ops.mesh.extrude(type='REGION')
  216.                        
  217.                                 # An added trick... remove the extruded face from all vertex groups after the first extrusion (i == 0)
  218.                                 # This way it can't get extruded again
  219.                                 # Because the edge of the first face can be part of multiple groups
  220.                                 if not i:
  221.                                         bpy.ops.object.vertex_group_remove_from(all=True)
  222.                        
  223.                                 bpy.ops.object.mode_set(mode='OBJECT')
  224.                                 bpy.ops.object.mode_set(mode='EDIT')
  225.                        
  226.                                 newRatio = mainLevel*(math.sin(math.radians(t)+modLevel*math.sin(math.radians(t+modRate/10)))+2.0)/oldRatio
  227.                                
  228.                                 dA = stepDist
  229.                                 sA = newRatio
  230.                                 rA = math.sin(math.radians(t*2))*(-stepRot/10)
  231.                                 axis_x = axis[0]
  232.                                 axis_y = axis[1]
  233.                                 axis_z = axis[2]
  234.                                 transStep(dA, sA, rA, axis_x, axis_y, axis_z)
  235.                                 if jointNum != 0:
  236.                                         j = j+1
  237.                                         if j == jointNum:
  238.                                                 bpy.ops.mesh.extrude(type='REGION')
  239.                                                 transStep(-0.01, 0.6, 0, axis_x, axis_y, axis_z)
  240.                                                 bpy.ops.mesh.extrude(type='REGION')
  241.                                                 transStep(-0.01, 1.66, 0, axis_x, axis_y, axis_z)
  242.                                                 j = 0
  243.                                 t = t + stepDeg
  244.                                 oldRatio = oldRatio*newRatio
  245.        
  246.         # transformFaces!(END) --------------------------------------------------<
  247.  
  248.         # bodyShape ------------------------------------------------------>
  249.         def bodyShape(vGroup, mainLevel, stepNum, stepDist, stepRot, startDeg, stepDeg, modLevel, modRate, axis, jointNum):
  250.                 newGroup = ob.vertex_groups.new(vGroup)
  251.                 bpy.ops.object.mode_set(mode='OBJECT')
  252.        
  253.                 # Lets loop through all the faces in the mesh
  254.                 for f in ob.data.faces:
  255.        
  256.                         # See if the current face's centre is above 0.0 on the Z axis
  257.                         if f.center[1] > -0.1:
  258.                                 # Set select to true
  259.                                 f.select = True
  260.                         else:
  261.                                 f.select = False
  262.                
  263.                 bpy.ops.object.mode_set(mode='EDIT')                   
  264.                 bpy.ops.object.vertex_group_set_active(group=vGroup)
  265.                 bpy.ops.object.vertex_group_assign(new=False)
  266.                
  267.                 transformFaces(vGroup, mainLevel, stepNum, stepDist, stepRot, startDeg, stepDeg, modLevel, modRate, axis, jointNum)
  268.                 bpy.ops.mesh.select_all(action='DESELECT')
  269.         # bodyShape(END) ---------------------------------------------------<
  270.  
  271.         # select faces from Groups --------------------------------------------->
  272.         def selPart(vGroup):
  273.                 bpy.ops.object.vertex_group_set_active(group=vGroup)
  274.                 bpy.ops.object.vertex_group_select()
  275.                 bpy.ops.object.vertex_group_remove(all=False)
  276.         # select faces from Groups (END)----------------------------------------<
  277.        
  278.         # cell subdivide --------------------------------------------->
  279.         def cellSubdiv():
  280.                 bpy.ops.object.modifier_add(type='SUBSURF')
  281.                 bpy.ops.object.mode_set(mode='OBJECT')
  282.                 bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Subsurf")
  283.         # cell subdivide (END)----------------------------------------<
  284.  
  285.         # assignFaces ----------------------------------------------->
  286.         def assignFaces(vGroup, xMin, xMax, yMin, yMax, zMin, zMax):
  287.                 newGroup = ob.vertex_groups.new(vGroup)
  288.                 bpy.ops.object.mode_set(mode='OBJECT')
  289.        
  290.                 for f in ob.data.faces:
  291.                
  292.                         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:
  293.                                 f.select = True
  294.                         else:
  295.                                 f.select = False       
  296.                                        
  297.                 bpy.ops.object.mode_set(mode='EDIT')                   
  298.                 bpy.ops.object.vertex_group_set_active(group=vGroup)
  299.                 bpy.ops.object.vertex_group_assign(new=False)
  300.                 bpy.ops.mesh.select_all(action='DESELECT')
  301.         # assignFaces (END)------------------------------------------<
  302.  
  303.         # assignFacesAngle--------------------------------------------->
  304.         def assignFacesAngle(vGroup, fAngleMin, fAngleMax, yMin, yMax):
  305.                 newGroup = ob.vertex_groups.new(vGroup)
  306.                 bpy.ops.object.mode_set(mode='OBJECT')
  307.        
  308.                 up = mathutils.Vector((0.0,0.0,1.0))
  309.  
  310.                 # Lets loop through all the faces in the mesh
  311.                 for f in ob.data.faces:
  312.                         # If the angle between up and the face's normal (direction) is smaller than 45...
  313.                         # The face must be pointing up
  314.                         # To compare the angle we need 45 degrees in radians, not in degrees!
  315.                         # Math with angles is usually all in radians
  316.                         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 :
  317.                                 # Set select to true
  318.                                 f.select = True
  319.                         else:
  320.                                 f.select = False
  321.                        
  322.                 bpy.ops.object.mode_set(mode='EDIT')                   
  323.                 bpy.ops.object.vertex_group_set_active(group=vGroup)
  324.                 bpy.ops.object.vertex_group_assign(new=False)
  325.                 bpy.ops.mesh.select_all(action='DESELECT')
  326.         # assignFacesAngle(END)--------------------------------------<
  327.  
  328.         # Set Up Parameters     --------------------------------------->
  329.         #bMainLevel = 3
  330.         #bStepAngle = 30
  331.         #bModLevel = 3.0
  332.         #bModRate =     10.0
  333.  
  334.         #pMainLevel = 0.3
  335.         #pStepAngle = 1.0
  336.         #pModLevel = 1.0
  337.         #pModRate = 5.0
  338.  
  339.         #sAngle = startDeg
  340.         #sRot = stepDeg
  341.         # Set Up Parameter(END) -----------------------------------<
  342.  
  343.         # Generate Object ----------------------------------------->
  344.         # -- Set Up(START) ------------------------------------------>
  345.         bpy.ops.object.delete()
  346.          
  347.         bpy.ops.mesh.primitive_plane_add(view_align=False, enter_editmode=False, location=(0, 0, 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))
  348.         bpy.ops.object.mode_set(mode='EDIT')
  349.         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)
  350.         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)
  351.         bpy.ops.object.mode_set(mode='OBJECT')
  352.  
  353.         # Now we want to get the active object
  354.         # To do this we go through bpy.context... because that is basicly "what you are working on right now"
  355.         # bpy.data could work too, but then you'd need to do more work to find your current active object
  356.         ob = bpy.context.active_object
  357.        
  358.         # A new trick... lets go into edit mode and deselect everything ('SELECT' works too)
  359.         bpy.ops.object.mode_set(mode='EDIT')
  360.         bpy.ops.mesh.select_all(action='DESELECT')
  361.  
  362.         # Get the screen areas we are working in right now
  363.         areas = bpy.context.screen.areas
  364.  
  365.         # Loop through all the areas
  366.         for area in areas:
  367.  
  368.                 # See if the current area is a 3D view
  369.                 if area.type == 'VIEW_3D':
  370.  
  371.                         # Set the pivot point to individual origins
  372.                         area.active_space.pivot_point = 'INDIVIDUAL_ORIGINS'
  373.  
  374.         # -- Set Up(END) ------------------------------------------<
  375.  
  376.        
  377.         # bodyShape(vGroup, mainLevel, stepNum, stepDist, stepRot, startAngle, stepAngle, modLevel, modRate, axisArray, jointNum)
  378.         bodyShape('body', body_Amplitude, 12, -0.5, body_Wavelength, body_Phase, body_StepAngle, body_ModAmplitude, body_ModWavelength, [-1, -2.22045e-16, -0], 0)
  379.         #bodyShape('body', 3, 12, -0.5, 0, 5, 30, 3, 10, [-1, -2.22045e-16, -0])
  380.         bpy.ops.object.mode_set(mode='OBJECT')
  381.        
  382.         cellSubdiv()
  383.         # spine
  384.         #transformFaces(vGroup, mainLevel, stepNum, stepDist, stepRot, startAngle, stepAngle, modLevel, modRate, axis)
  385.         #assignFaces('spine', -5.0, 5.0, 2.5, 20.0, 0.0, 10.0)
  386.         #transformFaces('spine', 0.3, 10, -0.2, -0.5, sAngle, 10, 5, 20, [-2.22045e-16, -1, -0])
  387.         assignFacesAngle('arm', 0, 45, 2.5, 20.0)
  388.         assignFacesAngle('horn', 0, 45, 0.5, 1.5)
  389.         assignFacesAngle('leg', 135, 180, 2.0, 4.0)
  390.        
  391.         transformFaces('arm', arm_Amplitude, 10, -0.2, arm_Wavelength, arm_Phase, arm_StepAngle, arm_ModAmplitude, arm_ModWavelength, [-2.22045e-16, -1, -0], arm_Joint)
  392.         transformFaces('horn', horn_Amplitude, 6, -0.1,horn_Wavelength, horn_Phase, horn_StepAngle, horn_ModAmplitude, horn_ModWavelength, [-2.22045e-16, -1, -0], horn_Joint)
  393.         transformFaces('leg', leg_Amplitude, 10, -0.2, leg_Wavelength, leg_Phase, leg_StepAngle, leg_ModAmplitude, leg_ModWavelength, [-2.22045e-16, -1, -0], leg_Joint)
  394.        
  395.         bpy.ops.object.modifier_add(type='SUBSURF')
  396.         bpy.ops.object.modifier_add(type='SUBSURF')
  397.         bpy.ops.object.mode_set(mode='OBJECT')
  398.        
  399.         #fileName = '/Users/shige/Documents/BlenderPJ/GMP_model3/A_Life_'+str(sRot)+'_'+str(sAngle)
  400.         #fileName = '/Users/shige/Documents/BlenderPJ/GMP_model/A_Life_sRot_-10_10_2_sAngle_0_180_15)'
  401.  
  402.         # Save the current file! (with a specific fileName)            
  403.         # bpy.ops.wm.save_as_mainfile(filepath=fileName, check_existing=False, compress=True)
  404.        
  405.         #bpy.ops.object.delete()
  406.  
  407. if __name__ == '__main__':
  408.         bpy.types.Scene.Body_Phase = bpy.props.FloatProperty(name="Body_Phase", default = 0, min = -180, max = 180, description = "Body Phase")
  409.         bpy.types.Scene.Body_Wavelength = bpy.props.FloatProperty(name="Body_Wavelength", default = 0, min = -30, max = 30, description = "Body Wavelength")
  410.        
  411.         bpy.types.Scene.Body_Amplitude = bpy.props.FloatProperty(name="Body_Amplitude", default = 1, min = 1, max = 5, description = "Body Amplitude")
  412.         bpy.types.Scene.Body_StepAngle = bpy.props.FloatProperty(name="Body_StepAngle", default = 0, min = -20, max = 20, description = "Body StepAngle")
  413.         bpy.types.Scene.Body_ModAmplitude = bpy.props.FloatProperty(name="Body_ModAmplitude", default = 0, min = -3, max = 3, description = "Body ModAmplitude")
  414.         bpy.types.Scene.Body_ModWavelength = bpy.props.FloatProperty(name="Body_ModWavelength", default = 0, min = -10, max = 10, description = "Body ModWavelength")
  415.        
  416.         bpy.types.Scene.Arm_Phase = bpy.props.FloatProperty(name="Arm_Phase", default = 0, min = -180, max = 180, description = "Arm Phase")
  417.         bpy.types.Scene.Arm_Wavelength = bpy.props.FloatProperty(name="Arm_Wavelength", default = 0, min = -10, max = 10, description = "Arm Wavelength")
  418.  
  419.         bpy.types.Scene.Arm_Amplitude = bpy.props.FloatProperty(name="Arm_Amplitude", default = 0.3, min = 0.1, max = 1.0, description = "Arm Amplitude")
  420.         bpy.types.Scene.Arm_StepAngle = bpy.props.FloatProperty(name="Arm_StepAngle", default = 0, min = -20, max = 20, description = "Arm StepAngle")
  421.         bpy.types.Scene.Arm_ModAmplitude = bpy.props.FloatProperty(name="Arm_ModAmplitude", default = 0, min = 0, max = 5, description = "Arm ModAmplitude")
  422.         bpy.types.Scene.Arm_ModWavelength = bpy.props.FloatProperty(name="Arm_ModWavelength", default = 0, min = 0, max = 20, description = "Arm ModWavelength")
  423.         bpy.types.Scene.Arm_Joint = bpy.props.IntProperty(name="Arm_Joint", default = 0, min = 0, max = 5, description = "Arm Joint")
  424.  
  425.         bpy.types.Scene.Leg_Phase = bpy.props.FloatProperty(name="Leg_Phase", default = 0, min = -180, max = 180, description = "Leg Phase")
  426.         bpy.types.Scene.Leg_Wavelength = bpy.props.FloatProperty(name="Leg_Wavelength", default = 0, min = -10, max = 10, description = "Leg Wavelength")
  427.  
  428.         bpy.types.Scene.Leg_Amplitude = bpy.props.FloatProperty(name="Leg_Amplitude", default = 0.3, min = 0.1, max = 1.0, description = "Leg Amplitude")
  429.         bpy.types.Scene.Leg_StepAngle = bpy.props.FloatProperty(name="Leg_StepAngle", default = 0, min = -20, max = 20, description = "Leg StepAngle")
  430.         bpy.types.Scene.Leg_ModAmplitude = bpy.props.FloatProperty(name="Leg_ModAmplitude", default = 0, min = 0, max = 5, description = "Leg ModAmplitude")
  431.         bpy.types.Scene.Leg_ModWavelength = bpy.props.FloatProperty(name="Leg_ModWavelength", default = 0, min = 0, max = 20, description = "Leg ModWavelength")
  432.         bpy.types.Scene.Leg_Joint = bpy.props.IntProperty(name="Leg_Joint", default = 0, min = 0, max = 5, description = "Leg Joint")
  433.  
  434.         bpy.types.Scene.Horn_Phase = bpy.props.FloatProperty(name="Horn_Phase", default = 0, min = -180, max = 180, description = "Horn Phase")
  435.         bpy.types.Scene.Horn_Wavelength = bpy.props.FloatProperty(name="Horn_Wavelength", default = 0, min = -10, max = 10, description = "Horn Wavelength")
  436.  
  437.         bpy.types.Scene.Horn_Amplitude = bpy.props.FloatProperty(name="Horn_Amplitude", default = 0.3, min = 0.1, max = 1.0, description = "Horn Amplitude")
  438.         bpy.types.Scene.Horn_StepAngle = bpy.props.FloatProperty(name="Horn_StepAngle", default = 0, min = -20, max = 20, description = "Horn StepAngle")
  439.         bpy.types.Scene.Horn_ModAmplitude = bpy.props.FloatProperty(name="Horn_ModAmplitude", default = 0, min = 0, max = 5, description = "Horn ModAmplitude")
  440.         bpy.types.Scene.Horn_ModWavelength = bpy.props.FloatProperty(name="Horn_ModWavelength", default = 0, min = 0, max = 20, description = "Horn ModWavelength")
  441.         bpy.types.Scene.Horn_Joint = bpy.props.IntProperty(name="Horn_Joint", default = 0, min = 0, max = 5, description = "Horn Joint")
  442.  
  443.         register()
  444.  
go to heaven