Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--release/scripts/ui/space_outliner.py16
-rw-r--r--source/blender/editors/space_outliner/outliner.c42
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.h6
-rw-r--r--source/blender/makesdna/DNA_space_types.h4
-rw-r--r--source/blender/makesrna/intern/rna_space.c46
5 files changed, 68 insertions, 46 deletions
diff --git a/release/scripts/ui/space_outliner.py b/release/scripts/ui/space_outliner.py
index 129202117a1..a0f8f41f58a 100644
--- a/release/scripts/ui/space_outliner.py
+++ b/release/scripts/ui/space_outliner.py
@@ -36,12 +36,13 @@ class OUTLINER_HT_header(bpy.types.Header):
if context.area.show_menus:
sub = row.row(align=True)
sub.menu("OUTLINER_MT_view")
+ sub.menu("OUTLINER_MT_search")
if space.display_mode == 'DATABLOCKS':
sub.menu("OUTLINER_MT_edit_datablocks")
layout.prop(space, "display_mode", text="")
- layout.prop(space, "display_filter", text="")
+ layout.prop(space, "display_filter", icon='VIEWZOOM', text="")
layout.separator()
@@ -84,6 +85,18 @@ class OUTLINER_MT_view(bpy.types.Menu):
layout.operator("screen.area_dupli")
layout.operator("screen.screen_full_area")
+class OUTLINER_MT_search(bpy.types.Menu):
+ bl_label = "Search"
+
+ def draw(self, context):
+ layout = self.layout
+
+ space = context.space_data
+
+ col = layout.column()
+
+ col.prop(space, "match_case_sensitive")
+ col.prop(space, "match_complete")
class OUTLINER_MT_edit_datablocks(bpy.types.Menu):
bl_label = "Edit"
@@ -105,6 +118,7 @@ class OUTLINER_MT_edit_datablocks(bpy.types.Menu):
classes = [
OUTLINER_HT_header,
OUTLINER_MT_view,
+ OUTLINER_MT_search,
OUTLINER_MT_edit_datablocks]
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c
index 349a158898d..98dc62695fc 100644
--- a/source/blender/editors/space_outliner/outliner.c
+++ b/source/blender/editors/space_outliner/outliner.c
@@ -1240,14 +1240,18 @@ static int outliner_filter_has_name(TreeElement *te, char *name, int flags)
int found= 0;
/* determine if match */
- if(flags==OL_FIND)
- found= BLI_strcasestr(te->name, name)!=NULL;
- else if(flags==OL_FIND_CASE)
- found= strstr(te->name, name)!=NULL;
- else if(flags==OL_FIND_COMPLETE)
- found= BLI_strcasecmp(te->name, name)==0;
- else
- found= strcmp(te->name, name)==0;
+ if (flags & SO_FIND_CASE_SENSITIVE) {
+ if (flags & SO_FIND_COMPLETE)
+ found= strcmp(te->name, name) == 0;
+ else
+ found= strstr(te->name, name) != NULL;
+ }
+ else {
+ if (flags & SO_FIND_COMPLETE)
+ found= BLI_strcasecmp(te->name, name) == 0;
+ else
+ found= BLI_strcasestr(te->name, name) != NULL;
+ }
return found;
}
@@ -1261,8 +1265,10 @@ static void outliner_filter_tree(SpaceOops *soops, ListBase *lb)
for (te= lb->first; te; te= ten) {
ten= te->next;
- if(0==outliner_filter_has_name(te, soops->search_string, OL_FIND)) {
-
+ if(0==outliner_filter_has_name(te, soops->search_string, soops->search_flags)) {
+ /* FIXME: users probably expect to be able to matches nested inside these non-matches...
+ * i.e. searching for "Cu" under the default scene, users want the Cube, but scene fails so nothing appears
+ */
outliner_free_tree(&te->subtree);
BLI_remlink(lb, te);
@@ -2686,17 +2692,7 @@ static TreeElement *outliner_find_named(SpaceOops *soops, ListBase *lb, char *na
TreeElement *te, *tes;
for (te= lb->first; te; te= te->next) {
- int found;
-
- /* determine if match */
- if(flags==OL_FIND)
- found= BLI_strcasestr(te->name, name)!=NULL;
- else if(flags==OL_FIND_CASE)
- found= strstr(te->name, name)!=NULL;
- else if(flags==OL_FIND_COMPLETE)
- found= BLI_strcasecmp(te->name, name)==0;
- else
- found= strcmp(te->name, name)==0;
+ int found = outliner_filter_has_name(te, name, flags);
if(found) {
/* name is right, but is element the previous one? */
@@ -2752,7 +2748,7 @@ void outliner_find_panel(Scene *scene, ARegion *ar, SpaceOops *soops, int again,
TreeElement *last_find;
TreeStoreElem *tselem;
int ytop, xdelta, prevFound=0;
- char name[33];
+ char name[32];
/* get last found tree-element based on stored search_tse */
last_find= outliner_find_tse(soops, &soops->search_tse);
@@ -2760,7 +2756,7 @@ void outliner_find_panel(Scene *scene, ARegion *ar, SpaceOops *soops, int again,
/* determine which type of search to do */
if (again && last_find) {
/* no popup panel - previous + user wanted to search for next after previous */
- BLI_strncpy(name, soops->search_string, 33);
+ BLI_strncpy(name, soops->search_string, sizeof(name));
flags= soops->search_flags;
/* try to find matching element */
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index 1c34cb5ef87..43e5517ecbc 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -99,12 +99,6 @@ typedef struct TreeElement {
#define TSE_KEYMAP 34
#define TSE_KEYMAP_ITEM 35
-/* outliner search flags */
-#define OL_FIND 0
-#define OL_FIND_CASE 1
-#define OL_FIND_COMPLETE 2
-#define OL_FIND_COMPLETE_CASE 3
-
/* button events */
#define OL_NAMEBUTTON 1
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index aba56fbf52d..e7ee04b2328 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -814,6 +814,10 @@ enum {
/* if set, it allows redraws. gets set for some allqueue events */
#define SO_TREESTORE_REDRAW 2
+/* outliner search flags (SpaceOops->search_flags) */
+#define SO_FIND_CASE_SENSITIVE (1<<0)
+#define SO_FIND_COMPLETE (1<<1)
+
/* headerbuttons: 450-499 */
#define B_IMASELHOME 451
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index d16e136bb94..e816dbe9493 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -759,20 +759,20 @@ static void rna_def_space_outliner(BlenderRNA *brna)
PropertyRNA *prop;
static EnumPropertyItem display_mode_items[] = {
- {0, "ALL_SCENES", 0, "All Scenes", ""},
- {1, "CURRENT_SCENE", 0, "Current Scene", ""},
- {2, "VISIBLE_LAYERS", 0, "Visible Layers", ""},
- {3, "SELECTED", 0, "Selected", ""},
- {4, "ACTIVE", 0, "Active", ""},
- {5, "SAME_TYPES", 0, "Same Types", ""},
- {6, "GROUPS", 0, "Groups", ""},
- {7, "LIBRARIES", 0, "Libraries", ""},
- {10, "SEQUENCE", 0, "Sequence", ""},
- {11, "DATABLOCKS", 0, "Datablocks", ""},
- {12, "USER_PREFERENCES", 0, "User Preferences", ""},
- {13, "KEYMAPS", 0, "Key Maps", ""},
+ {SO_ALL_SCENES, "ALL_SCENES", 0, "All Scenes", ""},
+ {SO_CUR_SCENE, "CURRENT_SCENE", 0, "Current Scene", ""},
+ {SO_VISIBLE, "VISIBLE_LAYERS", 0, "Visible Layers", ""},
+ {SO_SELECTED, "SELECTED", 0, "Selected", ""},
+ {SO_ACTIVE, "ACTIVE", 0, "Active", ""},
+ {SO_SAME_TYPE, "SAME_TYPES", 0, "Same Types", ""},
+ {SO_GROUPS, "GROUPS", 0, "Groups", ""},
+ {SO_LIBRARIES, "LIBRARIES", 0, "Libraries", ""},
+ {SO_SEQUENCE, "SEQUENCE", 0, "Sequence", ""},
+ {SO_DATABLOCKS, "DATABLOCKS", 0, "Datablocks", ""},
+ {SO_USERDEF, "USER_PREFERENCES", 0, "User Preferences", ""},
+ {SO_KEYMAP, "KEYMAPS", 0, "Key Maps", ""},
{0, NULL, 0, NULL, NULL}};
-
+
srna= RNA_def_struct(brna, "SpaceOutliner", "Space");
RNA_def_struct_sdna(srna, "SpaceOops");
RNA_def_struct_ui_text(srna, "Space Outliner", "Outliner space data");
@@ -782,12 +782,26 @@ static void rna_def_space_outliner(BlenderRNA *brna)
RNA_def_property_enum_items(prop, display_mode_items);
RNA_def_property_ui_text(prop, "Display Mode", "Type of information to display");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_OUTLINER, NULL);
-
+
+ prop= RNA_def_property(srna, "display_filter", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "search_string");
+ RNA_def_property_ui_text(prop, "Display Filter", "Live search filtering string");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_OUTLINER, NULL);
+
+ prop= RNA_def_property(srna, "match_case_sensitive", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "search_flags", SO_FIND_CASE_SENSITIVE);
+ RNA_def_property_ui_text(prop, "Case Sensitive Matches Only", "Only use case sensitive matches of search string");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_OUTLINER, NULL);
+
+ prop= RNA_def_property(srna, "match_complete", PROP_BOOLEAN, PROP_NONE);
+ 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, "show_restriction_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 colum");
+ RNA_def_property_ui_text(prop, "Show Restriction Columns", "Show column");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_OUTLINER, NULL);
-
}
static void rna_def_background_image(BlenderRNA *brna)