[Bf-python] povanim

Willian Padovani Germano wgermano at ig.com.br
Mon Jul 7 20:27:13 CEST 2003


On Sun, 2003-07-06 at 07:17, jms wrote:

> > I just need one thing :  the hasVertexColours() function have to return 1 if vertex colours
> > are used,   with or without uvcoords.

As I told you this can't be done "the nice way", because of the double 
storage of vertex colors in Blender.  It's like this:

The Mesh structure has two places where vertex colors can be: *mcol and
tface->col.  When there are only vcolors, mcol is used.  When there are
tfaces, then the info is always kept at the tface->col place.  If then
you enter VCol painting mode, when you leave it the colors are copied
from mcol to tface->col and mcol storage is freed, deleted.  So when
TexFace is on, the vcolors info is not kept at *mcol, but at
tface->col.  Changing this would require deeper changes in Blender, in
many places.  And I suspect the renderer code counts on this info being
at tface->col and not at mcol.  So, as the old NaN programmers used to
say: this can change when the Blender "kernel" and specially the Mesh
structure are rewritten.

That's why I do think the best solution is to turn the VCol Paint button
"on" in the Material window (for each relevant material) and check it in
Python to know if there are vertex colors or only a single color for all
vertices.  Specially because this button is the way to make vertex
colors appear in Blender's own renderer.

BTW, you get an added bonus by checking those mat flags: if users set
the VCol Light button, you can use the vertex colors to modulate the
lighting of the mesh.

> Sorry, need of second thing :
> A button to eraze vertex paint but not uvcoords.

I looked for this both in Blender and its source files and found
nothing, though it's not hard to do it.  From what I saw, the best to do
is to be able to set all the vertex colors to some default value, like
white or the current vertex color, like done somewhere else in the
sources.  I'll propose that a small square button be added to the right
side of the "Make" (or, when active, "Delete") TexFace button, case
there really is no way already to reset the colors without also deleting
the uv info.

Is this solution ok?

--
Willian, wgermano at ig.com.br




More information about the Bf-python mailing list