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

Issues with FlxFrame.checkValidName #3091

Open
DetectiveBaldi opened this issue Mar 22, 2024 · 10 comments
Open

Issues with FlxFrame.checkValidName #3091

DetectiveBaldi opened this issue Mar 22, 2024 · 10 comments

Comments

@DetectiveBaldi
Copy link
Contributor

  • Haxe version: 4.3.4
  • Flixel version: 5.6.2
  • OpenFL version: ?.?.?
  • Lime version: ?.?.?
  • Affected targets:

in flixel 5.6.1 (?), a new function was added to FlxFrame, that being checkValidName. the function warns for invalid (?) frame names i presume

this function seems to cause more issues then it solves however, when compiling one of my projects in debug, i get bombarded with errors from this line. the game still functions the same, the only issue is i have a ton of errors flooding my log

the errors being:
image

for reference, here is the xml i am referencing (converted to txt due to isses with github)
alphabet.txt

i have to ask, is this FlxFrame function required? in it's current state the only mention of it i've seen is it causing issues with pre-existing projects

if this function must be kept, i would like to atleast know how to fix these errors

@Geokureli
Copy link
Member

can you share the code used to load the xml?

@DetectiveBaldi
Copy link
Contributor Author

while trying to create a simplified repro, i've realized it might be an issue with the project i'm working with, i can't reproduce it in a new flixel template using the previously mentioned xml

this is the original class i was working with, however it does have a lot of seemingly (?) unrelated functionality, which is why i wanted to cut it down

for clarity, frames is loaded using another function, getSparrowAtlas, however, this function is essentially a shortcut to FlxAtlasFrames.fromSparrow

i haven't been able to deduce why this code fails, and my smaller repro doesn't

@Geokureli
Copy link
Member

while trying to create a simplified repro, i've realized it might be an issue with the project i'm working with, i can't reproduce it in a new flixel template using the previously mentioned xml

I don't need a simplified repro, though thanks for trying, I just need a snippet from the project showing how you are parsing the txt and creating the animations

@DetectiveBaldi
Copy link
Contributor Author

👍

@mayo78
Copy link

mayo78 commented Mar 27, 2024

im pretty sure the issue here is because when you generate a spritesheet in flash/adobe animate from the stage instead of the library, it adds "instance" followed by a number, which i think is the amount of versions of one symbol that you are exporting (like different scales maybe?) but i havent really tested this.
it does still add this to every symbol regardless of how many versions there actually are and also doesnt really tell you and as said before happens depending on how you make a spritesheet

@Geokureli
Copy link
Member

👍

Any updates on my previous request @DetectiveBaldi ?

@DetectiveBaldi
Copy link
Contributor Author

👍

Any updates on my previous request @DetectiveBaldi ?

I linked the class with the XML error in my last comment, from what I can gather the animations are added here

The associated XML can also be found here

im pretty sure the issue here is because when you generate a spritesheet in flash/adobe animate from the stage instead of the library, it adds "instance" followed by a number, which i think is the amount of versions of one symbol that you are exporting (like different scales maybe?) but i havent really tested this. it does still add this to every symbol regardless of how many versions there actually are and also doesnt really tell you and as said before happens depending on how you make a spritesheet

This seems to be the case, removing the number seems to fix the issue in most cases, however in certain cases, the error still seems to occur?

The error also seems to happen if the XML name has an exclamation point in it

@Geokureli
Copy link
Member

looking into this, again. is the issue that addByPrefix doesn't work on "foo bar 00001" if the prefix is "foo" or something?

@DetectiveBaldi
Copy link
Contributor Author

DetectiveBaldi commented Apr 25, 2024

looking into this, again. is the issue that addByPrefix doesn't work on "foo bar 00001" if the prefix is "foo" or something?

Yes, that seems to be the issue, I can now reliably reproduce the error.

var sprite:FlxSprite = new FlxSprite();

sprite.frames = FlxAtlasFrames.fromSparrow("assets/images/alphabet.png", "assets/images/alphabet.xml");

// sprite.animation.addByPrefix("#", "# bold", 24, true); // Causes error

sprite.animation.addByPrefix("#", "# bold instance", 24, true); // Runs successfully

add(sprite);

The animation on the XML being: # bold instance 10000, # bold instance 10001, etc

@Geokureli
Copy link
Member

I think in this case it should try and parse the numbers in "instance 00001" and warn you that you should either generate better frame names, or include "instance " in your prefix

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

No branches or pull requests

3 participants