UV problems in game level editing script

I’m currently writing a level editing script that reads things such as lights, geometry, start spots, spawn spots, external models, etc and saves everything in an easy to read/hand editable file format easy for loading by a game. Everything is working as intended except for the auto uv feature. This is a tool intended to guess uv coordinates for simple geometry instead of having to do it all by hand. The important things i wanted it to do were texture repeat, and texture offsets. However i’m having problems with the texture repeat portion. When I try to get it the uv to repeat, i get some very weird results. The script can be found at http://zappa.nku.edu/~hairu/editor.py or the blend file from here http://zappa.nku.edu/~hairu/editor.blend

If anyone’s interested I can post the file format(or you can just look at the code).

Any help on achieving the uv results I require is greatly appreciated.

You don’t need to restrict the uv coordinates to the (0, 1) range, try just simply multiplying (xval, yval) with wrapSize.

Cool, thanx