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:
authorJulian Eisel <julian@blender.org>2020-12-28 00:15:20 +0300
committerJulian Eisel <julian@blender.org>2020-12-28 00:45:41 +0300
commitaa64fd69e733e49317101ea60299f2179830ae95 (patch)
tree5546b93625c908945a6123e27110f55c793e8bc8 /source/blender/editors
parent960a0b892c096965696bbd93d0782001d53c869e (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')
-rw-r--r--source/blender/editors/space_outliner/outliner_dragdrop.c2
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c4
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c3
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c36
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c8
-rw-r--r--source/blender/editors/undo/ed_undo.c8
6 files changed, 56 insertions, 5 deletions
diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.c b/source/blender/editors/space_outliner/outliner_dragdrop.c
index 152bbc96281..ab515c0c3a8 100644
--- a/source/blender/editors/space_outliner/outliner_dragdrop.c
+++ b/source/blender/editors/space_outliner/outliner_dragdrop.c
@@ -493,7 +493,7 @@ static bool parent_clear_poll(bContext *C,
case ID_OB:
return ELEM(tselem->type, TSE_MODIFIER_BASE, TSE_CONSTRAINT_BASE);
case ID_GR:
- return event->shift;
+ return event->shift || ELEM(tselem->type, TSE_LIBRARY_OVERRIDE_BASE);
default:
return true;
}
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 9223da136e1..8c6e4329577 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -2180,6 +2180,10 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
data.icon = ICON_MODIFIER_DATA;
data.drag_id = tselem->id;
break;
+ case TSE_LIBRARY_OVERRIDE_BASE:
+ case TSE_LIBRARY_OVERRIDE:
+ data.icon = ICON_LIBRARY_DATA_OVERRIDE;
+ break;
case TSE_LINKED_OB:
data.icon = ICON_OBJECT_DATA;
break;
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index ef152c473f4..8170f1006a5 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -331,7 +331,8 @@ static void do_item_rename(ARegion *region,
TSE_POSEGRP_BASE,
TSE_R_LAYER_BASE,
TSE_SCENE_COLLECTION_BASE,
- TSE_VIEW_COLLECTION_BASE)) {
+ TSE_VIEW_COLLECTION_BASE,
+ TSE_LIBRARY_OVERRIDE_BASE)) {
BKE_report(reports, RPT_WARNING, "Cannot edit builtin name");
}
else if (ELEM(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) {
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);
+ }
}
/**
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index c7c207caca0..06946e4c90b 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -112,6 +112,12 @@ static void outliner_main_region_listener(wmWindow *UNUSED(win),
/* context changes */
switch (wmn->category) {
+ case NC_WM:
+ switch (wmn->data) {
+ case ND_LIB_OVERRIDE_CHANGED:
+ ED_region_tag_redraw(region);
+ break;
+ }
case NC_SCENE:
switch (wmn->data) {
case ND_OB_ACTIVE:
@@ -152,8 +158,6 @@ static void outliner_main_region_listener(wmWindow *UNUSED(win),
case NC_OBJECT:
switch (wmn->data) {
case ND_TRANSFORM:
- /* transform doesn't change outliner data */
- break;
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
case ND_DRAW:
diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c
index 2328f7d5256..533416bf85e 100644
--- a/source/blender/editors/undo/ed_undo.c
+++ b/source/blender/editors/undo/ed_undo.c
@@ -145,12 +145,14 @@ void ED_undo_push(bContext *C, const char *str)
}
}
+ UndoPushReturn push_retval;
+
/* Only apply limit if this is the last undo step. */
if (wm->undo_stack->step_active && (wm->undo_stack->step_active->next == NULL)) {
BKE_undosys_stack_limit_steps_and_memory(wm->undo_stack, steps - 1, 0);
}
- BKE_undosys_step_push(wm->undo_stack, C, str);
+ push_retval = BKE_undosys_step_push(wm->undo_stack, C, str);
if (U.undomemory != 0) {
const size_t memory_limit = (size_t)U.undomemory * 1024 * 1024;
@@ -160,6 +162,10 @@ void ED_undo_push(bContext *C, const char *str)
if (CLOG_CHECK(&LOG, 1)) {
BKE_undosys_print(wm->undo_stack);
}
+
+ if (push_retval & UNDO_PUSH_RET_OVERRIDE_CHANGED) {
+ WM_main_add_notifier(NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
+ }
}
/**