Make VertCol from Python script?

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
Frapl
Posts: 0
Joined: Wed Aug 25, 2004 9:17 am

Make VertCol from Python script?

Post by Frapl »

Is there a way to reset the VertCols from a Python script?

At the moment I do this by hand to get fresh VertCols for a mesh:

1. VertCol: Delete
2. Set Solid
3. Set Smooth
4. VertCol: Make

If I only do Delete and then Make the VertCols again theay aren't really deleted. The "Make" is more like an "Undo" to the "Delete" action but I want to reset them completly like I would make the VertCols for the first time on a mesh.

Any ideas to do this from a Python script?

And is there a way to determine if there are already VertCols available for the mesh?

BTW: I use Blender 2.36 (Windows)
Frapl

flippyneck
Posts: 0
Joined: Thu Jul 31, 2003 10:34 am
Contact:

Post by flippyneck »

It can be done - check here:

http://www.blender.org/modules/document ... texColours

Code: Select all

import Blender
from Blender import Object

obj = Object.GetSelected()[0]
dat = obj.getData()

# Remove vert col...
dat.hasVertexColours(0)
print dat.hasVertexColours()	# FALSE

# Enable vert col...
dat.hasVertexColours(1)
print dat.hasVertexColours()	# TRUE

Frapl
Posts: 0
Joined: Wed Aug 25, 2004 9:17 am

Post by Frapl »

Thanks! I'll try this.
Frapl

Post Reply