Skip to content

Instantly share code, notes, and snippets.

@hiroakioishi
Created April 30, 2015 16:41
Show Gist options
  • Save hiroakioishi/b560e9fe9becdb68e0f3 to your computer and use it in GitHub Desktop.
Save hiroakioishi/b560e9fe9becdb68e0f3 to your computer and use it in GitHub Desktop.
[Blender:Python] シーン中に存在するタイプがMESHのオブジェクトの頂点を任意の範囲のランダム値でずらす
import bpy
import random
def offset_vertices_of_mesh_objects (vertOffsetRnd_):
for obj in bpy.context.scene.objects:
#print(obj.type)
if obj.type == 'MESH':
print(obj.name)
for vert in obj.data.vertices:
vert.co.x += random.uniform(-vertOffsetRnd_, vertOffsetRnd_)
vert.co.y += random.uniform(-vertOffsetRnd_, vertOffsetRnd_)
vert.co.z += random.uniform(-vertOffsetRnd_, vertOffsetRnd_)
offset_vertices_of_mesh_objects(0.01)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment