On 13/03/2017 at 05:45, xxxxxxxx wrote:
Yeah, I can understand almost everything happening in the script, but it breaks the instant you change pretty much anything.
I noticed Douwe said if you copy the contents of the scene into a new empty scene, it starts working with the new changes. I confirm this works, but what a dirty fix...
Could there be a more elegant way to offset clones indices?
I tried a different approach, based on an example python effector from the Python SDK (py_effector)
In that example there is no "return" present, and when I try my code (seen below) I have to include "return 1.0" otherwise I get an error:
"TypeError: main expected float or c4d.Vector, not None"
import c4d
from c4d.modules import mograph as mo
import random
def my_shuffle(array) :
random.shuffle(array)
print "I shuffled"
return array
def main() :
md = mo.GeGetMoData(op)
if md==None: return
cnt = md.GetCount()
marr = md.GetArray(c4d.MODATA_MATRIX)
fall = md.GetFalloffs()
frame = doc.GetTime().GetFrame(doc.GetFps())
try:
marr = newmarr
except NameError:
pass
if frame%5==0 and frame != 0:
newmarr = my_shuffle(marr)
md.SetArray(c4d.MODATA_MATRIX, marr, True)
return 1.0
So, this code doesn't work, it throws no errors either, it does dump about a million "I shuffled" messages to the log every 5th frame. Why that is happening, I have no clue.. I assumed python effector executes once per frame..?