Sprite import issues all of a sudden

0 favourites
  • 5 posts
From the Asset Store
2d mushroom sprite 2d game character enmy sprite game art
  • Looping in DiegoM as this relates to his awesome importer features described here

    I'm having some weird behavior with the sprite imports. I've been importing sprites from folders (using drag-and-drop into the C3 sprite editor Animations panel) since this feature was implemented and it's been working great. However, a few days ago I noticed that the sprite animation's frame order is not consistent after import, and I've been racking my brain to figure out what changed. I tried C3 stable versions all the way back to 388.2 and they're all having the same issue all of a sudden. I use Chrome and Windows 10, maybe something changed with those?

    Here's a link to a sample import. If I import this as a single .zip, everything imports correctly. But if I extract it to a folder, and then import that folder, the individual animations have different frame orders. And those orders are pretty random, i.e. if I import the folder again the orders often change. The only way I can get the frames to import consistently is to remove the "sort": flag from the json.

    Can someone try it and see if you get the same experience?

    Thanks

  • FYI this is what I mean by 'order', see how the frames are not in the correct numerical 1-5 order, even though the file names are *01-*05.

  • Can you make the file public?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • DiegoM Sorry, here's the public file

  • I haven't looked at that code in a while, but one thing I remember is that the numerical sorting isn't smart at all. If you explicitly specify it and a file name can't be converted into a number then it won't do it. That means that it won't infer 01 from Clipboard01, for instance. If you tell it to sort file names that it can't convert to numbers they will all end up having the same priority, so I think that's why using numerical sorting with the files named Clipboard## ends up doing something unexpected.

    Another thing I remember is that explicitly specifying numerical sorting ended up being redundant after some iterations of the feature. If "sort" is not specified at all it just tries to do alphabetical sorting, unless all the file names can be converted to numbers, then it will try to do numerical sorting. That is the sensible thing to do in most cases.

    Lastly there is "no-sort" which just adds the files in the order the browser sees them, which can be different to the order shown by an operating system.

    So to explain each case:

    1. orig - no sort: that is the order in which the files are seen by the browser, sometimes it's the same as the OS but it is not guaranteed.
    2. orig - numerical: the importer is trying to convert those file names to numbers, but it can't so the sorting doesn't work.
    3. orig - sorting removed: the importer defaults to alphabetical sorting and because the file names end with a 2 digit number starting with "0" the sorting works as expected. In this case, if the names didn't have the "0", the sorting wouldn't work because, as an example, in strings "11" comes before "2". Not very intuitive, but that's how it works.
    4. renamed - no sort: same as first case.
    5. renamed - numerical: all file names can be converted to numbers, so it works as expected.
    6. renamed - sorting removed: the importer sees that all file names can be converted to numbers, so it does numerical sorting and it works as expected.

    To sum it up, the best is to just create your files with a number as the file name. If you want to add a string part you need to make sure the number part of the name is 0 padded to make sure your get the correct sorting when it tries to do alphabetical sorting.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)