Blender V5.3
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
12
13#include "DNA_ID.h"
14
15#include "BLI_map.hh"
16#include "BLI_string_ref.hh"
17#include "BLI_sys_types.hh"
18
19namespace blender::deg {
20
21struct ComponentNode;
22
24
25/* NOTE: We use max comparison to mark an id node that is linked more than once
26 * So keep this enum ordered accordingly. */
28 /* Generic indirectly linked id node. */
30 /* Id node present in the set (background) only. */
32 /* Id node directly linked via the SceneLayer. */
34};
35const char *linkedStateAsString(eDepsNode_LinkedState_Type linked_state);
36
37/* ID-Block Reference */
38struct IDNode : public Node {
40
43
45 friend bool operator==(const ComponentIDKey &a, const ComponentIDKey &b) = default;
46 uint64_t hash() const
47 {
48 return get_default_hash(type, name);
49 }
50 };
51
53 void init(const ID *id, const char *subdata) override;
54 void init_copy_on_write(ID *id_cow_hint = nullptr);
55 ~IDNode() override;
56 void destroy();
57
58 std::string identifier() const override;
59
62
63 void tag_update(Depsgraph *graph, eUpdateSource source) override;
64
65 void finalize_build(Depsgraph *graph);
66
68
69 /* Type of the ID stored separately, so it's possible to perform check whether evaluated copy is
70 * needed without de-referencing the id_cow (which is not safe when ID is NOT covered by
71 * copy-on-evaluation and has been deleted from the main database.) */
73
74 /* ID Block referenced. */
76
77 /* Session-wide UUID of the id_orig.
78 * Is used on relations update to map evaluated state from old nodes to the new ones, without
79 * relying on pointers (which are not guaranteed to be unique) and without dereferencing id_orig
80 * which could be "stale" pointer. */
82
83 /* Evaluated data-block.
84 * Will be covered by the copy-on-evaluation system if the ID Type needs it. */
86
87 /* Hash to make it faster to look up components. */
89
90 /* Additional flags needed for scene evaluation.
91 * TODO(sergey): Only needed for until really granular updates
92 * of all the entities. */
95
96 /* Extra customdata mask which needs to be evaluated for the mesh object. */
99
101
102 /* Indicates the data-block is to be considered visible in the evaluated scene.
103 *
104 * This flag is set during dependency graph build where check for an actual visibility might not
105 * be available yet due to driven or animated restriction flags. So it is more of an intent or,
106 * in other words, plausibility of the data-block to be visible. */
108
109 /* Evaluated state of whether evaluation considered this data-block "enabled".
110 *
111 * For objects this is derived from the base restriction flags, which might be animated or
112 * driven. It is set to `BASE_ENABLED_<VIEWPORT, RENDER>` (depending on the graph mode) after
113 * the object's flags from layer were evaluated.
114 *
115 * For other data-types is currently always true. */
117
118 /* For the collection type of ID, denotes whether collection was fully
119 * recursed into. */
121
122 /* Is used to figure out whether object came to the dependency graph via a base. */
124
125 /* Accumulated flag from operation. Is initialized and used during updates flush. */
127
128 /* Copy-on-Write component has been explicitly tagged for update. */
130
131 /* Accumulate recalc flags from multiple update passes. */
133
136
138};
139
140} // namespace blender::deg
ID and Library types, which are fundamental for SDNA.
uint64_t IDComponentsMask
const char * linkedStateAsString(eDepsNode_LinkedState_Type linked_state)
@ DEG_ID_LINKED_INDIRECTLY
unsigned __int64 uint64_t
Definition BKE_text.h:91
unsigned int uint
Definition BKE_text.h:55
unsigned int uint32_t
Definition BKE_text.h:81
constexpr uint64_t get_default_hash(const T &v, const Args &...args)
Definition BLI_hash.hh:252
friend bool operator==(const ComponentIDKey &a, const ComponentIDKey &b)=default
ComponentIDKey(NodeType type, StringRef 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
std::string name
Definition deg_node.hh:186