Blender
V3.3
source
blender
depsgraph
intern
depsgraph_relation.cc
Go to the documentation of this file.
1
/* SPDX-License-Identifier: GPL-2.0-or-later
2
* Copyright 2020 Blender Foundation. All rights reserved. */
3
8
#include "
intern/depsgraph_relation.h
"
/* own include */
9
10
#include "
BLI_utildefines.h
"
11
12
#include "
intern/depsgraph_type.h
"
13
#include "
intern/node/deg_node.h
"
14
15
namespace
blender::deg
{
16
17
Relation::Relation
(
Node
*
from
,
Node
*to,
const
char
*description)
18
:
from
(
from
), to(to), name(description), flag(0)
19
{
20
/* Hook it up to the nodes which use it.
21
*
22
* NOTE: We register relation in the nodes which this link connects to here
23
* in constructor but we don't un-register it in the destructor.
24
*
25
* Reasoning:
26
*
27
* - Destructor is currently used on global graph destruction, so there's no
28
* real need in avoiding dangling pointers, all the memory is to be freed
29
* anyway.
30
*
31
* - Un-registering relation is not a cheap operation, so better to have it
32
* as an explicit call if we need this. */
33
from
->
outlinks
.
append
(
this
);
34
to
->
inlinks
.
append
(
this
);
35
}
36
37
Relation::~Relation
()
38
{
39
/* Sanity check. */
40
BLI_assert
(
from
!=
nullptr
&&
to
!=
nullptr
);
41
}
42
43
void
Relation::unlink
()
44
{
45
/* Sanity check. */
46
BLI_assert
(
from
!=
nullptr
&&
to
!=
nullptr
);
47
from
->
outlinks
.
remove_first_occurrence_and_reorder
(
this
);
48
to
->
inlinks
.
remove_first_occurrence_and_reorder
(
this
);
49
}
50
51
}
// namespace blender::deg
BLI_assert
#define BLI_assert(a)
Definition:
BLI_assert.h:46
BLI_utildefines.h
blender::Vector::append
void append(const T &value)
Definition:
BLI_vector.hh:433
blender::Vector::remove_first_occurrence_and_reorder
void remove_first_occurrence_and_reorder(const T &value)
Definition:
BLI_vector.hh:761
from
StackEntry * from
Definition:
deg_builder_cycle.cc:39
deg_node.h
depsgraph_relation.h
depsgraph_type.h
blender::deg
Definition:
deg_builder.cc:40
blender::deg::Node
Definition:
deg_node.h:146
blender::deg::Node::inlinks
Relations inlinks
Definition:
deg_node.h:173
blender::deg::Node::outlinks
Relations outlinks
Definition:
deg_node.h:174
blender::deg::Relation::~Relation
~Relation()
Definition:
depsgraph_relation.cc:37
blender::deg::Relation::to
Node * to
Definition:
depsgraph_relation.h:42
blender::deg::Relation::from
Node * from
Definition:
depsgraph_relation.h:41
blender::deg::Relation::unlink
void unlink()
Definition:
depsgraph_relation.cc:43
blender::deg::Relation::Relation
Relation(Node *from, Node *to, const char *description)
Definition:
depsgraph_relation.cc:17
Generated on Tue Oct 22 2024 13:18:25 for Blender by
doxygen
1.9.1