VertexArrayLength Problem

Ok, so I wanted to use the script provided in the ‘animtex.zip’ in the ‘animation texture’ post in this forum, it all seemed to work fine untill I discovered that if I subdivide a part of the mesh, or delete polygons to add them again later the function getVertexArrayLength() has the tendency to provide different numbers.
It seems to create subgroups within the mesh, and each time I start my game it changes: either the one part of the mesh changes its texture or the other…

http://sungandnannu.hku.nl/an_tex.zip

Any ideas on how to overcome this problem, I have heard that the function simply isn’t all that reliable anyway, but should anyone know of a way to get all the vertices of one mesh in the same vertexArray I’d be happy to hear so.

Check out http://sungandnannu.hku.nl for our game

I created an environmentmapping demo for somebody and had the same problem, I found that using the argument 0 returns the number of quad vertices, and using an argument of 1 returns the number of triangle vertices. Similarly, getVertex needs a different argument depending on if you are processing triangles or quads. It is getVertex(0, vertex) for quads and getVertex(1, vertex) for triangles. So you need to do two passes.

Thanks eeshlo! I was always a bit concerned that I didn’t know what the first number was for. I’ll update the script when I get a chance, but I never tested it on anything more complicated than a plane, so I’m not totally sure how it will hold up. I’ll post back in here when I 've gotten a chance to change it.

Ok, I figured it out. It’s not that the 0 is for quads and the 1 is for tris, the number is just the material number. But if you have quads and tris in the same mesh, blender autmatically seperates them into seperate materials. All I have to do, is run through vertexarray length for each material. I’ve uploaded a better version of the script at my new site:

http://mysite.iptic.com/spinhead/download.html/

Thanks everyone, it’s good to see so many other people still out there blendering!..

thanks for the new script, We’ll be sure to use it for some nice extra details!

Carl

http://sungandnannu.hku.nl

All I can say is W O W! I checked out your site, and was totally impressed. The game looks really fun, I can’t wait to see how it turns out! The art is very cute, and pleasing. Good luck with the project!

And if you ever need any more scripting help, feel free to ask.

haha this is proof to all of you people who get annoyed at the same questions being asked over and over on here. I had this problem a week or so ago and did not find this thread typing ‘getVertexArrayLength’ into the search box. Now if you type ‘VertexArrayLength’ in you will find this one…

If the search actually worked we might not have to ask so many repeat questions for those of us who look 1st and then ask.

btw I found this thread while looking for info on sorting vertices in a mesh :stuck_out_tongue: gg

Actually i’ve seen 2 posts other than this that contain the same information. Did you know there is a getNumMaterials() function?

If Saluk says ‘wow’ then I’d like to see the site too but the link wouldn’t work when I tried.