Blender V4.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
9#pragma once
10
11#include "BLI_ghash.h"
12#include "BLI_sys_types.h"
13#include "DNA_ID.h"
15
16namespace blender::deg {
17
18struct ComponentNode;
19
21
22/* NOTE: We use max comparison to mark an id node that is linked more than once
23 * So keep this enum ordered accordingly. */
25 /* Generic indirectly linked id node. */
27 /* Id node present in the set (background) only. */
29 /* Id node directly linked via the SceneLayer. */
31};
32const char *linkedStateAsString(eDepsNode_LinkedState_Type linked_state);
33
34/* ID-Block Reference */
35struct IDNode : public Node {
37 ComponentIDKey(NodeType type, const char *name = "");
38 uint64_t hash() const;
39 bool operator==(const ComponentIDKey &other) const;
40
42 const char *name;
43 };
44
46 virtual void init(const ID *id, const char *subdata) override;
47 void init_copy_on_write(Depsgraph &depsgraph, ID *id_cow_hint = nullptr);
48 ~IDNode();
49 void destroy();
50
51 virtual string identifier() const override;
52
53 ComponentNode *find_component(NodeType type, const char *name = "") const;
54 ComponentNode *add_component(NodeType type, const char *name = "");
55
56 virtual void tag_update(Depsgraph *graph, eUpdateSource source) override;
57
58 void finalize_build(Depsgraph *graph);
59
61
62 /* Type of the ID stored separately, so it's possible to perform check whether evaluated copy is
63 * needed without de-referencing the id_cow (which is not safe when ID is NOT covered by
64 * copy-on-evaluation and has been deleted from the main database.) */
66
67 /* ID Block referenced. */
69
70 /* Session-wide UUID of the id_orig.
71 * Is used on relations update to map evaluated state from old nodes to the new ones, without
72 * relying on pointers (which are not guaranteed to be unique) and without dereferencing id_orig
73 * which could be "stale" pointer. */
75
76 /* Evaluated data-block.
77 * Will be covered by the copy-on-evaluation system if the ID Type needs it. */
79
80 /* Hash to make it faster to look up components. */
82
83 /* Additional flags needed for scene evaluation.
84 * TODO(sergey): Only needed for until really granular updates
85 * of all the entities. */
88
89 /* Extra customdata mask which needs to be evaluated for the mesh object. */
92
94
95 /* Indicates the data-block is to be considered visible in the evaluated scene.
96 *
97 * This flag is set during dependency graph build where check for an actual visibility might not
98 * be available yet due to driven or animated restriction flags. So it is more of an intent or,
99 * in other words, plausibility of the data-block to be visible. */
101
102 /* Evaluated state of whether evaluation considered this data-block "enabled".
103 *
104 * For objects this is derived from the base restriction flags, which might be animated or
105 * driven. It is set to `BASE_ENABLED_<VIEWPORT, RENDER>` (depending on the graph mode) after
106 * the object's flags from layer were evaluated.
107 *
108 * For other data-types is currently always true. */
110
111 /* For the collection type of ID, denotes whether collection was fully
112 * recursed into. */
114
115 /* Is used to figure out whether object came to the dependency graph via a base. */
117
118 /* Accumulated flag from operation. Is initialized and used during updates flush. */
120
121 /* Copy-on-Write component has been explicitly tagged for update. */
123
124 /* Accumulate recalc flags from multiple update passes. */
126
129
131};
132
133} // namespace blender::deg
unsigned int uint
ID and Library types, which are fundamental for SDNA.
ID_Type
void init()
const Depsgraph * depsgraph
uint64_t IDComponentsMask
const char * linkedStateAsString(eDepsNode_LinkedState_Type linked_state)
@ DEG_ID_LINKED_INDIRECTLY
unsigned int uint32_t
Definition stdint.h:80
unsigned __int64 uint64_t
Definition stdint.h:90
Definition DNA_ID.h:413
bool operator==(const ComponentIDKey &other) const
ComponentIDKey(NodeType type, const char *name="")
IDComponentsMask previously_visible_components_mask
DEGCustomDataMeshMasks customdata_masks
DEGCustomDataMeshMasks previous_customdata_masks
ComponentNode * add_component(NodeType type, const char *name="")
virtual string identifier() const override
IDComponentsMask visible_components_mask
void init_copy_on_write(Depsgraph &depsgraph, ID *id_cow_hint=nullptr)
Map< ComponentIDKey, ComponentNode * > components
IDComponentsMask get_visible_components_mask() const
void finalize_build(Depsgraph *graph)
ComponentNode * find_component(NodeType type, const char *name="") const
eDepsNode_LinkedState_Type linked_state
virtual void tag_update(Depsgraph *graph, eUpdateSource source) override
uint32_t previous_eval_flags