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>2022-05-25 20:29:39 +0300
committerJulian Eisel <julian@blender.org>2022-05-25 21:16:17 +0300
commit6feca523496bd18111dfedf2fc2a29bda6d93612 (patch)
tree5f38b0c7cdad201d6173c61e71de4607c05dd4dd /source/blender/editors/space_outliner/tree
parentf1df685f570bbd248b0356fdb4afda1b181d6a09 (diff)
Outliner: Use general warning mechanics for library overrides
Library overrides were basically using their own system to display warnings for tree elements, even though for other display elements we have a more general solution. With the previous commit this has been generalized further and made trivial to extend.
Diffstat (limited to 'source/blender/editors/space_outliner/tree')
-rw-r--r--source/blender/editors/space_outliner/tree/tree_element.hh2
-rw-r--r--source/blender/editors/space_outliner/tree/tree_element_overrides.cc24
-rw-r--r--source/blender/editors/space_outliner/tree/tree_element_overrides.hh4
3 files changed, 29 insertions, 1 deletions
diff --git a/source/blender/editors/space_outliner/tree/tree_element.hh b/source/blender/editors/space_outliner/tree/tree_element.hh
index d665ff49f53..0dcd75d340d 100644
--- a/source/blender/editors/space_outliner/tree/tree_element.hh
+++ b/source/blender/editors/space_outliner/tree/tree_element.hh
@@ -61,7 +61,7 @@ class AbstractTreeElement {
* By letting this return a warning message, the tree element will display a warning icon with
* the message in the tooltip.
*/
- virtual blender::StringRefNull getWarning() const;
+ virtual StringRefNull getWarning() const;
/**
* Expand this tree element if it is displayed for the first time (as identified by its
diff --git a/source/blender/editors/space_outliner/tree/tree_element_overrides.cc b/source/blender/editors/space_outliner/tree/tree_element_overrides.cc
index 3a039da86c2..53e7b88c923 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_overrides.cc
+++ b/source/blender/editors/space_outliner/tree/tree_element_overrides.cc
@@ -38,6 +38,19 @@ TreeElementOverridesBase::TreeElementOverridesBase(TreeElement &legacy_te, ID &i
}
}
+StringRefNull TreeElementOverridesBase::getWarning() const
+{
+ if (id.flag & LIB_LIB_OVERRIDE_RESYNC_LEFTOVER) {
+ return TIP_("This override data-block is not needed anymore, but was detected as user-edited");
+ }
+
+ if (ID_IS_OVERRIDE_LIBRARY_REAL(&id) && ID_REAL_USERS(&id) == 0) {
+ return TIP_("This override data-block is unused");
+ }
+
+ return {};
+}
+
void TreeElementOverridesBase::expand(SpaceOutliner &space_outliner) const
{
BLI_assert(id.override_library != nullptr);
@@ -93,4 +106,15 @@ TreeElementOverridesProperty::TreeElementOverridesProperty(TreeElement &legacy_t
legacy_te.name = override_data.override_property.rna_path;
}
+StringRefNull TreeElementOverridesProperty::getWarning() const
+{
+ if (!is_rna_path_valid) {
+ return TIP_(
+ "This override property does not exist in current data, it will be removed on "
+ "next .blend file save");
+ }
+
+ return {};
+}
+
} // namespace blender::ed::outliner
diff --git a/source/blender/editors/space_outliner/tree/tree_element_overrides.hh b/source/blender/editors/space_outliner/tree/tree_element_overrides.hh
index b42e1c37a0f..1db46d9af1d 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_overrides.hh
+++ b/source/blender/editors/space_outliner/tree/tree_element_overrides.hh
@@ -34,6 +34,8 @@ class TreeElementOverridesBase final : public AbstractTreeElement {
TreeElementOverridesBase(TreeElement &legacy_te, ID &id);
void expand(SpaceOutliner &) const override;
+
+ StringRefNull getWarning() const override;
};
class TreeElementOverridesProperty final : public AbstractTreeElement {
@@ -46,6 +48,8 @@ class TreeElementOverridesProperty final : public AbstractTreeElement {
public:
TreeElementOverridesProperty(TreeElement &legacy_te, TreeElementOverridesData &override_data);
+
+ StringRefNull getWarning() const override;
};
} // namespace blender::ed::outliner