Problems with texture preview extension

Hey there! I am trying to put together an editor extension which should also preview selected texture nodes.

For this I’ve tried a mashup of the “Preview selected nodes and pins” as well the BadCropper extension of BadMapper, but can not get my head around it… why can I get the layer preview in the attached extension, but not the texture? It works when I try to retrieve the texture of the selected node in the extension patch itself.

Also when the extension is open, deleting the texture source it wants to preview leads to vvvv crashing. Any hints very much appreciated!

TexturePreviewApplication.vl (7.5 KB)
TextureFXPreview.HDE.vl (46.4 KB)

TextureFXPreview.HDE-TextureFXPreview-What is going on here

Just found out it works perfectly, when it is placed in the patch using a process node from the documents definitions, also no crashing… but why not from the extension?

TexturePreviewApplicationSamePatch.vl (41.7 KB)

My guess is that the editor extension runs in a different thread (vvvv editor UI) and isn’t allowed to access textures from the application thread (patch application mainloop). also, if you delete the texture source (the owner of the GPU resource) then it will lead to an exception if the preview thread is still accessing it.

i am not sure whether you have access to the patch thread in a UI extension, but my guess would be that you have to patch everything inside the observable region (don’t use HoldLatest) the observable thread might be the patch thread. but I am not sure, atm. You can check that with the CurrentThreadId node.

Thank you, that works. Now I would need to know how to react on if there is a texture available and display some other content if not texture has been selected. Right now the window of course would only open if there is something to display… do you have an idea how to proceed on this?

TextureFXPreview.HDE-TextureFXPreview_2022.06.18-14.39.38

The ManageProcess region can help with that. It allows to create/dispose a stateful context programmatically.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.