Hi!
Is it possible to do realtime vertex-paint with Python?
For example, when you shoot a enemy in a FPS-game, a python-script vertex-paints a little red spot (like blod or something).
-ZuiQ
Hi!
Is it possible to do realtime vertex-paint with Python?
For example, when you shoot a enemy in a FPS-game, a python-script vertex-paints a little red spot (like blod or something).
-ZuiQ
us = GameLogic.getCurrentController().getOwner()
me = us.getMesh()
for m in range(me.getNumMaterials()):
vl = me.getVertexArrayLength(m)
for i in range(vl):
v = me.getVertex(m,i)
v.setRGBA(0x00000000)
That code will simply paint all the vertexes in an object black. the setRGBA function I believe takes a hexidecimal, with each set of two digits being a color (r,g,b,a), but Im not the expert on this
If there is a mix of tris and quads in the mesh, getNumMaterials returns 2 and it has to go through the process once for each set of tris and quads.
Figuring out what vertexes to paint, I guess thats your job 
Where did you find that Saluk? (It seems like every site of Blender related Python I’ve looked at has different things.)
Around blender version 2.14, the code was found by nikolatesla20 in the source of a web plugin .blend on the official blender website. I’m pretty sure he figured out how to actually use it and then published that on the forums. (The old blender.nl forums) So it’s an undocumented feature that NaN put in at one point, and I guess they considered it too experimental to tell anyone about it?
Yeah interesting, and I don’t even see things like getVertex(0,0).getXYZ() in any of the documentation. Anyway I have a script to help figure whice indices you want and I’ll post it under the ‘bullethole’ post I made after I improve the script some.
Should be cool if some makes a test, I tried it, but didn’t get it working. I made an guns which shoot a bullet, and I made it like, when the bullet hits the model, the script runs, but nothing happend. 