[Bf-committers] bpy.context.scene.frame_set(i) issue

Campbell Barton ideasman42 at gmail.com
Sat Jan 21 00:58:15 CET 2012


Hi Bartek,

Would you be able to upload a test scene which is unusably slow?
can't see why this would be any slower then playing back the animation
(if anything should be faster since it doesn't have to draw).

On Sat, Jan 21, 2012 at 9:58 AM, Bartek Skorupa
<bartekskorupa at bartekskorupa.com> wrote:
> Hi,
>
> I'd like to draw your attention to frame_set(i) method.
> In many scripts we have to refresh the scene several times, sometimes
> we need to collect some data for every frame in the whole animation.
> In such cases the only way I know in blender's python is to set the
> frame using bpy.context.scene.frame_set(frame)
> Almost every exporter that base on baking the data and exporting them
> as "keyframe for every frame" use this kind of loop:
>
> start = bpy.context.scene.frame_start
> end = bpy.context.scene.frame_end
> for frame in range (start, end + 1):
>     bpy.context.scene.frame_set(frame)
>     '''
>     .... all the magic that needs data for each frame ....
>     '''
>
> My exporter to Adobe After Effects (io_export_after_effects.py) does
> exactly the same.
>
> The issue here is that setting the frame sometimes takes ages.
> I was once advised to use bpy.context.frame_current = frame
> Well... It's very fast, but doesn't do the trick. It sets the frame,
> but doesn't update the scene and in most cases - this is what we want
> - We want to have our scene refreshed for every frame.
>
> bpy.context.scene.frame_set(frame) method is so slow, that many
> exporters become almost useless or if not useless - very badly
> perceived because of their performance.
> The process of simple export to After Effects can sometimes take
> several minutes and this is definitely not the performance we are
> looking for.
> I looked through many existing exporters and they all use this method,
> so I suppose I'm not the only one facing "frame_set" speed issue.
> Does anyone know other method to achieve refreshing the scene for
> every frame, but not that slow?
>
> Isn't this performance a bug of some kind?
>
> I'd appreciate any help.
>
> Cheers,
> Bartek Skorupa
>
> www.bartekskorupa.com
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers



-- 
- Campbell


More information about the Bf-committers mailing list