[Bf-python] Disco ball tutorial

Willian Padovani Germano wgermano at ig.com.br
Fri Apr 23 06:53:11 CEST 2004


Hi,

----- Original Message -----
From: "Lone Wolf" <lone_wolf at ureach.com>
To: <bf-python at blender.org>
Sent: Thursday, April 22, 2004 4:12 PM
Subject: [Bf-python] Disco ball tutorial

(...)
>                me.update()
>                Blender.Redraw()

Try without the Redraw, me.update already redraws the 3d views.

> I'm still bothered by three things however:
> (1) Each time I run the script, it adds 6 new materials.
> Therefore, if I run it the second time, there are 12 materials,
> and then after that the material list reaches its max (16) and
> the script won't run at all. Is there a way to delete the
> materials at the end of the script ... or at least make sure
> that the same materials aren't created over and over.

Make your script check at start-up if your object already has the 6 materials.
If so, just reuse them.

> (2) It looks like all the faces on the entire mesh are redrawn
> each time a single face is updated. This has to slow things down
> a great deal. Is there a good way to make just the changed face
> update?

Impossible if you want to redraw on each changed face, then any change always
means updating the whole thing.  What you can do is first make all your
changes, then only at the end update the mesh.  If you want it to rotate, one
good way is to make another script to do just that (and maybe also change the
material indices of faces, if you want that effect) and set this script to
FRAMECHANGED on the scriptlink buttons tab.  Then you set-up an animation in
say N frames.

> (3) The ball starts out entirely red (the color of the first
> material), then gradually gets filled in with other colors. Is
> there a way make the ball start out with multi colored faces
> already in place?

First add (or reuse) all colors, before the loop, setting all faces to one of
them.

--
Willian, wgermano at ig.com.br




More information about the Bf-python mailing list