On 20/02/2013 at 16:17, xxxxxxxx wrote:
posting the python effector default code is not your own code. you also need to set
the python effector tu full control if you want to drive the particle matrices.
create a python effector, set it to full controll, add a vector userdata and a spline
userdata (in the exact order, the code expects the vector to be the first component)
and paste the code into the node. it is a rather simple example which uses the particle
index to aply an offset vector which is being throttled by the spline (which again is
being mapped along the indices).
import c4d
from c4d.modules import mograph as mo
from c4d import utils as u
def main() :
vec = op[c4d.ID_USERDATA,1]
spldata = op[c4d.ID_USERDATA,2]
md = mo.GeGetMoData(op)
if md == None:
return False
cnt = md.GetCount()
marr = md.GetArray(c4d.MODATA_MATRIX)
fall = md.GetFalloffs()
for i in reversed(xrange(0, cnt)) :
splinf = u.RangeMap(value = i,
mininput = 0,
maxinput = cnt,
minoutput = 0,
maxoutput = 1.0,
clampval = False,
curve = spldata)
marr[i].off = marr[i].off+fall[i] + (i * vec * splinf)
# o
md.SetArray(c4d.MODATA_MATRIX, marr, True)
return True