Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes when Batch importing textures. #330

Open
NikolasL015 opened this issue May 3, 2024 · 10 comments
Open

Crashes when Batch importing textures. #330

NikolasL015 opened this issue May 3, 2024 · 10 comments
Labels
bug Something isn't working

Comments

@NikolasL015
Copy link

I'm using the nightly version, but it still crashes every time I try to import multiple textures2d at once (all the texture names are correct).

LOG:
Plugin Batch import textures has crashed. Stacktrace:
System.InvalidOperationException: Target width 0 and height 0 must be greater than zero.
at SixLabors.ImageSharp.Processing.Processors.Transforms.ResizeHelper.ThrowInvalid(String message)
at SixLabors.ImageSharp.Processing.Processors.Transforms.ResizeHelper.CalculateTargetLocationAndBounds(Size sourceSize, ResizeOptions options)
at SixLabors.ImageSharp.Processing.Processors.Transforms.ResizeProcessor..ctor(ResizeOptions options, Size sourceSize)
at SixLabors.ImageSharp.Processing.ResizeExtensions.Resize(IImageProcessingContext source, ResizeOptions options)
at TexturePlugin.TextureEncoderDecoder.<>c__DisplayClass9_0.b__0(IImageProcessingContext i)
at TexturePlugin.TextureEncoderDecoder.Encode(Image1 image, Int32 width, Int32 height, TextureFormat format, Int32 quality, Int32 mips) at TexturePlugin.TextureImportExport.Import(Image1 image, TextureFormat format, Int32& width, Int32& height, Int32& mips, UInt32 platform, Byte[] platformBlob)
at TexturePlugin.TextureImportExport.Import(String imagePath, TextureFormat format, Int32& width, Int32& height, Int32& mips, UInt32 platform, Byte[] platformBlob)
at TexturePlugin.ImportTextureOption.ImportTextures(Window win, List1 batchInfos) at TexturePlugin.ImportTextureOption.ExecutePlugin(Window win, AssetWorkspace workspace, List1 selection)
at UABEAvalonia.PluginWindow.BtnOk_Click(Object sender, RoutedEventArgs e) in D:\a\UABEA\UABEA\UABEAvalonia\PluginWindow.axaml.cs:line 53

@NikolasL015 NikolasL015 added the bug Something isn't working label May 3, 2024
@nesrak1
Copy link
Owner

nesrak1 commented May 3, 2024

The code that's having the exception is the mipmapping code trying to scale your image down to 0. However, there's a lot of checks to make sure the image you're importing can be mipmapped. Are you sure you don't actually have a 0x0 image you're importing?

@NikolasL015
Copy link
Author

The code that's having the exception is the mipmapping code trying to scale your image down to 0. However, there's a lot of checks to make sure the image you're importing can be mipmapped. Are you sure you don't actually have a 0x0 image you're importing?

I exported all the textures and modified some of them again, seems to work now. I think one of my old textures was bugged when I saved it in Photoshop.
But I have another issue: when I try to import more than 50 modified textures, the program freezes (not responding) forever, is it due to my CPU? (2,9 ghz, 6 cores and 12 threads)

@nesrak1
Copy link
Owner

nesrak1 commented May 5, 2024

It might just be taking a while. Encoding is definitely slower than decoding. The texture import/export doesn't have a progress bar, but it's probably a good idea to add one in a future update.

@NikolasL015
Copy link
Author

It might just be taking a while. Encoding is definitely slower than decoding. The texture import/export doesn't have a progress bar, but it's probably a good idea to add one in a future update.

I went to sleep to see if it was just slow, but it was still not responding when I woke up after 9 hours. (I've tried it many times.). Then I asked a friend of mine (who has a better CPU than mine) to try it, and he did it with 80 textures, but when he tried to import more than 100, the program froze too.

@nesrak1
Copy link
Owner

nesrak1 commented May 12, 2024

I'll have to make a big bundle to test on, but 9 hours definitely isn't right. Is it at max cpu the whole time? How big are the textures you're trying to import? I don't think the code could get stuck in a loop after importing too many textures.

@NikolasL015
Copy link
Author

NikolasL015 commented May 12, 2024

I'll have to make a big bundle to test on, but 9 hours definitely isn't right. Is it at max cpu the whole time? How big are the textures you're trying to import? I don't think the code could get stuck in a loop after importing too many textures.

It uses the maximum CPU in just a fraction of time; all the textures were 512x512.
image
image

@nesrak1
Copy link
Owner

nesrak1 commented May 14, 2024

Can you check what texture format they are? I can't reproduce this with DXT5 images. Ten 2048x2048 images import in one second on my computer with a slightly worse CPU than the one in your screenshot.

@NikolasL015
Copy link
Author

Can you check what texture format they are? I can't reproduce this with DXT5 images. Ten 2048x2048 images import in one second on my computer with a slightly worse CPU than the one in your screenshot.

All of them are PNG. I managed to import ten 2048x2048 images too, but my problem is when I try to import more than 50–80.

PS: My 2048x2048 image imports took longer than yours, but it worked. (ten textures)
And it used the maximum CPU the whole time, unlike my previous screenshot.
image

@nesrak1
Copy link
Owner

nesrak1 commented May 14, 2024

What texture format are the textures? Not like png, but like RGBA32 or DXT5. Single selecting a texture and clicking plugins -> edit texture will show this.

@NikolasL015
Copy link
Author

What texture format are the textures? Not like png, but like RGBA32 or DXT5. Single selecting a texture and clicking plugins -> edit texture will show this.

Oh sorry, all the textures are ASTC_RGB_8x8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants