Here’s a little something for people that create models for games. It’s a widget that displays in the 3D window and keeps track of the current triangle count of a mesh with respect to a polygon ‘budget’. It’s inspired by similar tools in 3D Max et al.
The widget is only visible out of edit mode so that it doesn’t slow down modelling. For models with tens of thousands of faces the interface will slow when the script is running, but then a games model probably wouldn’t have that kind of face count.
Usage:
1 - Run the script
2 - Create a mesh object and go to the Logic buttons. Give the object an integer property named ‘budget’ and set it to the desired value.
3 - Get modelling…
I’ve just fixed a small bug that caused lots of script links to be created if you hit the ‘show’ button in the GUI over and over. The link in the first post points to the correct file if you want to download the update.
PopeStewart - It’s fairly easy to draw in the 3D window. Take the snippet below and copy it to a Text file in your .blend. Call it ‘DrawTest.py’ or similar. Then create a scene script link to 'DrawTest.py’with a ‘Redraw’ event to see it working. The polybudget code is a little more complex as it creates the script links automatically via the GUI.
import Blender
from Blender import Draw
from Blender.BGL import *
glLoadIdentity()
glColor3f(1,0,0)
glRasterPos2i(10,30)
Draw.Text('This is a test...')
Whoops, I’m guessing this was the bit that confused you. Actually this line isn’t really necessary; I’ve been doing some non-Blender Python recently and got used to starting scripts like this.