Forum: Vue


Subject: Proof of concept - Ecosystem of lights

yggdrasil opened this issue on Mar 29, 2005 ยท 19 posts


yggdrasil posted Wed, 30 March 2005 at 6:36 PM

At the moment the script is set up as a callback at the start of each frame render.

Simply rearranging it to:

T = ObjectByName("T1")
Eco = GetEcosystemOnObject(T)
strong = 20
for i in range(0, Eco.GetInstanceCount()):
        pos = Eco.GetInstancePosition(i)
        l1 = AddPointLight()
        l1.SetPosition(pos[0],pos[1],pos[2]+27)
        l1.SetPower(strong)

means that it will run just once when loaded, creating the lights immediately. If you then modified the ecosystem you would have to remove the lights and rerun the script

Alternatively, for an animated ecosystem (candles bobbing in the waves?) a few lines of code could be added to erase the existing light set before recreating the new one.

def pyLightsCallback(k):
        T = ObjectByName("T1")
        Eco = GetEcosystemOnObject(T)
        strong = 20
        DeselectAll()
        SelectByType(VuePython.VUEBasicObject.VOT_PointLight)
        Delete()
        for i in range(0, Eco.GetInstanceCount()):
                pos = Eco.GetInstancePosition(i)
                l1 = AddPointLight()
                l1.SetPosition(pos[0],pos[1],pos[2]+27)
                l1.SetPower(strong)
<br></br>T = ObjectByName("T1")
T.SetInitFrameCallback(pyLightsCallback)

--

Mark

Message edited on: 03/30/2005 18:38

Mark