Blender V4.3
depsgraph_relation.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2020 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#include "intern/depsgraph_relation.hh" /* own include */
10
11#include "BLI_utildefines.h"
12
15
16namespace blender::deg {
17
18Relation::Relation(Node *from, Node *to, const char *description)
19 : from(from), to(to), name(description), flag(0)
20{
21 /* Hook it up to the nodes which use it.
22 *
23 * NOTE: We register relation in the nodes which this link connects to here
24 * in constructor but we don't un-register it in the destructor.
25 *
26 * Reasoning:
27 *
28 * - Destructor is currently used on global graph destruction, so there's no
29 * real need in avoiding dangling pointers, all the memory is to be freed
30 * anyway.
31 *
32 * - Un-registering relation is not a cheap operation, so better to have it
33 * as an explicit call if we need this. */
34 from->outlinks.append(this);
35 to->inlinks.append(this);
36}
37
39{
40 /* Sanity check. */
41 BLI_assert(from != nullptr && to != nullptr);
42}
43
45{
46 /* Sanity check. */
47 BLI_assert(from != nullptr && to != nullptr);
48 from->outlinks.remove_first_occurrence_and_reorder(this);
49 to->inlinks.remove_first_occurrence_and_reorder(this);
50}
51
52} // namespace blender::deg
#define BLI_assert(a)
Definition BLI_assert.h:50
Relation(Node *from, Node *to, const char *description)
uint8_t flag
Definition wm_window.cc:138