This takes even longer ~ 14 seconds. I really seems the slowness is
simply accessing envelopeOp.Weights.Array.
Any devs paying attention that could confirm that this is just a slow
call? Would doing these operations in C++ be the only way to speed them up?
# Python
# =============================================
from platform import system as OStype
from time import clock
xsi = Application
log = xsi.LogMessage
sel = xsi.Selection
start_time = clock()
envelopeOp = sel(0).Envelopes(0)
weightsTuple = envelopeOp.Weights.Array
weights = [weightsTuple[j][i] for i in xrange(len(weightsTuple[0])) for
j in xrange(len(weightsTuple))]
timeTaken = clock() - start_time
units = ["seconds" if OStype() is "Windows" else "milliseconds"][0]
msg = "It took "+str(timeTaken)+" "+units+" to process your code."
log(msg)
# =============================================
Eric Thivierge
===============
Character TD / RnD
Hybride Technologies
On 31/05/2013 3:00 AM, Bartosz Opatowiecki wrote:
Also:
def getWeights(envelopeOp):
weightsTuple = envelopeOp.Weights.Array
return [weightsTuple[j][i] for i in range(len(weightsTuple[0])) for j
in range(len(weightsTuple))]
xrange should be more efficient than range....