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

If ā€œonEditorModificationā€ is implemented you have to either return ā€œfalseā€ (if you want default behaviour to apply the value) otherwise itā€™s expected that you apply the change to your scripts (e.g. if you return nothing like here)

Iā€™ll add code docs for that

okā€¦ but how do i actually react to that? because if i want default deserialization to happen and still do something with the new value, iā€™m too early in this method, right?

by user 395602247196737546

Yes, thereā€™s currently no automatic callback for right after the change has applied - right now you could set some flag dirty in your script and handle it e.g. the next frame or use a timeout. Or you apply the value yourself and then run the code that should react to it

ok, thanks

by user 395602247196737546

maybe thereā€™s a problem with the parent class implementing IEditorModification ?

by user 395602247196737546

ah never mindā€¦ it was some kind of caching/hot reload problem i guess (which i run into pretty often)

by user 395602247196737546

what exactly?

i had this change in place, using hot reload:

    update() {
        console.log(this.visibleEdgeColor);
    }

    onEditorModification(modification: EditorModification): boolean | void | undefined {
        return false;
    }

but it still spewed out the unchanged color. i had to hard-reload the browser and now the value actually changes.

by user 395602247196737546

hmm so the real problem from the beginning was (i think) is that the parent class (PostProcessingEffect) implements IEditorModification?
so we have to overwrite (or override, both works) it with a local implemenation of just return false; to get back the desired behaviour.

by user 395602247196737546

mmh ok so letā€™s recap: you actually just want to have a callback if a property is changes so you can react to it somehow?
have you tried calling the default implementation (super.onEditorModification(modification)) ?

how would that help?

by user 395602247196737546

if i use

    override onEditorModification(modification: EditorModification): boolean | void | undefined {
        return super.onEditorModification(modification);
    }

the changes wonā€™t apply. somehow i have to make sure to return false.

by user 395602247196737546

Changed the channel name: Editor Sync: React to change (especially in subclasses of PostProcessingEffect)

by user 395602247196737546

Ah because they only apply on VolumeParameter types. You could call super and then return false still. Or change the parameter type to a VolumeParameter of the outline effect. All other core effects are built that way too. But i think just returning false might be all you want?

The other question was: would adding a post apply change callback be enough/help?

Is there a reason though for the class to inherit from PostProcessingEffect in the first place? :slightly_smiling_face:

by user 395602247196737546

A post change callback would be great, maybe throw in the EditorModification there as an argument just in case.

by user 395602247196737546

Next version will have that callback (EditorSync 2.0.1-beta)

Yes, it handles setup of VolumeParameters internally and the Volume component adds extra effects to its stack (like the custom outline effect) if they are of type PostProcessingEffect.