![]() |
#1 |
Member
Expert member
Join Date: Aug 2003
Location: Eslöv, Sweden
Posts: 93
|
![]()
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); } } 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 |
![]() |
![]() |
![]() |
#2 |
Administrator
Professional user
Join Date: Jun 2003
Posts: 4,565
|
![]() Code:
Prototype ACObject *object_of_vertex(Vertex *pt); Vertices are stored in a linked list but do actually have an index property but it it not maintained. This means that you must call one function before you can then read them back. AFAIK this is internal at the moment but should work if you add the prototypes to the plugin header. This is used to speed things up internally sometimes. e.g. file exporters. call this: Code:
Prototype int ac_object_vertexlist_set_indexes(ACObject *ob) Code:
Prototype int ac_vertex_get_index(Vertex *v) Andy |
![]() |
![]() |
![]() |
#3 |
Member
Expert member
Join Date: Aug 2003
Location: Eslöv, Sweden
Posts: 93
|
![]()
Great, thanks!
|
![]() |
![]() |
![]() |
#4 |
Member
Expert member
Join Date: Aug 2003
Location: Eslöv, Sweden
Posts: 93
|
![]()
Works like a charm.
Btw, all mentioned functions are already present in the header. Thanks |
![]() |
![]() |
![]() |
|
|