[Bf-python] Getting fcurve data from parented object

Campbell Barton ideasman42 at gmail.com
Thu Jan 24 01:25:03 CET 2013


On Thu, Jan 24, 2013 at 10:51 AM, Asbjørn <lordcrc at gmail.com> wrote:
> Hi,
>
> in LuxBlend25 we use bpy.types.FCurve's evaluate() method[1] to get the
> animation data at a given time point for rendering motion blur.
>
> This works well, as long as the object has at least one keyframe.
>
> However, if the object is a child object, and _only_ the parent has
> keyframes, then the evaluate() call does not return animated data,
> making it look as if the child object is not animated.
>
> If the parent is animated, and the child object contains just a single
> "no-op" keyframe, then evaluate() behaves as expected, returning the
> parent's animation data.
>
> Are we doing things wrong, or is this by design? In either case, is
> there a proper way of handling this, without walking up the tree until
> we find a (grand)parent with animation data?
>
> Cheers
> - Asbjørn
>
> [1]:
> http://src.luxrender.net/luxblend25/file/196744443a50/src/luxrender/export/__init__.py#l274

I wouldn't suggest to attempt to calculate the objects transformation
directly because there are too many influences: constraints, drivers,
vertex parents, bone parents... etc. which can all be animated.

Better use scene.frame_set(frame, subframe), then collect object
matrix data for motion blur.

http://www.blender.org/documentation/blender_python_api_2_65_release/bpy.types.Scene.html#bpy.types.Scene.frame_set

-- 
- Campbell



More information about the Bf-python mailing list