Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > PYTHON Development
  New Posts New Posts
  FAQ FAQ  Forum Search

Python Effectors

Author
Message
  Topic Search Topic Search
bencaires View Drop Down
Member
Member
Avatar

Joined: 2018 Jun 26
Location: LA
Online Status: Offline
Posts: 11
Direct Link To This Post Topic: Python Effectors
    Posted: 2018 Sep 04 at 4:07pm
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

Does anyone have an idea how to get around this? 

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()

Thanks!
bjc
Back to Top
Andreas Block View Drop Down
Forum Moderator
Forum Moderator
Avatar

Joined: 2014 Oct 01
Location: Hannover
Online Status: Offline
Posts: 1878
Direct Link To This Post Posted: 2018 Sep 05 at 2:48am
Hi,

I'd like to ask you to come over to our new Plugin Café forum, as this forum is going to enter read-only mode soon.
Please register there and start a new thread for this topic.

Cheers,
Andreas
SDK Support Engineer
Back to Top

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.094 seconds.