lasa01 / Plumber

A Blender addon for importing Source 1 engine maps, models, materials and textures. This addon makes it possible to import full CS:GO, TF2, CS:S or other Source 1 game maps into Blender.
MIT License
395 stars 29 forks source link

Drastically reducing blend file sizes by sharing common textures folder #144

Open WilliamWoha opened 1 year ago

WilliamWoha commented 1 year ago

This is my first time doing this, I hope I'm doing it correctly

Is your feature request related to a problem? Please describe. Importing a map from Team Fortress 2 is rather simple: Unpack .bsp if necessary using bspzip, convert .bsp into .vmf with BSPSource, and then bring .vmf into Blender with Plumber. Everything works once it's figured out, but the sheer amount of textures used in individual maps makes it so separate blend files end up being very large, even though they're using the same textures.

Is your feature request related to a specific game? Please specify. This is mainly for Team Fortress 2, though it may work for other games as well if they handle textures the same way. I haven't worked with other titles though.

Describe the solution you'd like To drastically reduce file size, I imported the map, then unpacked all textures. They were all exported to the location the Blend file was saved at. This reduces the size of the .blend file from around 800-900 MB to less than 50 MB, and the textures all end up in that folder. Then I moved them to a new folder. Blender usually found them, but if not then I just did Find Missing Files.

For one map this doesn't reduce the total size of the map + textures, but for 10 maps, I keep moving the textures to that folder. If it's the same files then I just overwrite, and if they're not the same then they get added. So 10 blend files with 10 different maps take up less than 1.5 GB, as compared to the nearly 9 GB they'd take if they were all packed.

So the solution in simple steps would be to just unpack the textures automatically and move them to a predefined folder, which all future imports could refer to for seeing if the textures already being used are already there and if so, then just use that instead of packing into the .blend file. This folder could be present in the add-on settings or as a folder that can be chosen during import, or something like that, or maybe you folks can think of something better along the lines of this.

Most people wouldn't be used to this approach, especially if they've been using Plumber for a while now, but I think directly switching to this would help people in the long run as it saves plenty of space. Having this only be an optional feature might cause people to keep using packed blender files and not even know that this was an option.

Additional context Nothing more to add, except that even now Plumber is amazing and thank you for creating it. I use Discord way more often than Github so I might end up missing messages or something, but I'll try to keep in check with this. Have a nice day!

lasa01 commented 1 year ago

Thanks, looks good!