Last active
October 4, 2020 13:47
-
-
Save CGLion/8cedb6f6f5edeaedfb5fbaf7f2f60f2d to your computer and use it in GitHub Desktop.
Python for Blender - Access mesh triangles
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 | |
mesh = bpy.context.active_object.data | |
mesh.calc_loop_triangles() | |
for tri in mesh.loop_triangles: | |
tri_center = (mesh.vertices[tri.vertices[0]].co * 0.333) +\ | |
(mesh.vertices[tri.vertices[1]].co * 0.333) +\ | |
(mesh.vertices[tri.vertices[2]].co * 0.333) | |
bpy.ops.mesh.primitive_uv_sphere_add(radius=0.1,enter_editmode=False,location=tri_center) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment