codeandweb / texturepacker-godot-plugin Goto Github PK
View Code? Open in Web Editor NEWAtlasTexture and TileSet importer for Godot engine. Loads sprites sheets created with TexturePacker
License: MIT License
AtlasTexture and TileSet importer for Godot engine. Loads sprites sheets created with TexturePacker
License: MIT License
The plugin can't load in the latest beta due to the following errors.
SCRIPT ERROR: GDScript::reload: Parse Error: Variable "id" already defined in the scope (at line 101).
At: res://addons/codeandweb.texturepacker/texturepacker_import_tileset.gd:102.
ERROR: reload: Method failed. Returning: ERR_PARSE_ERROR
At: modules/gdscript/gdscript.cpp:599.
SCRIPT ERROR: GDScript::reload: Parse Error: Couldn't fully preload the script, possible cyclic reference or compilation error. Use "load()" instead if a cyclic reference is intended.
At: res://addons/codeandweb.texturepacker/codeandweb.texturepacker_importer.gd:34.
ERROR: reload: Method failed. Returning: ERR_PARSE_ERROR
At: modules/gdscript/gdscript.cpp:599.
000000000000000000
As TexturePacker already has the feature below, feature request in short: enable animated tile groups export/import for the godot plugin.
In Godot a 2d-sprite-Animation can be defined by using a single sprite and setting a number of columns and rows. This sprite can also be contained in an Atlas Texture. My idea/request: Make it possible to mark multiple images as an single animation, which then will be added to the atlas texture by texturepacker using a strict column/row layout (only this subimage, not the whole atlas). When importing just detect the sub-image as animation and configure it in that way.
why: the animated tile in godots tilemap is much more performant than calling set_tile every frame for every animated tile.
Unable to load addon script from path: 'res://addons/codeandweb.texturepacker/codeandweb.texturepacker_importer.gd' There seems to be an error in the code, please check the syntax.
I know Godot 4.0 it's still in active development, but we could have another branch of this repo to begin preparing for the new version.
So I recently altered the output of Texture Packer sprite sheet (removed some unneeded files) however the importer plugin didn't wipe these out of the .sprites
folder.
My fix was to manually delete all the .tres
files and let GoDot rebuild them. But it'd be nice for it to "sync" properly.
When importing the texture atlas, the Filter texture flag is on by default. When wanting your sprites to appear more pixelated it is desirable to turn the Filter flag off. Additionally, adding support for other Texture flags in the presets would be ideal.
The Tiled Plugin is an excellent example of how to handle import presets and Texture Flags.
0000000000000000000
I am pretty sure every .tres file generated loads the whole spritesheet and then use uses a region of that spritesheet, leaving a huge impact on memory which is the exact opposite of what using a spritesheet should do.
Right now it is better performance wise to just not use this plugin, and just have each frame individually in godot.
Example:
Let's say we have a 10x10 setup, with each "frame" being 128x128 pixels.
That means the whole spritesheet is a image sized 1280x1280 pixels (if everything is perfectly packed and so on, example! ๐)
So the idea is that we only have to load the 1280x1280 file once and just use different parts of it.
Alternatively we would load each frame individually and therefore load 100 files that are 128x128 pixels.
But!
As this plugin works right now, it generates a .tres file that loads the spritesheet and then defines a region that should be drawn.
This means that the plugin, in this example, generates 100 .tres files, one per frame.
Each one of these 100 frames loads the complete spritesheet and then only draws a set region of it.
So we now have 100 .tres files, that each load the 1280x1280 pixels big spritesheet.
This can easily leave a huge impact on memory!
I have just installed a fresh copy of godot, and enabled the tile set importer plugin within project settings.
I seem to continuously get this error, plus the godot editor seems to crash regularly.
ERROR: get_multiple_md5: Condition "!f" is true. Continuing.
At: core/os/file_access.cpp:671
I notice if i disable the plugin, the error goes away.
Any help appreciated.
With TexturePacker you have the option to automatically create a normalmap file which has the same positions + regions for the supplied normalmaps as the texture file. But when using this plugin for godot the normal file which can be also generated is completely ignored.
A simple fix for a spritesheet (which I used in my project now) could be f.e. adding
if sheet.has("normalMap"):
var normalsheetFile = source_file.get_base_dir()+"/"+sheet.normalMap
var normalimage = load_image(normalsheetFile, "ImageTexture", [])
for sprite in sheet.sprites:
sprite.filename += "_n"
create_atlas_textures(sheetFolder, sheet, normalimage, r_gen_files)
after this (This code assumes that the file extensions are trimmed, otherwise you would have to change it slighty)
This also creates "empty" normalmaps (if the original spritesheet had no normalmap for a specific texture) instead of no normalmap at all- I don't know if this would be the intended functionality. Additionally it doesn't really leave room for customisation (if the user f.e. wanted a specific folder for all the normal maps).
But it would be nice if this or something similar was added to the import of spritesheets and tilesets
I have folder structure like below.
/scenes
- /actors
- - /mario
- - /mario.gd
- - /mario_jump0.png
- - /mario_jump1.png
- - /goomba
- - /goomba.gd
- - /goomba_walk0.png
- - /goomba_walk1.png
- - /coopa
- /tilesets
- - /obstacles.png
- - /hazards.png
- /blocks
- /traps
/scripts
/shaders
/etc
Currently addons imports in different folder specified by packer atlas name. It's possible to import .tres files within folder where sprite was taken?
My English is not very good, I am using translation software to communicate with you.
I got an error when cutting texture.
texture.zip
This is the material I used.
Dislocation during cutting
In Godot 4 change File & Directory to FileAccess & DirAccess.
Here is my fix patch.
Fix texturepacker importer with godot 4 beta API change.zip
When Godot tries to import tpsheet I see in logs:
Failed method: Label:_update_callback target ID: 398122
TOTAL BYTES: 4194288
NULL count: 0
CALL : 221
CALL _test_update_tree: 12
CALL _update_bone_list: 1
CALL _set_main_scene_state: 1
CALL minimum_size_changed: 36
CALL _update_callback: 115096
CALL _update_minimum_size: 1351
CALL _sort_children: 56969
CALL _on_theme_changed: 2
CALL _update_current_tab: 6
CALL _update_hover: 450
CALL emit_signal: 180
CALL _emit_change: 1
CALL _update_script_names: 2
CALL _update_script_connections: 2
CALL _update_tree: 2
CALL _update_scrollbar_position: 24
CALL update_transform_gizmo_view: 4
ERROR: push_call: Message queue out of memory. Try increasing 'memory/limits/message_queue/max_size_kb' in project settings.
At: core/message_queue.cpp:55.
It shows infinite amount of the same error and import progress still stayed on zero.
Each tpsheet import make Godot 3.1 not responding, the application has to be killed and restarted for it to import the next tpsheet which will again crash it and so on.
So right now, it's not usable at all :(
Is this plugin still maintained ?
Any plans in the future to support the polygon packing feature for atlas export/import in the near future?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.