Page MenuHome

File Compression Doesn't Work
Closed, InvalidPublic

Description

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce GTX 1080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 436.48

Blender Version
Broken: version: 2.82 (sub 7), branch: master, commit date: 2020-03-12 05:06, hash: rB375c7dc4caf4
Worked: (optional)

Short description of error
Enabling File Compression doesn't result in smaller file size on disk.

Exact steps for others to reproduce the error
Open Blender. Delete the default everything. Add Suzanne.
Add a Level 5 Subdivision Surface
Convert Suzanne to a mesh
Open prefs and go to the Save & Load section. Ensure compression is turned on.
Save the file
Open prefs and go back to Save & Load and turn compression off.
Save a copy of the file.
Both files on disk will be the same size.

This works whether you save the prefs and close Blender then save or not.

Event Timeline

Ankit Meel (ankitm) changed the task status from Needs Triage to Needs Information from User.Mar 20 2020, 8:01 AM

Could you open file properties and check the finer file size, in bytes ?

There is an easier way to test this sort of thing. To confirm that a blend file is compressed or not just rename it (after saving) so that the extension is ".gz". A file that has been properly compressed in Blender, and has that extension, will then open in a program that can deal with such archives. Like WinRar or whatever you have. But a file that is not actually compressed by blender, but has that extension, will not open in such a program but will be seen as an invalid file.

I have seen the same behavior as OP, but it seems to be that the "compress file" setting is not updated correctly when changing in Preferences.

If I launch blender when that setting is turned off, then saving a regular file, turn the setting on, save another file - they will both be identical and both will not be compressed. However if I launch blender with that setting already on, then saving a file, turn it off, save another - they will both be identical and both will be compressed.

So the only way I can create files that are either compressed or not requires me to change the setting and relaunch blender to do so.

Seems to be like this:

  • The setting in the operator (Blender File View sidebar) always works for me.
  • Changing the preference only kicks in once, if you change it in the operator for the session, this has no effect anymore (should though?, checking on this...)

Logic seems to be as follows:

  • for saving existing files: use the compress setting the file had (as a starting point, can be tweaked in the operator as you wish)
  • for saving new files [ones that havent been saved before -- basically only the untitled.blend you get from starting a new file]: use the compress setting from the preferences (as a starting point, can be tweaked in the operator as you wish)

code is here https://developer.blender.org/diffusion/B/browse/master/source/blender/windowmanager/intern/wm_files.c$2543

Thinking about it more, it actually makes sense, no?
Two things:

  • not sure the "saving existing files" rule should also apply to "Save A Copy"? (if that should rather take the preferences again as a starting point, that could be done using P1309)
  • we could make the Preference a bit more clear, like so

1
2
3diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
4index acc4f16c45c..22a7bf0341d 100644
5--- a/source/blender/makesrna/intern/rna_userdef.c
6+++ b/source/blender/makesrna/intern/rna_userdef.c
7@@ -5890,7 +5890,7 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna)
8 prop = RNA_def_property(srna, "use_file_compression", PROP_BOOLEAN, PROP_NONE);
9 RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_FILECOMPRESS);
10 RNA_def_property_ui_text(
11- prop, "Compress File", "Enable file compression when saving .blend files");
12+ prop, "Compress File", "Enable file compression when saving previously unsaved .blend files");
13
14 prop = RNA_def_property(srna, "use_load_ui", PROP_BOOLEAN, PROP_NONE);
15 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_FILENOUI);

Summing it up I actually dont think this is a bug, but would appreciate opinions from @Bastien Montagne (mont29) and/or @William Reynish (billreynish).

Bastien Montagne (mont29) claimed this task.

Improvements qre always possible indeed, but this is working as expected, definitively not a bug. thanks for the report anyway.

Got it. Thanks for the help. I didn't realize there was a "compress" checkbox in the file save. Only saw it in the Prefs. Looks like the file save option works. But the Prefs one doesn't seem to have any impact.

I am curious as to what type of file compression is used and if a better compression can be added as an option. I've got 2.6GB blend files that have been saved with compression. Yet 7Zip gets them down to about 120MB. I'd love to see a setting in Blender that allows the compression amount to be increased or decreased at the expense of file save time.