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

Changing the 'Import As' of a PNG file to 'AtlasTexture' not working cleanly post 4.2 #85892

Open
LakshayaG73 opened this issue Dec 7, 2023 · 2 comments · May be fixed by #85977
Open

Changing the 'Import As' of a PNG file to 'AtlasTexture' not working cleanly post 4.2 #85892

LakshayaG73 opened this issue Dec 7, 2023 · 2 comments · May be fixed by #85977

Comments

@LakshayaG73
Copy link

LakshayaG73 commented Dec 7, 2023

Tested versions

Reproducible in 4.2

System information

Windows 10 - Godot 4.2

Issue description

In 4.1, changing the 'Import as' of a Texture to an AtlasTexture, would restart the editor, and everything would work post restart.

Now, doing this does not restart the editor, and the new atlas file does not show up in the filesystem until a forced restart.

Post restart, the atlas file shows up, but any place the Texture was used pre change of 'Import as' gets corrupted, and you have to remake the animations.

Steps to reproduce

  1. Import few png images into a fresh project
  2. Create an AnimatedSprite node, and add these png images into an animation
  3. Select all the png images, and change the 'Import As' to 'AtlasTexture', and follow the remaining steps to do so
  4. The images will no longer be visible with the node, and post editor restart, the sprite frames resource will have no images in it.

Minimal reproduction project (MRP)

It will only reproduce once. Difficult to create an MRP.

Edit(lyuma): MRP was attached by KoBeWi to #85977 : https://github.com/godotengine/godot/files/13625635/AtlasTest.zip
Instructions: "Select both icon files and change import type to TextureAtlas, then save the scene."

@clayjohn
Copy link
Member

clayjohn commented Dec 7, 2023

CC @KoBeWi This is likely a result of #78890

@akien-mga akien-mga added this to the 4.3 milestone Dec 8, 2023
@KoBeWi
Copy link
Member

KoBeWi commented Dec 8, 2023

Ok so
The bug is caused by SpriteFrames' textures being inside an array. The replacing method does not check inside arrays and thus the old resource is not replaced.
You can workaround the bug by not saving the scene after reimport. Instead you should reload it, or better, don't have it opened.

The file not appearing can be fixed by calling scan(), but for whatever reason this does not prevent some errors from being printed (about a missing file).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants