Blender
V2.93
source
blender
depsgraph
intern
depsgraph_relation.cc
Go to the documentation of this file.
1
/*
2
* This program is free software; you can redistribute it and/or
3
* modify it under the terms of the GNU General Public License
4
* as published by the Free Software Foundation; either version 2
5
* of the License, or (at your option) any later version.
6
*
7
* This program is distributed in the hope that it will be useful,
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
* GNU General Public License for more details.
11
*
12
* You should have received a copy of the GNU General Public License
13
* along with this program; if not, write to the Free Software Foundation,
14
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15
*
16
* The Original Code is Copyright (C) 2020 Blender Foundation.
17
* All rights reserved.
18
*/
19
24
#include "
intern/depsgraph_relation.h
"
/* own include */
25
26
#include "
BLI_utildefines.h
"
27
28
#include "
intern/depsgraph_type.h
"
29
#include "
intern/node/deg_node.h
"
30
31
namespace
blender::deg
{
32
33
Relation::Relation
(
Node
*
from
,
Node
*to,
const
char
*description)
34
:
from
(
from
), to(to), name(description), flag(0)
35
{
36
/* Hook it up to the nodes which use it.
37
*
38
* NOTE: We register relation in the nodes which this link connects to here
39
* in constructor but we don't un-register it in the destructor.
40
*
41
* Reasoning:
42
*
43
* - Destructor is currently used on global graph destruction, so there's no
44
* real need in avoiding dangling pointers, all the memory is to be freed
45
* anyway.
46
*
47
* - Un-registering relation is not a cheap operation, so better to have it
48
* as an explicit call if we need this. */
49
from
->
outlinks
.
append
(
this
);
50
to
->
inlinks
.
append
(
this
);
51
}
52
53
Relation::~Relation
()
54
{
55
/* Sanity check. */
56
BLI_assert
(
from
!=
nullptr
&&
to
!=
nullptr
);
57
}
58
59
void
Relation::unlink
()
60
{
61
/* Sanity check. */
62
BLI_assert
(
from
!=
nullptr
&&
to
!=
nullptr
);
63
from
->
outlinks
.
remove_first_occurrence_and_reorder
(
this
);
64
to
->
inlinks
.
remove_first_occurrence_and_reorder
(
this
);
65
}
66
67
}
// namespace blender::deg
BLI_assert
#define BLI_assert(a)
Definition:
BLI_assert.h:58
BLI_utildefines.h
blender::Vector::append
void append(const T &value)
Definition:
BLI_vector.hh:438
blender::Vector::remove_first_occurrence_and_reorder
void remove_first_occurrence_and_reorder(const T &value)
Definition:
BLI_vector.hh:728
from
StackEntry * from
Definition:
deg_builder_cycle.cc:55
deg_node.h
depsgraph_relation.h
depsgraph_type.h
blender::deg
Definition:
deg_builder.cc:53
blender::deg::Node
Definition:
deg_node.h:148
blender::deg::Node::inlinks
Relations inlinks
Definition:
deg_node.h:175
blender::deg::Node::outlinks
Relations outlinks
Definition:
deg_node.h:176
blender::deg::Relation::~Relation
~Relation()
Definition:
depsgraph_relation.cc:53
blender::deg::Relation::to
Node * to
Definition:
depsgraph_relation.h:59
blender::deg::Relation::from
Node * from
Definition:
depsgraph_relation.h:58
blender::deg::Relation::unlink
void unlink()
Definition:
depsgraph_relation.cc:59
blender::deg::Relation::Relation
Relation(Node *from, Node *to, const char *description)
Definition:
depsgraph_relation.cc:33
Generated on Tue Jan 31 2023 14:37:24 for Blender by
doxygen
1.9.1