Jump to content

Recommended Posts

Posted
I have searched a lot about this and still haven't found anything. Any ideas how to get the vertex index for a certain vertex?
Posted
I'm not a blender person, but doesn't it display this in the status bar, upper right? The 2.5x version has a status window that sounds like it might act a bit like Maya's, one may be able to query in there.
Posted (edited)

It does have one,but it just displays the number of selected vertices. But it turn out you can get the index by writing a very simple python script that iterates through the vertex list and displays their indexes. I'll try to write one later and post it here. I won't have more than 60 lines or so. I'm currently trying to figure out how to add a textbox and some simple buttons in blender using the script.

 

;** Comment Line **
obj_blend = Blender.Object.Get("Cube")
obj_blend.RotX = obj_blend.RotX + 90
print (obj_blend.Name)
If Len(obj_blend.Name <= 0) : print("This is an example code box")
Blender.Redraw()
Return 0

Edited by LHammonds
Added codebox BBCode as an example
Posted

Thank you very much for the reply. I still learned a bit of python and made the script that writes all the selected vertices from all the objects in a text file.

Here's the script:

 

#!BPY

"""
Name: 'Export Selected Vertices'
Blender: 249
Group: 'Export'
Tooltip: 'Selected Vertices Exporter'
"""
import Blender
import bpy

def exportVertices(filename):
out = file(filename, "w")
sce = bpy.data.scenes.active
for ob in sce.objects:
	try:
		mesh = ob.getData(mesh=1)
		out.write(ob.name + "\n")
		for vert in mesh.verts:
			if vert.sel == 1:
				out.write( ' v %s \n' % (vert.index) )
	except:
		print( "Object %s probably doesn't have any vertices" % ( ob.name ))
out.close()

Blender.Window.FileSelector(exportVertices,"export")

 

I was busy figuring out how to add some buttons with some options,like only exporting the vertices from a certain object. And some objects don't have the verts attribute,so I added an exception handler for that,but maybe if refers to the fact that the reference is null or something like that and accessing a null reference is illegal. I'll look into it a bit more.

 

I really like the fact that you can write your own script for blender in a very nice language.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...