Last active
August 29, 2015 14:20
-
-
Save SabinT/39a133d052182bfd1045 to your computer and use it in GitHub Desktop.
Normalize (or project to sphere) selected vertices in Blender
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 bmesh | |
def normalize_selected(): | |
m = bpy.context.active_object.data # get selected object's mesh | |
bm = bmesh.new() # create an empty BMesh | |
bm.from_mesh(m) # fill it in from a Mesh | |
for v in bm.verts: | |
if v.select: | |
v.co.normalize() | |
bm.to_mesh(m) | |
def project_selected(radius): | |
m = bpy.context.active_object.data # get selected object's mesh | |
bm = bmesh.new() # create an empty BMesh | |
bm.from_mesh(m) # fill it in from a Mesh | |
for v in bm.verts: | |
if v.select: | |
v.co.normalize() | |
v.co = v.co * radius | |
bm.to_mesh(m) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment