I'm trying to create a word attribute from the textindex attribute which you get from the font sop. The textindex attribute works like that:
Inputtext — "Hello World"
textindex attribute on each prim — 0, 1, 2, 3, 4, 6, 7, 8, 9, 10,
So after each Space there is a gap in the ascending arrangement of the values of the textindex attribute. Which technique do I have to use to get a word attribute out of it? The word attribute should be like this:
Inputtext — "Hello World"
textindex attribute on each prim — 0, 1, 2, 3, 4, 6, 7, 8, 9, 10,
word attribute — 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
Best Regards,
Chrizzo
P.S.: Got it to work, thanks to Supermartin E.:
Put this into a detail wrangle and it works. Oh and you should sort the primitives of the font mesh by the textindex attribute before you do the wrangle.
int id = 0; int id_old = 0; int wordcounter = 0; for(int i=0; i<@numprim; i++) { id = prim(0,"textindex",i); if(id > id_old + 1) wordcounter++; setprimattrib(0,"word",i,wordcounter); id_old = id; }