Hi everyone,
I've made a simply python effector that allows me to manipulate the color of a effected cloner. That works fine but when I creat an instance of that object and start moving it in 3D space, I get a ton of these errors:
Traceback (most recent call last):
File "'<Python>'", line 18, in main
TypeError: object of type 'NoneType' has no len()
https://www.dropbox.com/s/4cui1f7t8a1l0n9/PyEffectorTest_v1.c4d?dl=0
import c4d
from c4d.modules import mograph as mo
#Welcome to the world of Python
def main():
linked = op[c4d.ID_USERDATA,1]
md = mo.GeGetMoData(op)
md2 = mo.GeGetMoData(linked)
EB = op[c4d.ID_USERDATA,2]
if md is None: return False
cnt = md.GetCount()
clr = md.GetArray(c4d.MODATA_COLOR)
clr2 = md2.GetArray(c4d.MODATA_COLOR)
if cnt > 0:
print cnt
#for i in xrange(0,cnt):
#clr[i] = clr2[i] + (clr2[i] * c4d.Vector(EB))
md.SetArray(c4d.MODATA_COLOR, clr, True)
return True
c4d.EventAdd()
if __name__=='__main__':
main()
Does anyone have an idea how to get around this?