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

Martin Poirier theeth at yahoo.com
Wed Nov 5 13:38:14 CET 2008


Extract the position from the object's matrix, that is always correct on any frame (takes into account parenting, constraints, IPO, Actions, ...).

Martin


--- On Wed, 11/5/08, Natanael Olaiz <nolaiz at gmail.com> wrote:

> From: Natanael Olaiz <nolaiz at gmail.com>
> Subject: [Bf-python] question about path follow constraints...
> To: "Blender Foundation Python list" <bf-python at blender.org>
> Date: Wednesday, November 5, 2008, 6:53 AM
> 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
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python


      



More information about the Bf-python mailing list