View Single Post
Old 15th June 2005, 04:30 AM   #1
PerFnurt
Member
Expert member
 
Join Date: Aug 2003
Location: Eslöv, Sweden
Posts: 93
Default Getting vertex index

Hiya!

Is there an easy way to get/display the index of a selected vertex?

By index I mean what I'd get if I'd do something like

Code:
Vertex* selVertex = getSelectedVertex();
if (selVertex!=NULL)
{
  ACObject* ob = getObjectThatOwnsVertex(selVertex);
  int index=0;
  List * vertices = ac_object_get_vertexlist(ob);
  for (List *vp = vertices; vp != NULL; vp = vp->next;++index)
  {
    if (vp == selVertex)
      break;
  }

  // Should always be true, else something 
  // is wrong in getObjectThatOwnsVertex
  if (vp!=NULL) 
  {
    // index holds the "vertex index"
    display(index);
  }
}
Is there some nifty tcl hack that can accomplish this?

Or would I have to write a complete plugin?
If so, would getObjectThatOwnsVertex actually require traversing every object and their vertices until a match is found or is there some more efficient way?


Thanks
__________________
/Per

www.perfnurt.se
PerFnurt is offline   Reply With Quote