Welcome to mirror list, hosted at ThFree Co, Russian Federation.

outliner_query.cc « space_outliner « editors « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 11929cbe2f0f58e663bb552b1e2fe4f5bcf194ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* SPDX-License-Identifier: GPL-2.0-or-later */

/** \file
 * \ingroup spoutliner
 */

#include <functional>

#include "BLI_listbase.h"

#include "DNA_space_types.h"

#include "outliner_intern.hh"
#include "tree/tree_display.hh"

namespace blender::ed::outliner {

bool outliner_shows_mode_column(const SpaceOutliner &space_outliner)
{
  const AbstractTreeDisplay &tree_display = *space_outliner.runtime->tree_display;

  return tree_display.supportsModeColumn() && (space_outliner.flag & SO_MODE_COLUMN);
}

/**
 * Iterate over the entire tree (including collapsed sub-elements), probing if any of the elements
 * has a warning to be displayed.
 */
bool outliner_has_element_warnings(const SpaceOutliner &space_outliner)
{
  std::function<bool(const ListBase &)> recursive_fn;

  recursive_fn = [&](const ListBase &lb) {
    LISTBASE_FOREACH (const TreeElement *, te, &lb) {
      if (te->abstract_element && !te->abstract_element->getWarning().is_empty()) {
        return true;
      }

      if (recursive_fn(te->subtree)) {
        return true;
      }
    }

    return false;
  };

  return recursive_fn(space_outliner.tree);
}

}  // namespace blender::ed::outliner