Skip to reading
Shaders, Effects & Layered Scenery

71. Change a room stack or a caller-owned effect

Edition 0.86.4.0

Revised 0.86.4.0 edition with new supplements; earlier 0.86.3.4 lessons and screenshot labels are retained within the supplied PDF.

Download PDFView PDF page

A room-specific shader configuration belongs to the Scene record. In a GDScript record, its registry proxy can set the same fields used by the Inspector. The active room refreshes its environment/post process when those fields change.

Code example
extends PCAScriptBase
Code example
func run() -> void:
    Scene.Get("lab").Set(
        "environment.postProcessOverrideMode", "custom")
    Scene.Get("lab").Set("environment.postProcess", {
        "layers":[{"preset":"sepia","intensity":0.6}],
        "tintStrength":0.0
    })

For a caller-owned object, the shared action API also supports this. For example, an event owned by an authored Heat Haze particle can change its own distortion:

Code example
await ChangeObjectProperty({"entityId":"this",
    "property":"particle.heatDistortion","value":0.0})

The caller is captured from the event context. On a GUI event, this identifies the GUI/calling element context, not the brazier. On an object event, it identifies that object. A standalone script test or cutscene test may have no object caller at all.

Use explicit IDs for cross-object operations. “this” is not a universal substitute for “whatever I last selected in the editor.” It belongs to the running event’s caller.

Page 75 of 93Permalink
Go to page