viniciusgerevini / godot-aseprite-wizard

Godot Editor plugin to help import Aseprite animations to AnimationPlayers, AnimatedSprites and SpriteFrames.
MIT License
873 stars 42 forks source link

Sprite is black #40

Closed Farnoway closed 1 year ago

Farnoway commented 2 years ago

Hello! I have been using aseprite wizard for a while now, but I have never seen anything like this. When I run my game on Godot, the player looks great, as it should be: image But when I export the game, it looks like this: image Im still trying to see what I did wrong this time with the addon, because this is the first time that this has happened to me.

viniciusgerevini commented 2 years ago

Hello @Farabry . I see you closed the issue. Did you find what was the problem?

markman4897 commented 2 years ago

@viniciusgerevini I got the same problem with one specific project. If I start a new project and add Aseprite Wizard it works fine, but while trying to port over files from the project with the problem to the new project I just can't seem to figure out when exactly this problem starts occurring. I can describe this here or open another issue and add the project files too.

tavurth commented 2 years ago

Also ran into this just now, can we re-open this at least until we have a fix?

Godot Engine v3.4.1.stable.official.aa1b95889 - https://godotengine.org
OpenGL ES 3.0 Renderer: Intel(R) Iris(TM) Plus Graphics 655
OpenGL ES Batching: ON

ERROR: Condition "!f" is true. Returned: ERR_CANT_OPEN
   at: _load_data (scene/resources/texture.cpp:466)

I will post any updates here when I find the issue.

Exporting in debug mode is not working either.

I've added *.json, *.aseprite to my export resources.

tavurth commented 2 years ago

While exporting via command line I see the following errors:

WARNING: Loaded resource as image file, this will not work on export: 'res://icon.png'. Instead, import the image file as an Image resource and load it normally as a resource.
     at: load (core/image.cpp:2051)
ERROR: Condition "_first != nullptr" is true.
   at: ~List (./core/self_list.h:108)
ERROR: Condition "_first != nullptr" is true.
   at: ~List (./core/self_list.h:108)

Here's my export script:

#!/usr/bin/env bash
set -euo pipefail

NAME=SomeChristmassyName
DIRECTORY=~/src/$NAME

/Applications/Godot.app/Contents/MacOS/Godot $@ --no-window --export "Mac OSX" $DIRECTORY/build/$NAME.dmg
VOLUME=$(hdiutil attach $DIRECTORY/build/$NAME.dmg | grep Volumes | awk '{print $3}')
cp -r /Volumes/$NAME/$NAME.app /Applications/
hdiutil detach $VOLUME

And here's the full --verbose export log:

```log ./scripts/dmg_install.sh --verbose arguments 0: /Applications/Godot.app/Contents/MacOS/Godot 1: --verbose 2: --no-window 3: --export 4: Mac OSX 5: /Users/will/src/SomeChristmassyName/build/SomeChristmassyName.dmg Current path: /Users/will/src/SomeChristmassyName Godot Engine v3.4.1.stable.official.aa1b95889 - https://godotengine.org Using GLES3 video driver OpenGL debugging not supported! OpenGL ES 3.0 Renderer: Intel(R) Iris(TM) Plus Graphics 655 OpenGL ES Batching: ON OPTIONS max_join_item_commands 16 colored_vertex_format_threshold 0.25 batch_buffer_size 16384 light_scissor_area_threshold 1 item_reordering_lookahead 4 light_max_join_items 32 single_rect_fallback False debug_flash False diagnose_frame False CoreAudio: detected 2 channels CoreAudio: audio buffer frames: 512 calculated latency: 11ms Registered camera FaceTime HD Camera (Built-in) with id 1 position 0 at index 0 CORE API HASH: 12461884959532474959 EDITOR API HASH: 15668074122588975766 Loading resource: res://default_env.tres Construct gdnative interface Destruct gdnative interface Class 'BulletPhysicsDirectBodyState' is not exposed, skipping. Class 'BulletPhysicsDirectSpaceState' is not exposed, skipping. Class 'BulletPhysicsServer' is not exposed, skipping. Class 'GDScriptNativeClass' is not exposed, skipping. Class 'IP_Unix' is not exposed, skipping. Class 'InputDefault' is not exposed, skipping. Class 'Physics2DDirectBodyStateSW' is not exposed, skipping. Class 'Physics2DDirectSpaceStateSW' is not exposed, skipping. Class 'Physics2DServerSW' is not exposed, skipping. Class 'ResourceImporterMP3' is not exposed, skipping. Class 'ResourceImporterOGGVorbis' is not exposed, skipping. Loading resource: /Users/will/Library/Application Support/Godot/editor_settings-3.tres EditorSettings: Load OK! Loaded builtin certs Socket error: 48 Failed to bind socket. EditorSettings: Save OK! Loading resource: res://addons/AsepriteWizard/plugin.gd Loading resource: res://addons/AsepriteWizard/ASWizardWindow.tscn Loading resource: res://addons/AsepriteWizard/first_options_window.gd Loading resource: res://addons/AsepriteWizard/config_dialog.tscn Loading resource: res://addons/AsepriteWizard/config_dialog.gd Loading resource: res://addons/AsepriteWizard/aseprite_cmd.gd Loading resource: res://addons/AsepriteWizard/import_plugin.gd export: begin: Exporting for OSX steps: 3 export: step 0: Creating app Exporting to /Users/will/Library/Caches/Godot/SomeChristmassyName.app Creating /Users/will/Library/Caches/Godot/SomeChristmassyName.app/Contents/MacOS Creating /Users/will/Library/Caches/Godot/SomeChristmassyName.app/Contents/Frameworks Creating /Users/will/Library/Caches/Godot/SomeChristmassyName.app/Contents/Resources ADDING: Contents/MacOS/SomeChristmassyName size: 72940544 WARNING: Loaded resource as image file, this will not work on export: 'res://icon.png'. Instead, import the image file as an Image resource and load it normally as a resource. at: load (core/image.cpp:2051) ADDING: Contents/Resources/icon.icns size: 386227 ADDING: Contents/Info.plist size: 1471 ADDING: Contents/PkgInfo size: 9 export: step 1: Making PKG savepack: begin: Packing steps: 102 savepack: step 2: Storing File: res://MainMenu.gdc savepack: step 4: Storing File: res://MainMenu.tscn savepack: step 7: Storing File: res://addons/AsepriteWizard/ASWizardWindow.tscn savepack: step 10: Storing File: res://addons/AsepriteWizard/aseprite_cmd.gdc savepack: step 13: Storing File: res://addons/AsepriteWizard/config_dialog.gdc savepack: step 16: Storing File: res://addons/AsepriteWizard/config_dialog.tscn savepack: step 19: Storing File: res://addons/AsepriteWizard/first_options_window.gdc savepack: step 22: Storing File: res://addons/AsepriteWizard/import_plugin.gdc savepack: step 25: Storing File: res://addons/AsepriteWizard/plugin.gdc savepack: step 28: Storing File: res://default_env.tres savepack: step 31: Storing File: res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex savepack: step 31: Storing File: res://icon.png.import savepack: step 34: Storing File: res://player/EntryRequest.tscn savepack: step 37: Storing File: res://player/Player.gdc savepack: step 40: Storing File: res://player/Player.tscn savepack: step 43: Storing File: res://.import/SantaFrames.aseprite-18b09aab57c7434c53861c0212981462.res savepack: step 43: Storing File: res://player/animations/SantaFrames.aseprite.import savepack: step 46: Storing File: res://player/animations/SantaFrames.json savepack: step 49: Storing File: res://.import/SantaFrames.png-be9298ad7cd3f89d58de901068bf9705.stex savepack: step 49: Storing File: res://player/animations/SantaFrames.png.import savepack: step 52: Storing File: res://player/animations/SantaFrames.res savepack: step 54: Storing File: res://.import/SantaSprite.png-21ee04dddb085d450293b16e95fd6ed0.stex savepack: step 54: Storing File: res://player/animations/SantaSprite.png.import savepack: step 57: Storing File: res://.import/HowComplexIsTheGame.png-abd55807854eba8dcde172628296fbcc.stex savepack: step 57: Storing File: res://reference/HowComplexIsTheGame.png.import savepack: step 60: Storing File: res://.import/Lighting.jpg-57f8be8a2390db0f70dba809af4808d2.stex savepack: step 60: Storing File: res://reference/Lighting.jpg.import savepack: step 63: Storing File: res://.import/ManyRoomsIdea.jpg-23835674710c18c1b8947ed245baa3b7.stex savepack: step 63: Storing File: res://reference/ManyRoomsIdea.jpg.import savepack: step 66: Storing File: res://.import/SpaceIdea.png-b691ccc8c31d08157200dd9af4c2249d.stex savepack: step 66: Storing File: res://reference/SpaceIdea.png.import savepack: step 69: Storing File: res://.import/Style.jpg-2a1ba777db1042d99d889c365cc5af86.stex savepack: step 69: Storing File: res://reference/Style.jpg.import savepack: step 72: Storing File: res://worlds/Factory.tscn savepack: step 75: Storing File: res://.import/Rooftop.png-634556bb8574b0748ebd130591014c67.stex savepack: step 75: Storing File: res://worlds/Rooftop.png.import savepack: step 78: Storing File: res://worlds/Rooftop.tres savepack: step 81: Storing File: res://worlds/cabin/ChimneyEntry.gdc savepack: step 84: Storing File: res://worlds/cabin/FactoryEntry.gdc savepack: step 87: Storing File: res://.import/cabin.png-cc7275a5433f5abb7657804580f7111b.stex savepack: step 87: Storing File: res://worlds/cabin/cabin.png.import savepack: step 90: Storing File: res://worlds/cabin/inside/ToOutside.gdc savepack: step 93: Storing File: res://.import/inside.jpeg-6048ec6085d9a285e4e5a1b79a602a11.stex savepack: step 93: Storing File: res://worlds/cabin/inside/inside.jpeg.import savepack: step 96: Storing File: res://worlds/cabin/inside/inside.tscn savepack: step 99: Storing File: res://worlds/cabin/outside.tscn savepack: step 102: Storing File: res://MainMenu.gd.remap savepack: step 102: Storing File: res://addons/AsepriteWizard/aseprite_cmd.gd.remap savepack: step 102: Storing File: res://addons/AsepriteWizard/config_dialog.gd.remap savepack: step 102: Storing File: res://addons/AsepriteWizard/first_options_window.gd.remap savepack: step 102: Storing File: res://addons/AsepriteWizard/import_plugin.gd.remap savepack: step 102: Storing File: res://addons/AsepriteWizard/plugin.gd.remap savepack: step 102: Storing File: res://player/Player.gd.remap savepack: step 102: Storing File: res://worlds/cabin/ChimneyEntry.gd.remap savepack: step 102: Storing File: res://worlds/cabin/FactoryEntry.gd.remap savepack: step 102: Storing File: res://worlds/cabin/inside/ToOutside.gd.remap savepack: step 102: Storing File: res://icon.png savepack: step 102: Storing File: res://project.binary savepack: end export: step 2: Code signing bundle codesign (/Users/will/Library/Caches/Godot/SomeChristmassyName.app/Contents/MacOS/SomeChristmassyName): /Users/will/Library/Caches/Godot/SomeChristmassyName.app/Contents/MacOS/SomeChristmassyName: replacing existing signature /Users/will/Library/Caches/Godot/SomeChristmassyName.app/Contents/MacOS/SomeChristmassyName: signed app bundle with Mach-O universal (x86_64 arm64) [com.santavsmafia] export: step 3: Making DMG hdiutil returned: created: /Users/will/src/SomeChristmassyName/build/SomeChristmassyName.dmg export: step 3: Code signing DMG codesign (/Users/will/src/SomeChristmassyName/build/SomeChristmassyName.dmg): /Users/will/src/SomeChristmassyName/build/SomeChristmassyName.dmg: signed [] export: end EditorSettings: Save OK! ERROR: Condition "_first != nullptr" is true. at: ~List (./core/self_list.h:108) ERROR: Condition "_first != nullptr" is true. at: ~List (./core/self_list.h:108) WARNING: ObjectDB instances leaked at exit (run with --verbose for details). at: cleanup (core/object.cpp:2064) Leaked instance: GDScript:19390 - Resource path: res://addons/AsepriteWizard/aseprite_cmd.gd Leaked instance: GDScriptNativeClass:685 Leaked instance: Node:19404 - Node name: Hint: Leaked instances typically happen when nodes are removed from the scene tree (with `remove_child()`) but not freed (with `free()` or `queue_free()`). ERROR: Resources still in use at exit (run with --verbose for details). at: clear (core/resource.cpp:417) Resource still in use: res://addons/AsepriteWizard/aseprite_cmd.gd (GDScript) Orphan StringName: duration Orphan StringName: min_duration Orphan StringName: compile Orphan StringName: options Orphan StringName: res://addons/AsepriteWizard/aseprite_cmd.gd Orphan StringName: push_back Orphan StringName: anim_name Orphan StringName: get_value Orphan StringName: scan Orphan StringName: create_resource Orphan StringName: data Orphan StringName: exception_pattern Orphan StringName: dir_exists Orphan StringName: meta Orphan StringName: create_from_image Orphan StringName: frame Orphan StringName: from Orphan StringName: get_as_text Orphan StringName: ERR_ASEPRITE_EXPORT_FAILED Orphan StringName: create_sprite_frames_from_aseprite_layers Orphan StringName: ERR_OUTPUT_FOLDER_NOT_FOUND Orphan StringName: search Orphan StringName: has_cached Orphan StringName: take_over_path Orphan StringName: _import Orphan StringName: _loop_config_prefix Orphan StringName: set_animation_loop Orphan StringName: push_front Orphan StringName: create_sprite_frames_from_aseprite_file Orphan StringName: sprite_sheet Orphan StringName: frameTags Orphan StringName: new Orphan StringName: remove Orphan StringName: GDScriptNativeClass Orphan StringName: _scan_filesystem Orphan StringName: EditorFileSystem Orphan StringName: trim_suffix Orphan StringName: add_frame Orphan StringName: READ Orphan StringName: config_file Orphan StringName: default_cmd Orphan StringName: SUCCESS Orphan StringName: get_file Orphan StringName: init Orphan StringName: add_animation Orphan StringName: texture Orphan StringName: _is_aseprite_command_valid Orphan StringName: split Orphan StringName: path Orphan StringName: _aseprite_list_layers Orphan StringName: h Orphan StringName: w Orphan StringName: x Orphan StringName: y Orphan StringName: ERR_INVALID_ASEPRITE_SPRITESHEET Orphan StringName: ERR_SOURCE_FILE_NOT_FOUND Orphan StringName: only_visible Orphan StringName: sprite_frames Orphan StringName: _create_atlastexture_from_frame Orphan StringName: FLAG_REPLACE_SUBRESOURCE_PATHS Orphan StringName: execute Orphan StringName: get Orphan StringName: begins_with Orphan StringName: get_basename Orphan StringName: slice Orphan StringName: _get_file_basename Orphan StringName: open Orphan StringName: _aseprite_export_layers_spritesheet Orphan StringName: invert Orphan StringName: direction Orphan StringName: _get_min_duration Orphan StringName: _get_frames_from_content Orphan StringName: output_folder Orphan StringName: data_file Orphan StringName: _calculate_fps Orphan StringName: file_path Orphan StringName: set_animation_speed Orphan StringName: content Orphan StringName: to Orphan StringName: default_command Orphan StringName: ERR_ASEPRITE_CMD_NOT_FOUND Orphan StringName: has Orphan StringName: ERR_NO_VALID_LAYERS_FOUND Orphan StringName: Node Orphan StringName: editor_file_system Orphan StringName: length Orphan StringName: file_system Orphan StringName: save Orphan StringName: _aseprite_command Orphan StringName: file_exists Orphan StringName: ERR_UNKNOWN_EXPORT_MODE Orphan StringName: _is_valid_aseprite_spritesheet Orphan StringName: _aseprite_export_spritesheet Orphan StringName: empty Orphan StringName: _parse_texture_path Orphan StringName: frames Orphan StringName: name Orphan StringName: config Orphan StringName: image Orphan StringName: source_file Orphan StringName: _get_exception_layers Orphan StringName: atlas Orphan StringName: ConfigFile Orphan StringName: layer_name Orphan StringName: load Orphan StringName: frame_data Orphan StringName: FILE_EXPORT_MODE Orphan StringName: _init Orphan StringName: substr Orphan StringName: size Orphan StringName: _aseprite_export_layer Orphan StringName: _add_ignore_layer_arguments Orphan StringName: replace Orphan StringName: get_extension Orphan StringName: LAYERS_EXPORT_MODE Orphan StringName: GDScript Orphan StringName: _add_animation_frames Orphan StringName: _create_sprite_frames_with_animations Orphan StringName: file_name Orphan StringName: has_section_key Orphan StringName: remove_animation Orphan StringName: _is_loop_config_enabled Orphan StringName: region Orphan StringName: _should_check_file_system Orphan StringName: values Orphan StringName: arguments StringName: 126 unclaimed string names at exit. "disk2" ejected. ```
tavurth commented 2 years ago

Interestingly when I culled out the addons directory from my export the project is now working, but only when run from the command line. When I run the app directly (OSX) the sprite is still black.

Here is the output from running in GUI mode (using Mac Automator)

Screenshot 2021-12-20 at 22 05 39

Which points us here: https://github.com/godotengine/godot/blob/3.4/scene/resources/texture.cpp#L466

So maybe the file is not getting added correctly to the export.

tavurth commented 2 years ago

Ok, what fixed it for me was choosing the following style export settings:

Screenshot 2021-12-20 at 22 10 08

Perhaps for some reason the .res file or the .png file are not getting required properly by the AnimatedSprite?

tavurth commented 2 years ago

Can we open this issue again? @viniciusgerevini

viniciusgerevini commented 2 years ago

Hello @tavurth . Thanks for reaching out. As you are dealing with .res files I guess you are using the wizard screen to import your animations, right?

The wizard screen embeds the png as part of the resource, so the external png file shouldn't even be required for it to work.

I tried to simulate this issue a few times, but I couldn't make it (classic works on my machine). Would you be able to provide a simple project where this issue happens?

tavurth commented 2 years ago

@viniciusgerevini Yes sure I can provide my current sources for a Christmassy game I'm working on, I'll send them over to your email address rather than posting here directly.

viniciusgerevini commented 2 years ago

Thanks @tavurth . As I mentioned in the email, I've done a few tests and they all worked . 1 - Exported a MacOS build from a Linux machine (already setup). 2 - Exported a Linux build from a Linux machine (already setup). 3 - Exported a MacOS build from a MacOS machine. (had warnings on Godot startup due to Aseprite not being configured, worked in a next clean run) 4 - Exported using your script via CLI from a MacOS machine. I've got the same warnings you did.

Some details:

I can see you were using Godot 3.4.1 before, but I guess you may have updated it in the meantime.

The importer does have a workaround for inserting the image, which could justify the black box. However I wasn't able to make it happen on my machines.

@markman4897 are you still having this issue?

markman4897 commented 2 years ago

@viniciusgerevini since I couldn't wait for the fix this long and I didn't have time to rewrite the project I used another Aseprite importer in the project. However, I saved two projects in their broken state just in case someone would want to take a look at them. Want me to send the files to you over email?

viniciusgerevini commented 2 years ago

@markman4897 Sure. Thanks! Also, what operational system are you working on and exporting to?

markman4897 commented 2 years ago

@viniciusgerevini I'm working on Linux (Pop!_OS 21.04 64bit) while the version of Godot was mixed, it was an old project that I started with Godot 3.2.x I think and then I always used the latest version, same thing with Aseprite. I was testing exports to Linux and HTML5 platforms.

The funny thing was that in editor everything looked just fine. The project I was working on was about a year old and everything worked great. Then I picked up where I left off recently and updated the plugin and everything I imported with the new plugin was rendered as black boxes in the exported version (while showing up just fine in the editor). Then I tried to import new assets in a new empty project with a fresh install of Aseprite Wizard and that worked fine, then I moved those imported files to the old project and it didn't work anymore in the exported version. Then I tried exporting with an old version of Aseprite Wizard in another project (which also worked fine) and moving those files to the project that had problems with the updated plugin, and that worked out fine. I'm sorry this might be written in a confusing way, but the cases when it started to magically work were pretty weird.

Anyways, below are some screenshots of the problematic projects (ignore the goofy art, it's a silly easter egg)

Project 1 editor image Project 1 linux export image Project 2 editor image Project 2 linux export image

Farnoway commented 2 years ago

Ohhhh, sorry I didn't saw this earlier. Gonna explain what I did to fix this:

-I was moving the folder where the .res and .png files were to another location, so it was no more the Output folder location. Just make sure that you put the folder or files at the correct path in your res://. Im pretty sure that will make it.

If you have a question regarding this, im gonna be here.

viniciusgerevini commented 2 years ago

Thanks all. Unfortunately all my VMs and machines seem to not cause the issue. I noticed that the importer does not include the image in the list of generated resources and that could potentially cause some issues, but I can't be sure that is what's causing this one. I'll include that fix a future version.

I'll leave this issue open. If any one comes across this issue again I would ask you to send me the .import folder and the broken binary, so I can run some extra tests

terijaki commented 2 years ago

Screenshot 2022-02-28 at 09 57 58 I had the same issue described here. Unchecking "remove source files" in the config solved it for me!

My issue:

Note, when I delete the ".import" folder of my project, the animations are all black in the editor as well, until I reimport them. But afterwards the export is still black.

So for now I am avoiding "removing source files".

viniciusgerevini commented 2 years ago

Thanks @terijaki . I noticed this issue last week with files imported via the docks. I realised the SpriteFrames is actually using the .stex file from the import forlder, so we do need to keep the png file at least. I'll be releasing a fix where only the json will be removed.

This should impact only resources imported manually. I believe the issue with the automatic importer is slightly different. Which method are you using in your project?

terijaki commented 2 years ago

I am using the manual import.

Glad you found the source of the problem! 💪🏻