Skip to content

Conversation

@JuanFdS
Copy link
Contributor

@JuanFdS JuanFdS commented Apr 17, 2025

Proposed workflow for learner making their own spritesheet

There are actually 2 valid ways of creating a new spritesheet:

  • Duplicating it from the editor's filesystem.
  • In the inspector of a selected node that exposes a SpriteFrames, click Make Unique.

Then, once the new spritesheet is created, it's just either dragging a texture to the one that the user wants to swap.

Grabacion.De.Pantalla.2025-05-06.103910.mp4

@JuanFdS JuanFdS changed the title WIP Animated sprites with configurable textures Apr 17, 2025
Copy link
Contributor

@pablitar pablitar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is great. We should merge it and test it thoroughly with real world cases!

Feel free to address the comments I made!

@JuanFdS JuanFdS force-pushed the animated-sprites-with-configurable-textures branch 3 times, most recently from c89d990 to ecfa22f Compare May 2, 2025 13:12
@manuq
Copy link
Collaborator

manuq commented May 2, 2025

@JuanFdS did a demo of the current state. It looks very promising!

@JuanFdS JuanFdS force-pushed the animated-sprites-with-configurable-textures branch 3 times, most recently from a4d1870 to 258e706 Compare May 2, 2025 19:14
@JuanFdS

This comment was marked as resolved.

@JuanFdS JuanFdS force-pushed the animated-sprites-with-configurable-textures branch 2 times, most recently from e8bed14 to 4624fe7 Compare May 5, 2025 14:07
@JuanFdS JuanFdS marked this pull request as ready for review May 5, 2025 14:10
@JuanFdS JuanFdS force-pushed the animated-sprites-with-configurable-textures branch 4 times, most recently from 36f4936 to 85c0732 Compare May 5, 2025 14:15
@JuanFdS JuanFdS requested review from manuq and pablitar May 5, 2025 14:23
Copy link
Collaborator

@manuq manuq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuanFdS this is working like a charm! I think it's a great addition that works around a current limitation of the Godot editor: unlike TileSet, the SpriteFrames doesn't expose the used textures. Also requiring that the replaced texture is of the same size is a nice touch.

Can you make it work with SpriteFrames that are saved in the scene too? At first glance I don't see what is limiting the addon to only work with SpriteFrames resources saved in its own separate files.

Can you run the linter and other checks in it? In .pre-commit-config.yaml we have the checks disabled for all addons/ because the only addon is dialogue_manager which we copy and patch. I have opened #464 for this. If I add that commit on top of this PR and then run pre-commit run --all-files I get a number of issues.

else:
var message_label := Label.new()
message_label.autowrap_mode = TextServer.AUTOWRAP_WORD
message_label.text = "⚠️ SpriteFrames must be saved to a file in order to edit its textures"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this limitation. Can you explain why the SpriteFrames resource has to be saved to a file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems it can!, in a previous version, making the file unique and modifying it was causing issues, but it seems it doesn't now, so this limitation isn't needed, thanks for pointing that out!

@JuanFdS JuanFdS force-pushed the animated-sprites-with-configurable-textures branch from 85c0732 to b4a0ee6 Compare May 6, 2025 13:17
JuanFdS added 2 commits May 6, 2025 10:25
The addons affects any SpriteFrames resource by exposing some 'virtual' properties (one for each texture used in the SpriteFrames) in the inspector, and if any of those texture is changed, it updates every animation in the SpriteFrames that used accordingly.

The way to access those properties is either by expanding the SpriteFrames that are exposed by any object, or by opening a SpriteFrames resource directly in godot.

Added some safeguards:

- only lets users swap a texture by another texture of the same size.

- doesn't let the user swap a texture by an already used texture (this messed up undoing the operation).

- doesn't let the user clear the texture.

Fixes #173
@JuanFdS JuanFdS force-pushed the animated-sprites-with-configurable-textures branch from b4a0ee6 to 93c9c8c Compare May 6, 2025 13:25
@JuanFdS JuanFdS merged commit d7d6c5f into main May 6, 2025
6 checks passed
@JuanFdS JuanFdS deleted the animated-sprites-with-configurable-textures branch May 6, 2025 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants