Writting to the envelope array is usually pretty fast for me... what's
taking time (in my case) is doing all the normalization of values...

This is how I read my weights :

def getWeights(envelopeOp):
 weightsTuple = envelopeOp.Weights.Array
return [weightsTuple[j][i] for i in range(len(weightsTuple[0])) for j in
range(len(weightsTuple))]

This is an example of how I set the weights (average weights) :

def averageWeights(envelopeOp, points=None):
'''
\remarks set the weights of given points to the average weights of given
points
\param envelopeOp Envelope Operator - the envelope operator.
\param points List of Integer - Index of vertices to average.
'''

deformerCount = envelopeOp.Deformers.Count
weightsTuple = envelopeOp.Weights.Array
weights = getWeights(envelopeOp)
 if points is None:
points = range(mesh.ActivePrimitive.Geometry.Points.Count)
 a = [0] * deformerCount
for pointIndex in points:
for def_index in range(deformerCount):
a[def_index] +=  weightsTuple[def_index][pointIndex]

for pointIndex in points:
for def_index in range(deformerCount):
weights[pointIndex*deformerCount + def_index] = a[def_index]/len(points)
 envelopeOp.Weights.Array = weights


On 30 May 2013 12:58, Eric Thivierge <ethivie...@hybride.com> wrote:

> Anyone know if there is a way to speed up reading and writing speeds to
> the Weights Array for envelopes? It's extremely slow on high point count /
> high deformer count meshes.
>
> I'm using Python but I'm not sure if that is the reason for the slowness.
> Anyone else already do some testing or have any findings that may help?
>
> I'm writing some common tools that many have already done such as
> normalizing weights, pruning, symmetrizing, etc.
>
> Any experiences confirming this slowness or experiences where it is
> exponentially faster in other languages are welcome too.
>
> Thanks,
>
> --
>  Eric Thivierge
> ===============
> Character TD / RnD
> Hybride Technologies
>
>
>

Reply via email to