Page MenuHome

Fix C operators can't set default display or sort type for File Browser

Authored by Julian Eisel (Severin) on Aug 17 2020, 7:22 PM.



WM_operator_properties_filesel() allows C operators to set a display or sort
type for the File Browser to use. But the File Browser would always override
that because of an invalid _is_set() check. (The operators don't actually set
the value, they only set the property's default value.)

The only operator affected by this is "Recover Auto Save". It is supposed to
show a vertical list ordered chronologically. It used settings from the
previous File Browser usage before this patch.

Further change:
This also makes it so operators that set a different display or sort type
don't change the sort or display type for the next File Browser operation.
So using "Recover Auto Save" entirely isolates display and sort type from other

Diff Detail

rB Blender
temp-fileselect-defaults (branched from master)
Build Status
Buildable 10260
Build 10260: arc lint + arc unit

Event Timeline

Julian Eisel (Severin) requested review of this revision.Aug 17 2020, 7:22 PM
Julian Eisel (Severin) created this revision.
Julian Eisel (Severin) edited the summary of this revision. (Show Details)Aug 17 2020, 7:24 PM
Julian Eisel (Severin) edited the summary of this revision. (Show Details)
Bastien Montagne (mont29) requested changes to this revision.Aug 27 2020, 8:00 PM

Generally looks fine, besides note below.


Not very happy to have this duplicated in two completely different places... This is call for divergence at some point or another.

Potential solutions:

  1. Use a define for the four common entries.
  2. Or keep the exported enum with four entries, and add a callback to the operator properties to add the DEFAULT option?
This revision now requires changes to proceed.Aug 27 2020, 8:00 PM
  • Deduplicate sort type enum definition

The same treatment should be given to file_display_items(), but will do that

  • Correction to previous update
This revision is now accepted and ready to land.Tue, Oct 6, 11:35 AM