Creates a profile controller for a View.
The supplied profiles are cloned before storage. If
activeProfile is supplied, it is
activated through the normal transition path, including closed-world
enabled handling and restore-state capture.
View to control.
Initial profile registry and optional active profile.
ReadonlyviewView whose effect and lighting components are controlled by this
ViewProfiles instance.
ID of the currently active profile, or null when no profile is active.
This is read-only because profile activation can fail. Use setActiveProfile to change it and inspect the returned SDKResult.
Adds a profile.
The operation validates all referenced effects and properties before mutating the registry. The profile is cloned before storage.
New profile ID. Must be a non-empty string.
Profile definition.
An SDKResult containing validation or duplicate-ID errors.
Replaces this instance's serializable configuration from plain params.
Profiles and the requested active profile are validated before existing state is cleared. If validation succeeds, current profile ownership is cleared, the registry is replaced, and the requested active profile is activated through setActiveProfile.
Runtime restore values and external override state are not accepted from params; they are recomputed for the current View.
Serializable profile configuration.
An SDKResult containing validation or activation errors.
Gets a cloned profile definition.
Mutating the returned object does not affect this instance. Use setProfile to replace a profile.
Profile ID.
A cloned profile, or undefined when the ID is not registered.
Returns true when a profile with the given ID is registered.
Profile ID.
Removes a profile.
Removing the active profile clears profile control first, restoring all
currently managed properties to their underlying runtime values, then
leaves activeProfile as null.
Profile ID.
An SDKResult containing not-found or validation errors.
Activates a profile or clears profile control.
Passing null restores all state currently owned by ViewProfiles and
leaves the View without an active profile. Passing an ID applies that
profile as a single diff: properties already controlled by both profiles
transition directly to their new values, removed properties are restored,
new properties capture restore values, and redundant setter calls are
avoided.
While a profile is active, only effects explicitly configured with
enabled: true remain enabled. Omitted effects, and effects without
enabled: true, are disabled.
Profile ID to activate, or null to clear.
An SDKResult containing not-found or validation errors.
Creates or replaces a profile.
When replacing the active profile, the live View is transitioned using the same diff machinery as setActiveProfile. Runtime overrides made through setProperties remain in effect unless the replaced profile explicitly changes that same property, in which case the profile reclaims control of that property.
Profile ID. Must be a non-empty string.
New profile definition.
An SDKResult containing validation errors, if any.
Writes effect properties as explicit runtime state.
This accepts the same shape as a profile but does not mutate profile definitions. If a written property is currently profile-managed, its restore value is updated and the live property is marked as externally overridden for the current activation. Subsequent unrelated active-profile edits will not reapply the old profile value; a transition to another profile, or an edit to that exact active-profile property, can reclaim profile control.
The full batch is validated before any effect is mutated.
Sparse effect-property map to write.
An SDKResult containing validation errors, if any.
Serializes profile definitions and the active profile ID.
The returned profile definitions are cloned. Runtime restore state, effect object references and external override bookkeeping are not serialized.
An SDKResult whose value can be passed to
fromParams for the same View context or to a new
ViewProfiles instance for another View.
Controls named rendering profiles on a View.
ViewProfilesis the runtime owner of profile-based render state for one View. It coordinates effect components, lighting components and rendering controls from a single symbolic profile ID, without adding render-mode logic to the View or to individual effects.Profiles are sparse two-level property maps. The first key identifies a profileable View component, such as
sao,iblortonemap; the nested keys are writable properties on that component. This lets each profile express only the properties it cares about while leaving unrelated runtime state alone.When a profile is active,
enabledhas closed-world semantics. An effect is enabled only when the active profile explicitly contains{enabled: true}for that effect. Other properties remain sparse overrides: omitted properties are left outside profile control and are restored when profile ownership ends.The class tracks only properties it has taken over. When switching profiles, it computes a single transition: removed properties are restored, newly controlled properties capture restore values, shared properties transition directly to their new profile values, and redundant setter calls are avoided. Calls to setProperties can explicitly override the current live value without mutating the active profile definition.
Use setActiveProfile to switch profiles when callers need structured failure reporting. The active profile ID is exposed as a read-only property for queries.
Example