Blender.Redraw() method no more available in 2.51 API?

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
mb
Posts: 0
Joined: Mon Feb 22, 2010 10:20 am

Blender.Redraw() method no more available in 2.51 API?

Post by mb » Mon Feb 22, 2010 11:11 am

I am upgrading my old python scripts from Blender 2.49 API to 2.5 API.

In many of them I make use of the Blender.Redraw() method, which is very handy, among others, for making animations directly in the editor environment, rather than in the gamelogic.

Unfortunately I've not found any equivalent method in Blender 2.5, yet.
I would expect something like: bpy.ops.window.redraw(), or similar, to replace the old sintax.

Thanks.

mb

zaphodile
Posts: 0
Joined: Tue Apr 27, 2010 10:31 pm

Post by zaphodile » Tue Jun 01, 2010 7:47 pm

Doesn't anyone know? I'm wondering the same thing.

SL1200
Posts: 0
Joined: Tue Jun 14, 2011 5:36 pm
Location: England

Post by SL1200 » Thu Jun 16, 2011 1:28 pm

Hi, I was looking into this function just now and saw your post.

bpy.ops.wm.redraw_timer()
Simple redraw timer to test the speed of updating the interface

Hope this is what you need.
Everyone I meet is my superior, and being that, they can teach me something new.

jonathan_dowdall
Posts: 0
Joined: Thu Sep 29, 2011 2:18 am

Post by jonathan_dowdall » Thu Sep 29, 2011 2:28 am

Each time the screen needs to be updated use the following:

bpy.ops.render.render()
bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)

mb
Posts: 0
Joined: Mon Feb 22, 2010 10:20 am

Post by mb » Tue Oct 04, 2011 10:35 am

jonathan_dowdall wrote:Each time the screen needs to be updated use the following:
bpy.ops.render.render()
bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)
Thank you: it works but compared to the previous redraw method it seems very slow.
To move the cube 4 blender units along the z-axis I tried this:

Code: Select all

import bpy
from mathutils import Vector
Obj=bpy.data.objects["Cube"]
for p in [1,2,3,4]:
    Obj.location = Obj.location + Vector((0,0,1))
    bpy.ops.render.render()
    bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)
Are there any parameters that can be adjusted to control the refreshing rate?

rylangrayston
Posts: 0
Joined: Tue Jul 29, 2008 10:54 pm

Post by rylangrayston » Wed Jan 11, 2012 8:57 pm

Code: Select all

bpy.ops.render.render()
Is rendering the scene so an easy way to change the speed is simply to
lower the resolution of the render to 1 percent.

By doing that I got my script to redraw the screen about 10 times faster

rylangrayston
Posts: 0
Joined: Tue Jul 29, 2008 10:54 pm

Post by rylangrayston » Mon Jan 16, 2012 2:44 am

Oh and another way to make it go faster is to the hold esc key with your mouse in the 3d window pain... this way is nice because if your render settings are hi then you can change between two speeds while your script is running!

mb
Posts: 0
Joined: Mon Feb 22, 2010 10:20 am

Post by mb » Mon Jan 16, 2012 10:18 am

rylangrayston wrote:Oh and another way to make it go faster...
Thank you for both of your suggestions.
However I have finally abandoned the idea of making animations in the editor environment: I converted my scripts to work in the game engine and now I'm happy with that.

mb

Post Reply