Blender  V3.3
deg_node_id.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2013 Blender Foundation. All rights reserved. */
3 
8 #pragma once
9 
10 #include "BLI_ghash.h"
11 #include "BLI_sys_types.h"
12 #include "DNA_ID.h"
13 #include "intern/node/deg_node.h"
14 
15 namespace blender::deg {
16 
17 struct ComponentNode;
18 
20 
21 /* NOTE: We use max comparison to mark an id node that is linked more than once
22  * So keep this enum ordered accordingly. */
24  /* Generic indirectly linked id node. */
26  /* Id node present in the set (background) only. */
28  /* Id node directly linked via the SceneLayer. */
30 };
31 const char *linkedStateAsString(eDepsNode_LinkedState_Type linked_state);
32 
33 /* ID-Block Reference */
34 struct IDNode : public Node {
35  struct ComponentIDKey {
36  ComponentIDKey(NodeType type, const char *name = "");
37  uint64_t hash() const;
38  bool operator==(const ComponentIDKey &other) const;
39 
41  const char *name;
42  };
43 
45  virtual void init(const ID *id, const char *subdata) override;
46  void init_copy_on_write(ID *id_cow_hint = nullptr);
47  ~IDNode();
48  void destroy();
49 
50  virtual string identifier() const override;
51 
52  ComponentNode *find_component(NodeType type, const char *name = "") const;
53  ComponentNode *add_component(NodeType type, const char *name = "");
54 
55  virtual void tag_update(Depsgraph *graph, eUpdateSource source) override;
56 
58 
60 
61  /* Type of the ID stored separately, so it's possible to perform check whether CoW is needed
62  * without de-referencing the id_cow (which is not safe when ID is NOT covered by CoW and has
63  * been deleted from the main database.) */
65 
66  /* ID Block referenced. */
68 
69  /* Session-wide UUID of the id_orig.
70  * Is used on relations update to map evaluated state from old nodes to the new ones, without
71  * relying on pointers (which are not guaranteed to be unique) and without dereferencing id_orig
72  * which could be "stale" pointer. */
74 
75  /* Evaluated data-block.
76  * Will be covered by the copy-on-write system if the ID Type needs it. */
78 
79  /* Hash to make it faster to look up components. */
81 
82  /* Additional flags needed for scene evaluation.
83  * TODO(sergey): Only needed for until really granular updates
84  * of all the entities. */
87 
88  /* Extra customdata mask which needs to be evaluated for the mesh object. */
91 
93 
94  /* Indicates the data-block is to be considered visible in the evaluated scene.
95  *
96  * This flag is set during dependency graph build where check for an actual visibility might not
97  * be available yet due to driven or animated restriction flags. So it is more of an intent or,
98  * in other words, plausibility of the data-block to be visible. */
100 
101  /* Evaluated state of whether evaluation considered this data-block "enabled".
102  *
103  * For objects this is derived from the base restriction flags, which might be animated or
104  * driven. It is set to `BASE_ENABLED_<VIEWPORT, RENDER>` (depending on the graph mode) after
105  * the object's flags from layer were evaluated.
106  *
107  * For other data-types is currently always true. */
109 
110  /* For the collection type of ID, denotes whether collection was fully
111  * recursed into. */
113 
114  /* Is used to figure out whether object came to the dependency graph via a base. */
115  bool has_base;
116 
117  /* Accumulated flag from operation. Is initialized and used during updates flush. */
119 
120  /* Copy-on-Write component has been explicitly tagged for update. */
122 
123  /* Accumulate recalc flags from multiple update passes. */
125 
128 
130 };
131 
132 } // namespace blender::deg
unsigned int uint
Definition: BLI_sys_types.h:67
ID and Library types, which are fundamental for sdna.
ID_Type
Definition: DNA_ID_enums.h:44
Depsgraph * graph
const char * linkedStateAsString(eDepsNode_LinkedState_Type linked_state)
Definition: deg_node_id.cc:30
uint64_t IDComponentsMask
Definition: deg_node_id.h:17
eDepsNode_LinkedState_Type
Definition: deg_node_id.h:23
@ DEG_ID_LINKED_INDIRECTLY
Definition: deg_node_id.h:25
@ DEG_ID_LINKED_VIA_SET
Definition: deg_node_id.h:27
@ DEG_ID_LINKED_DIRECTLY
Definition: deg_node_id.h:29
unsigned int uint32_t
Definition: stdint.h:80
unsigned __int64 uint64_t
Definition: stdint.h:90
Definition: DNA_ID.h:368
bool operator==(const ComponentIDKey &other) const
Definition: deg_node_id.cc:48
ComponentIDKey(NodeType type, const char *name="")
Definition: deg_node_id.cc:44
IDComponentsMask previously_visible_components_mask
Definition: deg_node_id.h:127
void init_copy_on_write(ID *id_cow_hint=nullptr)
Definition: deg_node_id.cc:83
DEGCustomDataMeshMasks customdata_masks
Definition: deg_node_id.h:89
DEGCustomDataMeshMasks previous_customdata_masks
Definition: deg_node_id.h:90
ComponentNode * add_component(NodeType type, const char *name="")
Definition: deg_node_id.cc:152
virtual string identifier() const override
Definition: deg_node_id.cc:136
IDComponentsMask visible_components_mask
Definition: deg_node_id.h:126
bool is_collection_fully_expanded
Definition: deg_node_id.h:112
virtual void init(const ID *id, const char *subdata) override
Definition: deg_node_id.cc:60
Map< ComponentIDKey, ComponentNode * > components
Definition: deg_node_id.h:80
IDComponentsMask get_visible_components_mask() const
Definition: deg_node_id.cc:188
void finalize_build(Depsgraph *graph)
Definition: deg_node_id.cc:179
ComponentNode * find_component(NodeType type, const char *name="") const
Definition: deg_node_id.cc:146
eDepsNode_LinkedState_Type linked_state
Definition: deg_node_id.h:92
virtual void tag_update(Depsgraph *graph, eUpdateSource source) override
Definition: deg_node_id.cc:167
uint32_t previous_eval_flags
Definition: deg_node_id.h:86