GithubHelp home page GithubHelp logo

nklbdev / godot-4-importality Goto Github PK

View Code? Open in Web Editor NEW
330.0 4.0 7.0 214 KB

Universal raster graphics and animations importers pack

License: MIT License

GDScript 100.00%
animation aseprite aseprite-export godot godot-addon godot-engine godot-game-engine godot-plugin godot4 godotengine

godot-4-importality's Introduction

Importality

en en

art for repo 2

Importality - is an add-on for Godot engine for importing graphics and animations from popular formats.

ATTENTION!

In version 0.3.0, the plugin settings were moved from the ProjectSettings to the EditorSettings! This may come as a surprise and may break some of your configured processes! But this will allow you to avoid publishing your local settings along with the project file to the Git repository, and will make CI/CD easier.

๐Ÿ“œ Table of contents

๐Ÿ“ Introduction

I previously published an add-on for importing Aseprite files. After that, I started developing a similar add-on for importing Krita files. During the development process, these projects turned out to have a lot in common, and I decided to combine them into one. Importality contains scripts for exporting data from source files to a common internal format, and scripts for importing data from an internal format into Godot resources. After that, I decide to add new export scripts for other graphic applications.

Watch the demo video

๐ŸŽฏ Features

  • Adding recognition of source graphic files as images to Godot with all the standard features for importing them (for animated files, only the first frame will be imported).
  • Support for Aseprite (and LibreSprite), Krita, Pencil2D, Piskel and Pixelorama files. Other formats may be supported in the future.
  • Import files as:
    • Atlas of sprites (sprite sheet) - texture with metadata;
    • SpriteFrames resource to create your own AnimatedSprite2D and AnimatedSprite3D based on it;
    • PackedScene's with ready-to-use Node's:
      • AnimatedSprite2D and AnimatedSprite3D
      • Sprite2D, Sprite3D and TextureRect animated with AnimationPlayer
  • Several artifacts avoiding methods on the edges of sprites.
  • Grid-based and packaged layout options for sprite sheets.
  • Several node animation strategies with AnimationPlayer.
  • Importing any other graphics formats as regular images with external command line utilities.

๐Ÿฅ Upcoming updates by voting Reddit users

  1. Layers names filters (for layers visibility overriding)
  2. Linux and MacOS scripts to run Krita as different user (to resolve import hanging while Krita instance is running)
  3. Something else (what?) - users are undecided
  4. New target resource-types
  5. More flexible definition of borders around sprites
  6. Ability to specify normal-map layer name

๐Ÿ’ฝ How to install

  1. Install it from Godot Asset Library or:
    • Clone this repository or download its contents as an archive.
    • Place the contents of the addons folder of the repository into the addons folder of your project.
  2. Adjust the settings in Editor Settings -> Importality
    • Specify a directory for temporary files.
    • Specify the command and its parameters to launch your editor in data export mode, if necessary. How to configure settings for your graphical application, see the corresponding article on the wiki.

๐Ÿ‘ท How to use

Be sure to read the wiki article about the editor you are using! These articles describe the important nuances of configuring the integration!

Then:

  1. Save the files of your favorite graphics editor to the Godot project folder.
  2. Select them in the Godot file system tree. They are already imported as a Texture2D resource.
  3. Select the import method you want in the "Import" panel.
  4. Customize its settings.
  5. If necessary, save your settings as a default preset for this import method.
  6. Click the "Reimport" button (you may need to restart the engine).
  7. In the future, if you change the source files, Godot will automatically repeat the import.

๐Ÿ’ช How to help the project

If you know how another graphics format works, or how to use the CLI of another application, graphics and animation from which can be imported in this way - please offer your help in any way. It could be:

godot-4-importality's People

Contributors

nklbdev avatar olanti-p avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

godot-4-importality's Issues

Error 196608 - Krita -> AnimatedSprite2D

./core/variant/variant_utility.cpp:905 - Export is failed. Errors chain:
Export error: 21 (Query failed), description: "An error occurred while executing the Krita command. Process exited with code -196608:
Command: powershell
Argument: -File
Argument: E:\Godot\Plugins\PowerShellScript\runs_with_saved_creds.ps1
Argument: E:\Godot\Plugins\PowerShellScript\creds.txt
Argument: C:\Program Files\Krita (x64)\bin\krita.com
Argument: --export-sequence
Argument: --export-filename
Argument: R:\TEMP/img.png
Argument: R:\TEMP/img.kra"
Error importing 'res://Assets/Animations/test.kra'.

image

image

Aseprite > AnimatedSprite not working in Godot 4.3

When using AnimatedSprite2D with SpriteFrames set to an .aseprite file, no preview will show in the editor or when running the game. There are no errors, but repeated warnings for:

parse_variant: Broken external resource! (index out of size)
<C++ Source> core/io/resource_format_binary.cpp:448 @ parse_variant()

I reproduced it by creating a new project with only an AnimatedSprite2D
Importality v0.3.0
Windows 11
v4.3.stable.official [77dcf97d8] (Compatibility renderer)

Aseprite textures need reimport when cooperating developing

I use the raw .aseprite format file as Texture source, and git for cooperating. After we push and fetch some modified or new files, the textures became messed up, we need to reimport them to make it work.

The ResourcePreview is wrong, either. For example, the power buff Icon texture became to the tileset texture. (the icon size is 16X16 rather than 192X192). Reimport can't resolve preview error, but I can change a pixel in Aseprite to make the resource preview refresh to correct preview.
image

Lots of errors, can't seem to figure out how to add the imported Aseprite file to the Godot scene

On Godot 4.1.1 stable, Windows:

After I installed and enabled the plugin I saved a basic Aseprite Animation (created as a new file, all defaults, just added 4 frames) into the res folder. I then selected the *.aseprite file and in the Import tab I switched to the "Aseprite -> Sprite with AnimationPlayer" preset. I let Godot save and restart and after the restart I tried to drag the *.aseprite file onto the Scene Panel top node of a new scene. This did not work. Then I noticed this wall of red errors:

image

I just closed Godot, restarted and tried again in a new scene, and I noticed there are no errors in the beginning, also none when clicking the *aseprite file, but this block appears as soon as I try to click-drag the aseprite file:

image

Aseprite File I used:
Sprite-0002.zip

Tileset import support

I apologise if there is a way to do this already.

There should be an import option that allows importing all frames of an aseprite file into Godot in the form of a tileset for use in a tilemap.

Rework borders (edge artifacts avoidance methods)

Make borders more abstract and customizable:

  • Expansion for each sprite (and color: nearest or custom)
  • Margin around each sprite and its expansion (and color: nearest or custom)
  • Atlas edges inner margin (padding) (and color: only custom)
  • Distance between sprites with their margins (spacing between eachother) (and color: only custom)
  • Distance between sprites with their margins and atlas edges inner margin (padding) (and color: only custom)

Color filling:

  • Nearest sprite pixel color
  • Custom color

Error when importing Pixelorama PXO

I try to import a PXO file and get this error:

modules/webp/webp_common.cpp:122 - Condition "size <= 0" is true. Returning: Ref()
scene/resources/texture.cpp:695 - Condition "img.is_null() || img->is_empty()" is true. Returning: Ref()
Failed loading resource: res://.godot/imported/folder.pxo-8983d86a9db3ffb31598b684b249353e.ctex. Make sure resources have been imported by opening the project in the editor at least once.
Failed loading resource: res://folder.pxo. Make sure resources have been imported by opening the project in the editor at least once.

folderpxo.zip
This is Godot 4.1 stable, both Windows on Mono and Standalone

Use `EditorSettings` instead of `ProjectSettings`.

Most of settings for this addon seam to be only for the paths to executables. Using Editor Settings instead of Project Settings would work better for teams who use different operating systems.

I think it should be as simple as replacing every instance of ProjectSettings with EditorSettings in project_setting.gd.

Is there a way to Trim imports?

Title. Latest Aseprite (1.3.2) and Godot (4.2.1) versions.

image

Also, why are the frame durations all set to 0.1 and 1 FPS? That's not how it's set in Aseprite.
Also, is there any sort of layer control? It looks like it's just defaulting to visible layers in the Aseprite document.

I've gone through every bit of documentation I can find on this plugin, and there really just isn't sufficient explanation about what this import is supposed to do exactly or how to get it to do whatever that is. It's currently faster and easier to just do the exports manually out of aseprite, so I hope I'm just being a dingus and doing things wrong.

Sprite3D with AnimationPlayer Import Error

I'm beginning work on prototyping a small game idea.
I created a simple "box" sprite with 3 frames in Aseprite.
On attempting to import using Aseprite -> Sprite3D with AnimationPlayer I receive this error for every sprite frame:

res://addons/nklbdev.importality/import/sprite_3d_with_animation_player.gd:35 - Invalid get index 'sptite' (on base: 'RefCounted (FrameInfo)').

Using the following versions:
Godot v4.2.2.stable.official [15073afe3] (standalone from the site, no .NET)
Aseprite 1.3.7-x64 (from Steam)
Plugin downloaded from the repository

Screenshot 2024-08-07 150511
Screenshot 2024-08-07 151526
Screenshot 2024-08-07 150708

I've tried reloading Godot and then reimporting, but continue to get the same error message.
I've also cleared out any of the import files from /.godot/ and next to the aseprite file in the /sprites/ directory.

Any assistance is greatly appreciated!

Aseprite (and others) in CICD

If I want to export the Godot game using GitHub/GitLab CICD how does this work with this tool? It seems like I can develop locally just fine but when trying to use this tool in the CICD it can't work due to missing aseprite.exe when it tries to generate the imported files. This applies to any other format which requires something to perform the conversion.

Maybe I am missing something here or there are alternatives like including my .godot/imported folder to git (from my understanding this isn't recommended but I don't know why). I could also build and install Aseprite in the CICD perhaps.

Pixelorama imported as SpriteFrames results in empty frames

On the latest master branch of Godot the add-on currently works without errors. However, when I try to import a .pxo file as SpriteFrames it generates the object without the actual sprites:

image

Do you know if this is a regression your end? Any help is appreciated. If you want, I can also provide the .pxo file.

Settings not showing in Godot v4.2.1

Hi,

thank you for your plugin, it works beautifully!

I have an issue, I started working on my game with the steam version. I installed the plugin there, and it worked as expected.

Now I switched to a fixed release, for more control, and am using the 4.2.1, published on Archlinux. I also checked that the problem is present when download the 4.2.1 directly from the website and opening my project.

When I try to input the path to my aseprite installation, I can not - the settings do not show

image

The plugin is installed, and activated:

image

Am I doing something stupid, here? Shouldn't the Importality setting appear under the General Project Settings? At least following the documentation it looks like it:
https://github.com/nklbdev/godot-4-importality/wiki

Thank you in advance,

Cheers

Benjamin

Settings completely missing from the menu

Version: Godot_v4.1.3-stable_linux

To reproduce:

  1. Add plugin a project using AssetLib. Enable.
  2. Restart editor
  3. Search for Importality in the project settings, toplevel general
  4. Notice that it's not there

I'm getting the error The project settging "importality/aseprite_or_libre_sprite_command" is not specified!Specify it in Projest Settings -> General -> Importality. in the output console so the editor is definitely loading the plugin. Manually specifying the setting does not seem to work either.

Multiple Imports mess up the output

What's the Issue
Importing multiple files at once messes up the rest.
So, I don't know if this is a problem with the plugin or Godot itself, I've no experience of plugins. When I import multiple files, Godot messes up the results, File A shows up as File B until reimported separately. The most I can figure out is the temp data gets removed during the import process while the next file is being processed. There is an error for unreadable files (see screenshot). In the project, if you select all of the files and hit import, it'll mess up the result.
image
Minimal Reproduction Project
Aseprite Multi Import Issue.zip

How to use this working with team members on the same Godot 4 project?

Hello!

I've been working on a game via Godot 4.1.1 using C#/.NET and it's just been me working on this game for some time. Some of my team members have had availability to start collaborating with me on this using Visual Studio Community 2022 and Github for version control, however, their Aseprite executable paths are different. This causes us to have to change the pathing every time we sync.

Any tips to get around this?

Transfer the sprite sheet packing from the Aseprite functionality to Importality internal algorithm

Aseprite sometimes has bugs when packing the sprite sheete, related to spacings between the sprites and the edges of the atlas.

The Issue at Aseprite repository

For example, a free set of template animations by the author Zeggy, which can be downloaded from itch.io, Aseprite packs the sprite sheet incorrectly if you specify options:

  • Sheet Type: Packed
  • Trim Cels: True
  • Border Padding: 1
  • Spacing (Shape Padding): 1

image

In the picture below, I filled the entire area not used by the sprites with blue, and the places where the sprites are in contact with each other and with the borders of the atlas became visible.

ASEPRITE_BUG

Can't setup plugin in Godot 4.2 beta 5.

Upon installing via the AssetLib and enabling the plugin, there are no Importality settings under the advanced genera project settings when using Godot 4.2 beta 5.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.