What I am trying to do is to change the strength of a
light while a script is running.
No responses, so I thought maybe I need to post a complete
working example of the problem... Any hints on how to make
this work appreciated.
## light_intensity.py
import sys, os, os.path, soya
from random import random
soya.init()
soya.path.append(os.path.join(os.path.dirname(sys.argv[0]), "data"))
scene = soya.World()
# plug in the name of some model you have. I just saved the
# Blender default cube as "box.blend" in the tutorial/data/blender
# folder.
model = soya.Shape.get("box")
# uncomment one of these to see different intensities
# of the light ...
#initial_light_constant = 0.1
initial_light_constant = 4
initial_light_constant = 18
class V(soya.Volume):
def __init__(self, scene, model, light):
soya.Volume.__init__(self, scene, model)
self.light = light
def begin_round(self):
pass
# changes light.constant at random intervals
# this is what is not working for me ...
if random() > .99:
if self.light.constant < 1:
self.light.constant = 18
print 'on'
else:
self.light.constant = .1
print 'off'
light = soya.Light(scene)
light.set_xyz(0.5, 6.0, 7.0)
light.constant = initial_light_constant
v = V(scene, model, light)
camera = soya.Camera(scene)
camera.z = 5.0
camera.y = 2.0
soya.set_root_widget(camera)
soya.Idler(scene).idle()
## light_intensity.py
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
_______________________________________________
Soya-user mailing list
Soya-user@gna.org
https://mail.gna.org/listinfo/soya-user