example, local absolute position of 1 selected vertex
""" in 2.6x/scripts/ i added ztools and a script inside that folder so I now have 2.6x/scripts/ztools/reposition.py In blender console I can now import the functions from reposition.py and use them conveniently with autocomplete >>> from ztools.reposition import move >>> move(1,0,0) """
This file contains hidden or 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, bmesh | |
from mathutils import Vector | |
def move(x,y=0,z=0): | |
obj = bpy.context.edit_object | |
me = obj.data | |
bm = bmesh.from_edit_mesh(me) | |
new_coordinate = Vector((x,y,z)) | |
selected_verts = [vert.index for vert in bm.verts if vert.select] | |
if len(selected_verts) == 1: | |
bm.verts[selected_verts[0]].co = new_coordinate | |
bmesh.update_edit_mesh(me, True) | |
move(1,1,1) |