I want to create a blocky random terrain by extruding all faces of a plane a random amount. I had the idea you were supposed to iterate through all faces, select one, extrude at random, deselect, select next etc.etc. I made a script but it does not seem to be working. It will only extrude once on the face i have manually preselected. If I select none, nothing happens.
here is my script:
import bpy, bmesh, random
objList = list(bpy.data.objects)
mesh = None
for obj in objList:
if obj.name == 'Plane':
mesh = obj
if mesh != None:
for face in mesh.data.polygons:
randExt = random.uniform(0.001,0.06)
bpy.ops.object.mode_set(mode="EDIT")
bpy.ops.mesh.select_mode(type="FACE")
#select does not seem to be working.
face.select = True
bpy.ops.mesh.extrude_region_move(
MESH_OT_extrude_region={"mirror":True},
TRANSFORM_OT_translate={"value":(randExt,0,0),
"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.mesh.select_all(action = 'DESELECT')
bpy.ops.object.mode_set(mode="OBJECT")
