Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bpy
- rows = 7
- columns = 7
- r = 0
- c = 0
- def spiral(X, Y):
- x = y = 0
- dx = 0
- dy = -1
- for i in range(max(X, Y)**2):
- if (-X/2 < x <= X/2) and (-Y/2 < y <= Y/2):
- bpy.ops.mesh.primitive_cube_add(location = (x, y, 0))
- bpy.ops.view3d.assign_material(matname="Material")
- bpy.context.scene.cursor_location = bpy.context.active_object.location
- bpy.context.scene.cursor_location.z -= 1
- bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
- ###
- bpy.context.active_object.scale.x = 0.5
- bpy.context.active_object.scale.y = 0.5
- bpy.context.active_object.scale.z = 5
- bpy.ops.object.transform_apply(scale=True)
- bpy.ops.anim.keyframe_insert_menu(type='Scaling')
- bpy.context.active_object.animation_data.action.fcurves[0].lock = True
- bpy.context.active_object.animation_data.action.fcurves[1].lock = True
- bpy.context.area.type = 'GRAPH_EDITOR'
- step = 20000/(rows*columns)
- if bpy.ops.graph.sound_bake.poll():
- bpy.ops.graph.sound_bake(filepath="/home/nikita/blends/audiovisual/01 sad robot.mp3", low=i*step, high=i*step+step)
- bpy.context.active_object.animation_data.action.fcurves[2].lock = True
- if x == y or (x < 0 and x == -y) or (x > 0 and x == 1-y):
- dx, dy = -dy, dx
- x, y = x+dx, y+dy
- spiral(rows, columns)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement