Editor Sync: React to change (especially in subclasses of PostProcessingEffect)

Hi @marcel :cactus: , is there maybe a callback after a change was synced?

Original Post on Discord

by user 395602247196737546

Hi, I think so but I have to check again how it was called. Maybe take a look at the Volume component in the meantime, it does some custom handling

implements IEditorModificationReceiver

by user 395602247196737546

Does that help you?

kind of :slightly_smiling_face:

by user 395602247196737546

i guess it’s more complicated as i’m trying to update the color of the outline (based on the script you posted here: Discord

by user 395602247196737546

now i got the callback working but the outline color is not updating

by user 395602247196737546

this is what i’ve tried so far:

    onEditorModification(modification: EditorModification): boolean | void | undefined {
        if(this._outlineEffect == null)
            return;

        this._outlineEffect.edgeStrength = this.edgeStrength;
        this._outlineEffect.visibleEdgeColor.set(this.visibleEdgeColor);
        this._outlineEffect.hiddenEdgeColor.set(this.hiddenEdgeColor);

        super.unapply();
        super.apply();
    }

by user 395602247196737546

(don’t know if i have to call (un)apply, i’m just poking things here :slightly_smiling_face: )

by user 395602247196737546

apply etc shouldnt be necessary.

oh i see now the change does not really apply

by user 395602247196737546

maybe it’s because of how i declared the color

by user 395602247196737546

    @serializable(Color)
    visibleEdgeColor: Color = new Color(0, 0, 1.0);

by user 395602247196737546

works when saving the scene but now with the editor sync

by user 395602247196737546

Are you sure the code above is running?

console.log logs

by user 395602247196737546

(logs the unchanged color value)

by user 395602247196737546

RGBAColor {isColor: true, r: 0.8562991, g: 0.2566947, b: 0, alpha: 1}

by user 395602247196737546

ok it only works if i apply the modification manually:

        this[modification.propertyName] = modification.value; 

this can’t be intentionally though?

by user 395602247196737546

outline still does not actually change its appearance, but at least the value gets propagated now :slightly_smiling_face:

by user 395602247196737546