rlguy / Blender-FLIP-Fluids

The FLIP Fluids addon is a tool that helps you set up, run, and render high quality liquid fluid effects all within Blender, the free and open source 3D creation suite.
https://www.blendermarket.com/products/flipfluids
GNU General Public License v3.0
1.71k stars 190 forks source link

Savestates are not listed in order on Linux systems #626

Closed sentharn closed 1 year ago

sentharn commented 1 year ago

System Information

Blender Version (including hash): 3.6.2 FLIP Fluids Version: 1.7.1 Operating System: Ubuntu 22.04 CPU: i7-3770k GFX: Nvidia GTX 1070 RAM: 32GB

Describe the bug

savestates

Savestates on windows are listed in order, while on Linux they are arbitrarily ordered

_update_savestate_enums() in domain_bake_properties.py reads each savestate in the savestates directory and iterates through them in the order that os.listdir() returns them. This order is not guaranteed to be stable according to Python docs.

On Windows, they happen to be in the desired order (probably because of some property of NTFS) but on Linux it returns them in a seemingly random order.

I "fixed" this by sorting the directory list first:

        sorted_dirs = os.listdir(savestates_directory)
        sorted_dirs.sort()
        subdirs = [d for d in sorted_dirs if os.path.isdir(os.path.join(savestates_directory, d))]

...but my python is rusty and an actual fix probably needs to do natural sorting, which I think .sort() does not do natively.

Thanks for looking into this!

rlguy commented 1 year ago

Thanks for the report and info! That's good info to know. We'll check it out and get this fixed for the next version.

rlguy commented 1 year ago

Just had a chance to look into this and I think your solution should work fine. The filename numbers are all padded with zeroes to be 6 digits, so regular sort() should work.

This fix will be included in FLIP Fluids 1.7.2, release TBA, but likely will be released shortly before the release of Blender 4.0 on Nov 7, 2023.

sentharn commented 1 year ago

Wow, thank you so much for the quick response!

looking forward to seeing it