Outliner: Make alphabetical sorting optional

A new option to the Outliner's View menu is added to enable/disable sorting of items.
This commit is contained in:
julianeisel 2015-01-19 01:01:23 +01:00
parent 90b5697459
commit ffe56536f1
4 changed files with 12 additions and 2 deletions

@ -86,6 +86,7 @@ class OUTLINER_MT_view(Menu):
space = context.space_data
if space.display_mode not in {'DATABLOCKS', 'USER_PREFERENCES', 'KEYMAPS'}:
layout.prop(space, "sort_alphabetically")
layout.prop(space, "show_restrict_columns")
layout.separator()
layout.operator("outliner.show_active")

@ -1312,6 +1312,9 @@ static void outliner_sort(SpaceOops *soops, ListBase *lb)
TreeStoreElem *tselem;
int totelem = 0;
if (soops->flag & SO_SKIP_SORTING)
return;
te = lb->last;
if (te == NULL) return;
tselem = TREESTORE(te);

@ -273,6 +273,7 @@ typedef enum eSpaceOutliner_Flag {
SO_NEWSELECTED = (1 << 1),
SO_HIDE_RESTRICTCOLS = (1 << 2),
SO_HIDE_KEYINGSETINFO = (1 << 3),
SO_SKIP_SORTING = (1 << 4),
} eSpaceOutliner_Flag;
/* SpaceOops->outlinevis */

@ -1594,6 +1594,11 @@ static void rna_def_space_outliner(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Complete Matches Only", "Only use complete matches of search string");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
prop = RNA_def_property(srna, "sort_alphabetically", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SO_SKIP_SORTING);
RNA_def_property_ui_text(prop, "Sort Alphabetically", "Sort items alphabetically");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
prop = RNA_def_property(srna, "show_restrict_columns", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SO_HIDE_RESTRICTCOLS);
RNA_def_property_ui_text(prop, "Show Restriction Columns", "Show column");