matyalatte / Blender-DDS-Addon

Blender addon to import and export dds textures
MIT License
71 stars 5 forks source link

After using the export to DDS, Blender freezes when closing. #10

Closed SNamiris closed 1 year ago

SNamiris commented 1 year ago

windows10 blender3.6 If I modify texconv.py to unload the DLL immediately after converting the file, Blender still freezes. Idk if the dll cause the problem? Additionally, when exporting to BC7 sRGB, the color becomes lighter even if the original format is BC7 sRGB. Only if I choose BC7, it works.

matyalatte commented 1 year ago

Thanks for the report. I confirmed it on Blender3.0 and 3.6. This will happen when using GPU via the DLL. I mean, Blender will crash with the unloading after exporting BC6 or BC7 textures. Idk how to fix it for now, but I'll look into it.

when exporting to BC7 sRGB, the color becomes lighter

I noticed texconv required an option to disable the colorspace conversion. I opened a new issue for it and I'll fix it later. https://github.com/matyalatte/Blender-DDS-Addon/issues/11

matyalatte commented 1 year ago

As a workaround, you can disable the unloading like this.

# blender_dds_addon/__init__.py
def unregister():
    """Remove addon."""
    for module in modules:
        module.unregister()
    # unload_texconv()

It's not a good way to fix becuase you can't remove the addon while loading the DLL. You will get an error when uninstalling the addon after using it. But you won't get the crash at least.

SNamiris commented 1 year ago

As a workaround, you can disable the unloading like this.

# blender_dds_addon/__init__.py
def unregister():
    """Remove addon."""
    for module in modules:
        module.unregister()
    # unload_texconv()

It's not a good way to fix becuase you can't remove the addon while loading the DLL. You will get an error when uninstalling the addon after using it. But you won't get the crash at least.

Thank you!It works

matyalatte commented 1 year ago

I fixed the issues. Can you test if it'll work as you expected or not? blender_dds_addon_efad51f_Windows.zip

The crash when closing was fixed at https://github.com/matyalatte/Texconv-Custom-DLL/commit/a9d196f8eda577c633ec29d1ee360968626813ef. The sRGB issue was fixed at 5cf72c1c6751d8072e50cd119d4fd44d3ca4239e. And the addon will release DLL resources after conversion. (0db4c68c6badbe9c7ce779d42c29d91f74353fbd)

SNamiris commented 1 year ago

I fixed the issues. Can you test if it'll work as you expected or not? blender_dds_addon_efad51f_Windows.zip

The crash when closing was fixed at matyalatte/Texconv-Custom-DLL@a9d196f. The sRGB issue was fixed at 5cf72c1. And the addon will release DLL resources after conversion. (0db4c68)

It can't export dds. image It seems the dll doesn't work?

matyalatte commented 1 year ago

Sorry, I updated DirectXTex to the April 2023 release. and it had a bug. I tested it with BC1_UNORM_SRGB and BC7_UNORM when I fixed the sRGB issue. But it won't work with BC7_UNORM_SRGB lol https://github.com/microsoft/DirectXTex/issues/378

So, I updated the library to the September 2023 release.

Can you try the updated version? It should work. blender_dds_addon_9b6d23f_Windows.zip

SNamiris commented 1 year ago

Sorry, I updated DirectXTex to the April 2023 release. and it had a bug. I tested it with BC1_UNORM_SRGB and BC7_UNORM when I fixed the sRGB issue. But it won't work with BC7_UNORM_SRGB lol microsoft/DirectXTex#378

So, I updated the library to the September 2023 release.

Can you try the updated version? It should work. blender_dds_addon_9b6d23f_Windows.zip

It now works with BC7_UNORM_SRGB. Thank you for the quick fix!