Hi all, Python question from a complete and utter coding novice.
I have a cloner set to object, and the reference object has an animating vertex map.
I'm fumbling with the Python Effector to translate the individual point vertex map values to mograph weights for clones positioned at the corresponding vertices.
The Python Effector would store the weights and subsequent effectors (like Inheritance) would use the weights as Falloff, so clones would animate as the vertex map animated.
Here's my first go at the Python. I feel I'm close but somehow the array from the vertex map is not getting to the mograph weights (does it call for a RangeMap?).
If anyone can help, would be greatly appreciated.
import c4d
from c4d.modules import mograph as mo
from c4d import utils as u
arr = [0.0]
def main():
global arr
sourceVmap = op[c4d.ID_USERDATA,1]
sourceData = sourceVmap.GetAllHighlevelData()
cnt = len(sourceData)
if len(arr) != cnt:
diff = cnt - len(arr)
arr.extend([0.0]*diff)
md = mo.GeGetMoData(op)
if md is None: return False
count = md.GetCount()
index = md.GetCurrentIndex()
marr = md.GetArray(c4d.MODATA_MATRIX)
warr = md.GetArray(c4d.MODATA_WEIGHT)
fall = md.GetFalloffs()
for i in xrange(0, count):
arr[i] = sourceData
md.SetArray(c4d.MODATA_WEIGHT, arr, True)
return True