I've created a Python Effector which reads in csv values and scales clones in Y by index.
My only issue is that the script doesn't respect negative values from the csv, and instead scales all clones in the positiveY.
I thinkthis has something to do with matrices, and have read through matrix section the sdk, but can't seem to find a way have negative csv values translate to negativeY scales. Even when I negate the csv values, the effector still scales the clones in the positiveY.
Maybe something simple I'm overlooking, but any help appreciated.
import c4d
from c4d.modules import mograph as mo
import csv
#Welcome to the world of Python
def main():
csvFile = op[c4d.ID_USERDATA,1]
csvColName = op[c4d.ID_USERDATA,2]
count = 0
myValues = []
with open(csvFile) as csvfileIn:
reader = csv.DictReader(csvfileIn)
for row in reader:
csvVals = (row[csvColName])
myValues.append(csvVals)
count += 1
myRevList = myValues[::-1] #reverses the order of the list
myFloats = [float(i) for i in myRevList]
rangeLow = min(myFloats)
rangeHigh = max(myFloats)
md = mo.GeGetMoData(op)
if md is None: return False
marr = md.GetArray(c4d.MODATA_MATRIX)
fall = md.GetFalloffs()
nb = md.GetCount()
for u in range(0, nb):
marr[u].v2 = c4d.Vector(0,myFloats[u]*100,0)
md.SetArray(c4d.MODATA_MATRIX, marr, True)
return True
if __name__=='__main__':
main()