bdunderscore / ndmf

MIT License
71 stars 22 forks source link

Invalidateing `ComputeContext` of `IRenderFilter.Process` does not trigger refresh #259

Closed anatawa12 closed 3 months ago

anatawa12 commented 3 months ago

Invalidateing ComputeContext of IRenderFilter.Process does not trigger refresh.

I tried to implement IRenderFilter for AAO RemoveMesh by Mask but I could not find way to refresh / recreate the mesh.

I added the following code to check if context is invalidated expected time and context is invalidated at expected timing but it looks invalidating the context triggers nothing.

context.OnInvalidate.ContinueWith(_ => Debug.Log("context.OnInvalidate.ContinueWith"));

https://github.com/anatawa12/AvatarOptimizer/blob/209e6e58eeade1c69cbed7878b067914023b854e/Editor/Processors/EditSkinnedMeshComponentRendererFilter.cs

bdunderscore commented 3 months ago

Thanks for the report - I'll take a look probably closer to next weekend - there's a world project I need to work on first unfortunately.

bdunderscore commented 3 months ago

Is this fixed by https://github.com/bdunderscore/ndmf/pull/262 ? I'm not able to reproduce the issue with this change (changes in MaskTextureEditor are immediately applied)

bdunderscore commented 3 months ago

(I'm using your ndmf-preview-system branch)

bdunderscore commented 3 months ago

Nevermind, I was using the wrong branch (two checkouts...). Issue reproed, looking...

bdunderscore commented 3 months ago

The issue appears to be that ObjectChangeEventStream events aren't being issued for your texture edits. This is because they're not registered in the normal unity Undo system (probably for good reason...)

Here's my plan:

bdunderscore commented 3 months ago

Also: ComputeContext isn't using a long-lived object as its target token when being called from PreviewPipeline.

anatawa12 commented 3 months ago

The issue appears to be that ObjectChangeEventStream events aren't being issued for your texture edits. This is because they're not registered in the normal unity Undo system (probably for good reason...)

Not triggering refresh while editing image with texture editor is intended. It does not change the texture on the EditSkinnedMeshComponentRendererFilter component and retrieving intermediate (editing) texture from texture editor is not yet implemented.

Not triggering refresh with save button on texture editor is not intended. It will replace the png file and AssetDatabase.ImportAsset so it should mean NDMF preview system is not triggered on external asset changes I think.


the EditSkinnedMeshComponentRendererFilter will observe the RemoveMeshByMask component so changing the component itself should trigger refresh


I'll try #262

bdunderscore commented 3 months ago

I've reproed the issue locally, so I think I can debug this from here. Thanks for the report!