diff --git a/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py index 7b508c067e1..ca2d11d4315 100644 --- a/release/scripts/startup/bl_ui/space_outliner.py +++ b/release/scripts/startup/bl_ui/space_outliner.py @@ -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") diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 4aa36da594b..f1a7a982c26 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -1311,7 +1311,10 @@ static void outliner_sort(SpaceOops *soops, ListBase *lb) TreeElement *te; TreeStoreElem *tselem; int totelem = 0; - + + if (soops->flag & SO_SKIP_SORTING) + return; + te = lb->last; if (te == NULL) return; tselem = TREESTORE(te); diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index f65cef1a0d1..44eb873642f 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -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 */ diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index af0e69cdc3e..6fea135b035 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1593,7 +1593,12 @@ static void rna_def_space_outliner(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "search_flags", SO_FIND_COMPLETE); 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");