THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/07/2012 at 05:30, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 13
Platform: Windows ;
Language(s) :
---------
Hello
I have experiment to control tp by py, trying to develop event handler.
When iterate by pid and set to new group, when preview gone to last frame, it crashes c4d.
scene:
http://rghost.ru/39051439
import c4d
from c4d import utils
from c4d.modules import thinkingparticles as tp
def main() :
tp = doc.GetParticleSystem()
obj = doc.SearchObject("target")
rc = utils.GeRayCollider()
ntp = tp.NumParticles()
objpos = obj.GetAbsPos()
tc = rc.Init(obj)
red = (tp.GetRootGroup()).GetDown()
for i in range(ntp) :
start_pos = tp.Position(i)
direct = objpos - start_pos
length = direct.GetLength()
rc.Intersect(start_pos, direct, length)
is_cnt = rc.GetIntersectionCount()
for id in xrange(is_cnt) :
cgid = rc.GetNearestIntersection()
if cgid["distance"] > 0.0:
tp.SetGroup(i, red)