On 26/04/2013 at 02:58, xxxxxxxx wrote:
I've go this running as a vertex effector (seems to work ok with cloner)
Someone asked me how to make it work with PolyFX as an effector
it doesnt work - the effector creates what looks like a tiled image of the vertex map
Can't seem to find any info on Polyfx
Can anyone help - pointers, advice
oh - and if you spot the obvious in the code below - pls feel free to amend
tia
Paul
import c4d
from c4d.modules import mograph as mo
from c4d import utils
def main() :
md = mo.GeGetMoData(op)
if md==None: return False
cnt = md.GetCount()
marr = md.GetArray(c4d.MODATA_MATRIX)
start = marr
fall = md.GetFalloffs()
tag = op[c4d.ID_USERDATA,1]
if tag == None: return False
posn = op[c4d.ID_USERDATA,2]
scl = op[c4d.ID_USERDATA,4]
rot = op[c4d.ID_USERDATA,3]
tagh = tag.GetAllHighlevelData() #get the vertex map as a list of reals matched to each vertex
index = md.GetCurrentIndex()
for i in reversed(xrange(0, cnt)) :
# scale
marr[i].v1 = marr[i].v1 * scl.x * tagh[i]
marr[i].v2 = marr[i].v2 * scl.y * tagh[i]
marr[i].v3 = marr[i].v3 * scl.z * tagh[i]
# position
marr[i].off += marr[i].MulV(posn) *tagh[i]
# rotation
marr[i] = marr[i] *utils.HPBToMatrix(rot)
md.SetArray(c4d.MODATA_MATRIX, marr, True)
return True