[Bf-blender-cvs] [ad19133051f] temp-outliner-library-override-hierarchy: Outliner: Initial Hierarchy view mode for Library Overrides

Julian Eisel noreply at git.blender.org
Fri Mar 25 14:17:21 CET 2022


Commit: ad19133051ff7d990fc72e31995c6fb78e6bc70d
Author: Julian Eisel
Date:   Thu Mar 24 19:04:33 2022 +0100
Branches: temp-outliner-library-override-hierarchy
https://developer.blender.org/rBad19133051ff7d990fc72e31995c6fb78e6bc70d

Outliner: Initial Hierarchy view mode for Library Overrides

Shows all library override hierarchies from the current file and linked files
(indirect library overrides).

TODO before merge:
- Forbid recursive hierarchies in some corner cases
- Properly support having the same ID in multiple branches of a hierarchy

Adding the right column is pending work on system overrides and will be added
later once that is ready.

Part of T95802.

Differential Revision: https://developer.blender.org/D14440

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



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

diff --cc source/blender/editors/space_outliner/tree/tree_display_override_library_properties.cc
index 10b00c2e9cb,b5c0a10c834..534e07cb2b8
--- a/source/blender/editors/space_outliner/tree/tree_display_override_library_properties.cc
+++ b/source/blender/editors/space_outliner/tree/tree_display_override_library_properties.cc
@@@ -30,74 -30,24 +30,24 @@@ TreeDisplayOverrideLibraryProperties::T
  {
  }
  
 -ListBase TreeDisplayOverrideLibrary::buildTree(const TreeSourceData &source_data)
 +ListBase TreeDisplayOverrideLibraryProperties::buildTree(const TreeSourceData &source_data)
  {
-   ListBase tree = {nullptr};
- 
-   {
-     /* current file first - mainvar provides tselem with unique pointer - not used */
-     TreeElement *ten = add_library_contents(*source_data.bmain, tree, nullptr);
-     TreeStoreElem *tselem;
- 
-     if (ten) {
-       tselem = TREESTORE(ten);
-       if (!tselem->used) {
-         tselem->flag &= ~TSE_CLOSED;
-       }
-     }
-   }
+   ListBase tree = add_library_contents(*source_data.bmain);
  
-   for (ID *id : List<ID>(source_data.bmain->libraries)) {
-     Library *lib = reinterpret_cast<Library *>(id);
-     TreeElement *ten = add_library_contents(*source_data.bmain, tree, lib);
-     /* NULL-check matters, due to filtering there may not be a new element. */
-     if (ten) {
-       lib->id.newid = (ID *)ten;
+   for (TreeElement *top_level_te : List<TreeElement>(tree)) {
+     TreeStoreElem *tselem = TREESTORE(top_level_te);
+     if (!tselem->used) {
+       tselem->flag &= ~TSE_CLOSED;
      }
    }
  
    return tree;
  }
  
- TreeElement *TreeDisplayOverrideLibraryProperties::add_library_contents(Main &mainvar,
-                                                               ListBase &lb,
-                                                               Library *lib)
 -ListBase TreeDisplayOverrideLibrary::add_library_contents(Main &mainvar)
++ListBase TreeDisplayOverrideLibraryProperties::add_library_contents(Main &mainvar)
  {
+   ListBase tree = {nullptr};
+ 
    const short filter_id_type = id_filter_get();
  
    ListBase *lbarray[INDEX_ID_MAX];
@@@ -167,10 -104,17 +104,17 @@@
      }
    }
  
-   return tenlib;
+   /* Remove ID base elements that turn out to be empty. */
+   LISTBASE_FOREACH_MUTABLE (TreeElement *, te, &tree) {
+     if (BLI_listbase_is_empty(&te->subtree)) {
+       outliner_free_tree_element(te, &tree);
+     }
+   }
+ 
+   return tree;
  }
  
 -short TreeDisplayOverrideLibrary::id_filter_get() const
 +short TreeDisplayOverrideLibraryProperties::id_filter_get() const
  {
    if (space_outliner_.filter & SO_FILTER_ID_TYPE) {
      return space_outliner_.filter_id_type;



More information about the Bf-blender-cvs mailing list