Blender V5.0
deg_node_id.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2013 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
13
14#include "DNA_ID.h"
15
16#include "BLI_map.hh"
17#include "BLI_string_ref.hh"
18#include "BLI_sys_types.h"
19
20namespace blender::deg {
21
22struct ComponentNode;
23
25
26/* NOTE: We use max comparison to mark an id node that is linked more than once
27 * So keep this enum ordered accordingly. */
29 /* Generic indirectly linked id node. */
31 /* Id node present in the set (background) only. */
33 /* Id node directly linked via the SceneLayer. */
35};
36const char *linkedStateAsString(eDepsNode_LinkedState_Type linked_state);
37
38/* ID-Block Reference */
39struct IDNode : public Node {
52
54 void init(const ID *id, const char *subdata) override;
55 void init_copy_on_write(ID *id_cow_hint = nullptr);
56 ~IDNode() override;
57 void destroy();
58
59 std::string identifier() const override;
60
63
64 void tag_update(Depsgraph *graph, eUpdateSource source) override;
65
66 void finalize_build(Depsgraph *graph);
67
69
70 /* Type of the ID stored separately, so it's possible to perform check whether evaluated copy is
71 * needed without de-referencing the id_cow (which is not safe when ID is NOT covered by
72 * copy-on-evaluation and has been deleted from the main database.) */
74
75 /* ID Block referenced. */
77
78 /* Session-wide UUID of the id_orig.
79 * Is used on relations update to map evaluated state from old nodes to the new ones, without
80 * relying on pointers (which are not guaranteed to be unique) and without dereferencing id_orig
81 * which could be "stale" pointer. */
83
84 /* Evaluated data-block.
85 * Will be covered by the copy-on-evaluation system if the ID Type needs it. */
87
88 /* Hash to make it faster to look up components. */
90
91 /* Additional flags needed for scene evaluation.
92 * TODO(sergey): Only needed for until really granular updates
93 * of all the entities. */
94 uint32_t eval_flags;
96
97 /* Extra customdata mask which needs to be evaluated for the mesh object. */
100
102
103 /* Indicates the data-block is to be considered visible in the evaluated scene.
104 *
105 * This flag is set during dependency graph build where check for an actual visibility might not
106 * be available yet due to driven or animated restriction flags. So it is more of an intent or,
107 * in other words, plausibility of the data-block to be visible. */
109
110 /* Evaluated state of whether evaluation considered this data-block "enabled".
111 *
112 * For objects this is derived from the base restriction flags, which might be animated or
113 * driven. It is set to `BASE_ENABLED_<VIEWPORT, RENDER>` (depending on the graph mode) after
114 * the object's flags from layer were evaluated.
115 *
116 * For other data-types is currently always true. */
118
119 /* For the collection type of ID, denotes whether collection was fully
120 * recursed into. */
122
123 /* Is used to figure out whether object came to the dependency graph via a base. */
125
126 /* Accumulated flag from operation. Is initialized and used during updates flush. */
128
129 /* Copy-on-Write component has been explicitly tagged for update. */
131
132 /* Accumulate recalc flags from multiple update passes. */
134
137
139};
140
141} // namespace blender::deg
unsigned int uint
ID and Library types, which are fundamental for SDNA.
ID_Type
void init()
unsigned long long int uint64_t
uint64_t IDComponentsMask
const char * linkedStateAsString(eDepsNode_LinkedState_Type linked_state)
@ DEG_ID_LINKED_INDIRECTLY
uint64_t get_default_hash(const T &v, const Args &...args)
Definition BLI_hash.hh:233
const char * name
Definition DNA_ID.h:414
ComponentIDKey(NodeType type, StringRef name="")
BLI_STRUCT_EQUALITY_OPERATORS_2(ComponentIDKey, type, name)
IDComponentsMask previously_visible_components_mask
void init_copy_on_write(ID *id_cow_hint=nullptr)
DEGCustomDataMeshMasks customdata_masks
DEGCustomDataMeshMasks previous_customdata_masks
ComponentNode * add_component(NodeType type, StringRef name="")
IDComponentsMask visible_components_mask
Map< ComponentIDKey, ComponentNode * > components
IDComponentsMask get_visible_components_mask() const
void finalize_build(Depsgraph *graph)
std::string identifier() const override
eDepsNode_LinkedState_Type linked_state
ComponentNode * find_component(NodeType type, StringRef name="") const
void tag_update(Depsgraph *graph, eUpdateSource source) override
uint32_t previous_eval_flags