Last active
September 26, 2015 21:28
-
-
Save zeffii/1162142 to your computer and use it in GitHub Desktop.
insert empty at selected vertices of a mesh, mesh must be back in object mode
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
# must select 3 verts. | |
import bpy | |
#from mathutils import Vector, Quaternion | |
ob = bpy.context.object | |
# needs to be in object mode to check the status, i think? | |
# check if 3 verts selected. | |
selected_idx = [i.index for i in ob.data.vertices if i.select] | |
print(len(selected_idx)) | |
print(selected_idx) | |
# get vertex locations | |
# ob.matrix_world = full matrix. | |
world_coordinates = [] | |
for idx in selected_idx: | |
point = ob.data.vertices[idx].co # local | |
world_coord = ob.matrix_world * point | |
bpy.ops.object.add(type='EMPTY', location=world_coord, rotation=(0, 0, 0)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment