Vizard 8 » Command Index » Vizard objects » effect » <effect>.setProperty
8.0

<effect>.setProperty

Set the value of an effect property

<effect>.setProperty(  
name  
value  
)  
name
Name of property
value
Property value. Value type and size should match type/size defined in effect definition.

Remarks

This command will set the value of the property with the specified name. All node objects which have the effect applied, will also inherit the property value. However, if a uniform with the same name is applied to the node, then it will override the value specified by the effect.

Return Value

None

Example

code = """
Effect "MyEffect" {

    Float MyColor { value 1 0 0 }

    Shader {
        BEGIN Material
        m.diffuse = MyColor;
        END
    }
}
"""
effect = viz.addEffect(code)

effect.setProperty('MyColor',viz.GREEN)

# Model 1 will be green
model1.apply(effect)

# Model 2 will be blue
model2.apply(effect)
model2.setUniformFloat('MyColor',viz.BLUE)

See also

<effect>.getProperty
<node3d>.setUniformBool
<node3d>.setUniformFloat
<node3d>.setUniformInt