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:
authorJoshua Leung <aligorith@gmail.com>2010-04-23 07:53:05 +0400
committerJoshua Leung <aligorith@gmail.com>2010-04-23 07:53:05 +0400
commiteba8672f123d2e5d91c8b3b8b5d97b33c122797e (patch)
tree3371286aa747d575929e13eea39e1b7daf97a5d5 /source/blender/editors/space_outliner
parent26e4a5802ef891684df16b796c18c19e8b6d7e23 (diff)
Outliner Live-Search Bugfixes:
Ton's commits missed the RNA changes needed to make this work (i.e. the search field was un-defined). This has now been added, and the search field has the 'search eyeglass' icon to make its purpose clearer. I've also taken this opportunity to restore the search matching flags (i.e. case sensitivity and complete vs partial matches), making these separate toggle options instead. The old searching operator stuff can probably be removed now?
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r--source/blender/editors/space_outliner/outliner.c42
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.h6
2 files changed, 19 insertions, 29 deletions
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