[Bf-blender-cvs] [b6405d001ae] soc-2019-outliner: Outliner: Fix merge element search from finding incorrect items

Nathan Craddock noreply at git.blender.org
Sun Jul 21 05:01:22 CEST 2019


Commit: b6405d001ae3426b053d621bbc5db2f315d38a1e
Author: Nathan Craddock
Date:   Sat Jul 20 20:58:32 2019 -0600
Branches: soc-2019-outliner
https://developer.blender.org/rBb6405d001ae3426b053d621bbc5db2f315d38a1e

Outliner: Fix merge element search from finding incorrect items

When selecting aggregated collections (for example) the search
menu would show many other types of data (vertex groups, materials,
modifiers, etc.) This fixes that issue.

===================================================================

M	source/blender/editors/space_outliner/outliner_intern.h
M	source/blender/editors/space_outliner/outliner_select.c
M	source/blender/editors/space_outliner/outliner_tools.c

===================================================================

diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index e4306cde834..c91fa30745c 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -90,6 +90,7 @@ typedef struct TreeElementIcon {
 
 typedef struct MergedSearchData {
   TreeElement *parent_element;
+  TreeStoreElem *tselem;
   int element_type;
 } MergedSearchData;
 
@@ -400,7 +401,7 @@ void OUTLINER_OT_orphans_purge(struct wmOperatorType *ot);
 /* outliner_tools.c ---------------------------------------------- */
 
 struct uiBlock *merged_element_search_menu(struct bContext *C, struct ARegion *ar, void *element);
-void merged_element_search_free_cb();
+void merged_element_search_free_cb(void *arg);
 
 void OUTLINER_OT_operation(struct wmOperatorType *ot);
 void OUTLINER_OT_scene_operation(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index a8f287becf7..679e4e17165 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -1425,6 +1425,7 @@ static int outliner_item_do_activate_from_cursor(bContext *C,
     if (merged_elements) {
       MergedSearchData *select_data = MEM_callocN(sizeof(MergedSearchData), "merge_search_data");
       select_data->parent_element = te;
+      select_data->tselem = TREESTORE(activate_te);
       select_data->element_type = tree_element_id_type_to_index(activate_te);
 
       UI_popup_block_invoke(
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index baec8495a40..b9a087fddf6 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -483,16 +483,14 @@ void merged_element_search_free_cb(void *arg)
   MEM_freeN(arg);
 }
 
-static void merged_element_search_cb_recursive(const ListBase *tree,
-                                               short type,
-                                               const char *str,
-                                               uiSearchItems *items)
+static void merged_element_search_cb_recursive(
+    const ListBase *tree, short tselem_type, short type, const char *str, uiSearchItems *items)
 {
   char name[64];
   int iconid;
 
   for (TreeElement *te = tree->first; te; te = te->next) {
-    if (tree_element_id_type_to_index(te) == type) {
+    if (tree_element_id_type_to_index(te) == type && tselem_type == TREESTORE(te)->type) {
       if (BLI_strcasestr(te->name, str)) {
         BLI_strncpy(name, te->name, 64);
 
@@ -504,7 +502,7 @@ static void merged_element_search_cb_recursive(const ListBase *tree,
       }
     }
 
-    merged_element_search_cb_recursive(&te->subtree, type, str, items);
+    merged_element_search_cb_recursive(&te->subtree, tselem_type, type, str, items);
   }
 }
 
@@ -516,9 +514,10 @@ static void merged_element_search_cb(const bContext *UNUSED(C),
 {
   MergedSearchData *search_data = (MergedSearchData *)data;
   TreeElement *parent = search_data->parent_element;
+  short tselem_type = search_data->tselem->type;
   int type = search_data->element_type;
 
-  merged_element_search_cb_recursive(&parent->subtree, type, str, items);
+  merged_element_search_cb_recursive(&parent->subtree, tselem_type, type, str, items);
 }
 
 /* Activate an element from the merged element search menu */



More information about the Bf-blender-cvs mailing list