Created
September 14, 2015 07:14
-
-
Save zeffii/d61a4963e6c093dda52b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
import bmesh | |
import random | |
me = bpy.context.object.data | |
# Get a BMesh representation | |
bm = bmesh.new() # create an empty BMesh | |
bm.from_mesh(me) # fill it in from a Mesh | |
# Modify the BMesh, can do anything here... | |
for v in bm.verts: | |
orientations = [[-1,0,0], [1,0,0], [0,1,0], [0,-1,0]] | |
v.normal = random.choice(orientations) | |
# Finish up, write the bmesh back to the mesh | |
bm.to_mesh(me) | |
bm.free() # free and prevent further access |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment