Thanks Eric,

 

However, when I use the array for feeding the color, it drops the error
message again, it doesn't matter what is the initial value in the a_VC
array...I start to feel, that it's the array itself...

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Eric
Thivierge
Sent: Thursday, September 27, 2012 1:19 PM
To: [email protected]
Subject: Re: Python and xsi commands

 

I don't have zbrush but I think the fact that you are setting the
default values to None in your a_VC list is causing a problem. I don't
think it takes it as a default value.

 

I would set the default to a color like black or something if you are
going to set values on all polynodes. Otherwise, you should only create
the lists for the polynodes that you are setting them on.

 

The following script while it isn't working as you like shows that if
you put None in the a_VC it will fail:

 

# Python

from win32com.client import constants as c

from win32com.client.dynamic import Dispatch as d

 

xsi = Application

log = xsi.LogMessage

collSel = xsi.Selection

 

DEBUG = 0

 

OBJ = collSel(0)

geoOBJ = OBJ.Activeprimitive.Geometry

nodesizes =
OBJ.Activeprimitive.ICEAttributes('NbPolygonNodes').DataArray

nodesize = nodesizes[0]

a_nodes = [x for x in range(nodesize)]
#vbObjectInitialize((nodesize,), Variant)

a_VC = ["&h00000000"] * nodesize
#vbObjectInitialize((nodesize,), Variant)

log(len(a_nodes))

log(len(a_VC))

l_vcs = Application.CreateVertexColorSupport("","PolyPaint",OBJ)

cnt = 0

 

o_vertex = geoOBJ.Vertices(cnt)

for node in o_vertex.Nodes:

    idx = node.Index

    a_VC[idx] = -16777216

    a_nodes[idx] = idx

    

    cnt += 1

 

log(a_nodes)

log(a_VC)

                   

Application.PaintVertexColors(OBJ.FullName, a_nodes, a_VC, 1)

 

PS: Xavier and I are on Australia time. :)


--------------------------------------------
Eric Thivierge
http://www.ethivierge.com

Reply via email to