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 13:53:07 +0300
committerJulian Eisel <julian@blender.org>2022-05-25 21:16:17 +0300
commitf1df685f570bbd248b0356fdb4afda1b181d6a09 (patch)
tree9d3ae9b30bd43550059f69d6c2b3b9978ca81d5e /source/blender/editors/space_outliner/tree/tree_element.hh
parent1a516bb714bf2892d9d10dc83cc1215a41a3d1ea (diff)
Outliner: Refactor element warning and mode column querying
Uses a inheritance based approach for querying warning of tree elements and the mode column support of display modes. For the warnings, tree elements can override the `AbstractTreeElement::getWarning()` method and return a warning string. The UI will draw the warning column with warning icons. This makes the warning column more generalized and easier to extend to more use-cases. E.g. library override elements will use this after a followup commit. To support mode toggles a display mode can now just return true in the `AbstractTreeDisplay::supportsModeColumn()` method. This makes it trivial to add mode columns to other display modes, and less error prone because there's no need to hunt down a bunch of display mode checks in different places.
Diffstat (limited to 'source/blender/editors/space_outliner/tree/tree_element.hh')
-rw-r--r--source/blender/editors/space_outliner/tree/tree_element.hh17
1 files changed, 8 insertions, 9 deletions
diff --git a/source/blender/editors/space_outliner/tree/tree_element.hh b/source/blender/editors/space_outliner/tree/tree_element.hh
index c6593a517dd..d665ff49f53 100644
--- a/source/blender/editors/space_outliner/tree/tree_element.hh
+++ b/source/blender/editors/space_outliner/tree/tree_element.hh
@@ -8,6 +8,8 @@
#include <memory>
+#include "BLI_string_ref.hh"
+
struct ListBase;
struct SpaceOutliner;
struct TreeElement;
@@ -56,6 +58,12 @@ 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;
+
+ /**
* Expand this tree element if it is displayed for the first time (as identified by its
* tree-store element).
*
@@ -96,13 +104,4 @@ struct TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
void tree_element_expand(const AbstractTreeElement &tree_element, SpaceOutliner &space_outliner);
-/**
- * Get actual warning data of a tree element, if any.
- *
- * \param r_icon: The icon to display as warning.
- * \param r_message: The message to display as warning.
- * \return true if there is a warning, false otherwise.
- */
-bool tree_element_warnings_get(struct TreeElement *te, int *r_icon, const char **r_message);
-
} // namespace blender::ed::outliner