Forum: Poser - OFFICIAL


Subject: Working light switch?

gmm2 opened this issue on Mar 14, 2018 ยท 16 posts


KarinaKiev posted Sun, 15 April 2018 at 11:44 AM

A more elegant method would be the "valueOpTimes" function which would even provide you with a dimmer, as well as avoiding the other problems.

First, make sure the light's intensity is set to 1 (=100%)

Then modify the code like this: (lines starting with // are comments and must not be added to the code)

// look for your light and go to the "channels" section:

channels
{
    // groups declarations...
    // and some variables follow...
    // ...
    // you are looking for THIS:
    kdIntensity KdIntensity
    {
        name INTENSITY
        initValue 1  // default value, set this to 1 !
        // some more lines of code, ignore...
        // ...
        keys
        {
            k  0  1  // make sure the second number is 1 which equals 100% brightness
        }
        interpStyleLocked 0
        // now add these four lines, directly below the interpStyleLocked 0:
        valueOpTimes
        _NO_FIG_
        LightSwitch  // *internal* name of your light switch prop
        LightsOn  // *internal* name of your light dial
    }
    //  more code, ignore...
}

When the "LightsOn" dial is at 0.0 the light is OFF.

When it's at 0.5 the light is at 50% brightness, and ON

When it's at 1.0 the light is at 100% brightness, and ON

When it's at 1.5 the light is at 150% brightness, and ON

etc.


Maximum flexibility, ease of use.

Cheers!

K