Does the 2.5 API provide a way to get a list of a vertex’s nearest neighbours ? Blender has the required functionality (proportional edit moves nearest neighbours). I don’t want to program the tree if there’s an existing way through the API.
One possibility to write a def:
Select your vertex (vertices) let Blender select the nearest ones and check
compute the difference of vertices with select = True ?!
Try this:
make a object with several vertices … and let it be in edit-mode:
import bpy
def selectVertices(vertList):
# if bpy.context.area.type != 'VIEW_3D':
# bpy.context.area.type = 'VIEW_3D'
bpy.ops.mesh.select_all(action='DESELECT')
bpy.ops.object.mode_set(mode='OBJECT')
obj = bpy.context.active_object.data.vertices
for i in vertList:
print(i)
obj[i].select = True
bpy.ops.object.editmode_toggle() #edit mode!
print("
========")
vlist = [1,2,3] #e.g.
selectVertices(vlist)
def neighbours(vlist):
# if bpy.context.area.type != 'VIEW_3D':
# bpy.context.area.type = 'VIEW_3D'
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_more()
bpy.ops.object.mode_set(mode='OBJECT')
obj = bpy.context.active_object.data.vertices
res = []
for el in obj:
# print(el.select)
if el.select == True and not el.index in vlist:
print(el)
res.append(el.index)
bpy.ops.object.mode_set(mode='EDIT')
return res
print(neighbours(vlist))