Blender  V3.3
deg_builder_relations_view_layer.cc
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 
11 
12 #include <cstdio>
13 #include <cstdlib>
14 #include <cstring> /* required for STREQ later on. */
15 
16 #include "MEM_guardedalloc.h"
17 
18 #include "BLI_blenlib.h"
19 #include "BLI_utildefines.h"
20 
21 #include "DNA_collection_types.h"
22 #include "DNA_linestyle_types.h"
23 #include "DNA_node_types.h"
24 #include "DNA_object_types.h"
25 #include "DNA_scene_types.h"
26 
27 #include "BKE_layer.h"
28 #include "BKE_main.h"
29 #include "BKE_node.h"
30 
31 #include "DEG_depsgraph.h"
32 #include "DEG_depsgraph_build.h"
33 
36 
37 #include "intern/node/deg_node.h"
41 
42 #include "intern/depsgraph_type.h"
43 
44 namespace blender::deg {
45 
47 {
48  const int visibility_flag = (graph_->mode == DAG_EVAL_VIEWPORT) ? COLLECTION_HIDE_VIEWPORT :
50 
51  for (LayerCollection *lc = (LayerCollection *)lb->first; lc; lc = lc->next) {
52  if (lc->collection->flag & visibility_flag) {
53  continue;
54  }
55  if ((lc->flag & LAYER_COLLECTION_EXCLUDE) == 0) {
56  build_collection(lc, nullptr, lc->collection);
57  }
58  build_layer_collections(&lc->layer_collections);
59  }
60 }
61 
63 {
64  if (fls->group != nullptr) {
65  build_collection(nullptr, nullptr, fls->group);
66  }
67  if (fls->linestyle != nullptr) {
69  }
70 }
71 
73  ViewLayer *view_layer,
74  eDepsNode_LinkedState_Type linked_state)
75 {
76  /* Setup currently building context. */
77  scene_ = scene;
78  /* Scene objects. */
79  /* NOTE: Nodes builder requires us to pass CoW base because it's being
80  * passed to the evaluation functions. During relations builder we only
81  * do nullptr-pointer check of the base, so it's fine to pass original one. */
82  LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {
83  if (need_pull_base_into_graph(base)) {
85  }
86  }
87 
89 
91  /* Rigidbody. */
92  if (scene->rigidbody_world != nullptr) {
94  }
95  /* Scene's animation and drivers. */
96  if (scene->adt != nullptr) {
98  }
99  /* World. */
100  if (scene->world != nullptr) {
102  }
103  /* Masks. */
105  build_mask(mask);
106  }
107  /* Movie clips. */
109  build_movieclip(clip);
110  }
111  /* Material override. */
112  if (view_layer->mat_override != nullptr) {
113  build_material(view_layer->mat_override);
114  }
115  /* Freestyle linesets. */
118  }
119  /* Scene parameters, compositor and such. */
122  /* Make final scene evaluation dependent on view layer evaluation. */
123  OperationKey scene_view_layer_key(
126  add_relation(scene_view_layer_key, scene_eval_key, "View Layer -> Scene Eval");
127  /* Sequencer. */
128  if (linked_state == DEG_ID_LINKED_DIRECTLY) {
131  }
132  /* Build all set scenes. */
133  if (scene->set != nullptr) {
134  ViewLayer *set_view_layer = BKE_view_layer_default_render(scene->set);
135  build_view_layer(scene->set, set_view_layer, DEG_ID_LINKED_VIA_SET);
136  }
137 }
138 
139 } // namespace blender::deg
struct ViewLayer * BKE_view_layer_default_render(const struct Scene *scene)
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
@ DAG_EVAL_VIEWPORT
Definition: DEG_depsgraph.h:45
Object groups, one object can be in many groups at once.
@ COLLECTION_HIDE_RENDER
@ COLLECTION_HIDE_VIEWPORT
@ LAYER_COLLECTION_EXCLUDE
Object is a sort of wrapper for general info.
Read Guarded memory(de)allocation.
virtual bool need_pull_base_into_graph(const Base *base)
Definition: deg_builder.cc:67
virtual void build_freestyle_linestyle(FreestyleLineStyle *linestyle)
virtual void build_object_from_view_layer_base(Object *object)
virtual void build_collection(LayerCollection *from_layer_collection, Object *object, Collection *collection)
virtual void build_view_layer(Scene *scene, ViewLayer *view_layer, eDepsNode_LinkedState_Type linked_state)
virtual void build_scene_sequencer(Scene *scene)
virtual void build_movieclip(MovieClip *clip)
Relation * add_relation(const KeyFrom &key_from, const KeyTo &key_to, const char *description, int flags=0)
virtual void build_freestyle_lineset(FreestyleLineSet *fls)
Scene scene
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Definition: math_float4.h:513
eDepsNode_LinkedState_Type
Definition: deg_node_id.h:23
@ DEG_ID_LINKED_VIA_SET
Definition: deg_node_id.h:27
@ DEG_ID_LINKED_DIRECTLY
Definition: deg_node_id.h:29
struct Collection * group
struct FreestyleLineStyle * linestyle
void * first
Definition: DNA_listBase.h:31
ListBase masks
Definition: BKE_main.h:200
ListBase movieclips
Definition: BKE_main.h:199
struct RigidBodyWorld * rigidbody_world
struct AnimData * adt
struct World * world
struct Scene * set
struct FreestyleConfig freestyle_config
ListBase layer_collections
ListBase object_bases
struct Material * mat_override
eEvaluationMode mode
Definition: depsgraph.h:130