diff options
author | Julian Eisel <julian@blender.org> | 2020-12-28 00:15:20 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-12-28 00:45:41 +0300 |
commit | aa64fd69e733e49317101ea60299f2179830ae95 (patch) | |
tree | 5546b93625c908945a6123e27110f55c793e8bc8 /source/blender/editors/space_outliner/outliner_tree.c | |
parent | 960a0b892c096965696bbd93d0782001d53c869e (diff) |
UI: List library overrides in the Outliner
Having a centeral place to find a list of all library overrides should be
useful for managing production scenes where library overrides are used a lot.
This change adds the individually overridden properties of a data-block under
the data-block itself. Just how we show modifiers, constraints or pose channels
there. This way we can also expose library override operations/options better
in future.
There's also a filter option for the library overrides now, so they can be
hidden. It is only available in the View Layer display mode though, like the
other filter options.
One internal change this has to do is adding more informative return values to
undo pushes and the library override functions called by it. That way we can
send a notifier when library overrides change for the Outliner to know when to
rebuild the tree.
Differential Revision: https://developer.blender.org/D7631
Reviewed by: Andy Goralczyk, Bastien Montagne, William Reynish
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_tree.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_tree.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 56eedcd3748..11894548016 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -66,6 +66,7 @@ #include "BKE_idtype.h" #include "BKE_layer.h" #include "BKE_lib_id.h" +#include "BKE_lib_override.h" #include "BKE_main.h" #include "BKE_modifier.h" #include "BKE_outliner_treehash.h" @@ -640,6 +641,30 @@ static void outliner_add_object_contents(SpaceOutliner *space_outliner, } } +static void outliner_add_library_override_contents(SpaceOutliner *soops, TreeElement *te, ID *id) +{ + if (!id->override_library) { + return; + } + + PointerRNA idpoin; + RNA_id_pointer_create(id, &idpoin); + + PointerRNA override_ptr; + PropertyRNA *override_prop; + int index = 0; + LISTBASE_FOREACH (IDOverrideLibraryProperty *, op, &id->override_library->properties) { + if (!BKE_lib_override_rna_property_find(&idpoin, op, &override_ptr, &override_prop)) { + BLI_assert(false); + continue; + } + + TreeElement *ten = outliner_add_element( + soops, &te->subtree, id, te, TSE_LIBRARY_OVERRIDE, index++); + ten->name = RNA_property_ui_name(override_prop); + } +} + /* Can be inlined if necessary. */ static void outliner_add_id_contents(SpaceOutliner *space_outliner, TreeElement *te, @@ -903,6 +928,17 @@ static void outliner_add_id_contents(SpaceOutliner *space_outliner, default: break; } + + const bool lib_overrides_visible = !SUPPORT_FILTER_OUTLINER(space_outliner) || + ((space_outliner->filter & SO_FILTER_NO_LIB_OVERRIDE) == 0); + + if (lib_overrides_visible && ID_IS_OVERRIDE_LIBRARY(id)) { + TreeElement *ten = outliner_add_element( + space_outliner, &te->subtree, id, te, TSE_LIBRARY_OVERRIDE_BASE, 0); + + ten->name = IFACE_("Library Overrides"); + outliner_add_library_override_contents(space_outliner, ten, id); + } } /** |