[Bf-python] question about path follow constraints...

Natanael Olaiz nolaiz at gmail.com
Wed Nov 5 12:53:25 CET 2008


Hi!

I need to make a script which can get objects positions over the active
frames. If the objects uses an Ipo curve for animation, I easily get the
curve, and then evaluate on a specific frame (
http://www.blender.org/documentation/247PythonDoc/IpoCurve.IpoCurve-class.html#evaluate
).
But... how about a object having a constraint FOLLOWPATH to a curve??

I made this script to get and print all the keys(/nodes?) of the curves
attached to objects as FOLLOWPATH constraints.... but, just the discrete
points. How can I get the intermediate values? I don't want to repeat the
work that the Blender itself does to make the animation... but I can't found
how to get that in the API documentation.

#!BPY
>> import Blender
>> import bpy
>> #from bpy import data
>> scene=bpy.data.scenes.active
>> for object in scene.objects:
>>     print "object: %s" % object.name
>>     for constraint in object.constraints:
>>         print "\t * constraint: %s" % constraint
>>         if constraint.type==Blender.Constraint.Type['FOLLOWPATH']:
>>             print "\t * Follow Path!"
>>             target=constraint[Blender.Constraint.Settings.TARGET]
>>             print "\t * Target: %s" % target.name
>>             curve=target.getData()
>>             print "\t\t -> curve %s has %i curNurbs" % (curve.name,curve.getNumCurves())
>>
>>             for curNurb in curve:
>>                 for point in curNurb:
>>                     print "\t\t\t * %s" % str(point)
>
>


I'll be really glad if someone can help me with this.


Thanks in advance,
Natanael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20081105/5d2003a5/attachment.html>


More information about the Bf-python mailing list