Blender  V2.93
deg_builder_relations_view_layer.cc
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2013 Blender Foundation.
17  * All rights reserved.
18  */
19 
27 
28 #include <cstdio>
29 #include <cstdlib>
30 #include <cstring> /* required for STREQ later on. */
31 
32 #include "MEM_guardedalloc.h"
33 
34 #include "BLI_blenlib.h"
35 #include "BLI_utildefines.h"
36 
37 #include "DNA_collection_types.h"
38 #include "DNA_linestyle_types.h"
39 #include "DNA_node_types.h"
40 #include "DNA_object_types.h"
41 #include "DNA_scene_types.h"
42 
43 #include "BKE_layer.h"
44 #include "BKE_main.h"
45 #include "BKE_node.h"
46 
47 #include "DEG_depsgraph.h"
48 #include "DEG_depsgraph_build.h"
49 
52 
53 #include "intern/node/deg_node.h"
57 
58 #include "intern/depsgraph_type.h"
59 
60 namespace blender::deg {
61 
63 {
64  const int restrict_flag = (graph_->mode == DAG_EVAL_VIEWPORT) ? COLLECTION_RESTRICT_VIEWPORT :
66 
67  for (LayerCollection *lc = (LayerCollection *)lb->first; lc; lc = lc->next) {
68  if ((lc->collection->flag & restrict_flag)) {
69  continue;
70  }
71  if ((lc->flag & LAYER_COLLECTION_EXCLUDE) == 0) {
72  build_collection(lc, nullptr, lc->collection);
73  }
74  build_layer_collections(&lc->layer_collections);
75  }
76 }
77 
79 {
80  if (fls->group != nullptr) {
81  build_collection(nullptr, nullptr, fls->group);
82  }
83  if (fls->linestyle != nullptr) {
85  }
86 }
87 
89  ViewLayer *view_layer,
90  eDepsNode_LinkedState_Type linked_state)
91 {
92  /* Setup currently building context. */
93  scene_ = scene;
94  /* Scene objects. */
95  /* NOTE: Nodes builder requires us to pass CoW base because it's being
96  * passed to the evaluation functions. During relations builder we only
97  * do nullptr-pointer check of the base, so it's fine to pass original one. */
98  LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {
99  if (need_pull_base_into_graph(base)) {
100  build_object(base->object);
101  }
102  }
103 
105 
106  if (scene->camera != nullptr) {
108  }
109  /* Rigidbody. */
110  if (scene->rigidbody_world != nullptr) {
112  }
113  /* Scene's animation and drivers. */
114  if (scene->adt != nullptr) {
116  }
117  /* World. */
118  if (scene->world != nullptr) {
120  }
121  /* Masks. */
123  build_mask(mask);
124  }
125  /* Movie clips. */
127  build_movieclip(clip);
128  }
129  /* Material override. */
130  if (view_layer->mat_override != nullptr) {
131  build_material(view_layer->mat_override);
132  }
133  /* Freestyle linesets. */
136  }
137  /* Scene parameters, compositor and such. */
140  /* Make final scene evaluation dependent on view layer evaluation. */
141  OperationKey scene_view_layer_key(
144  add_relation(scene_view_layer_key, scene_eval_key, "View Layer -> Scene Eval");
145  /* Sequencer. */
146  if (linked_state == DEG_ID_LINKED_DIRECTLY) {
149  }
150  /* Build all set scenes. */
151  if (scene->set != nullptr) {
152  ViewLayer *set_view_layer = BKE_view_layer_default_render(scene->set);
153  build_view_layer(scene->set, set_view_layer, DEG_ID_LINKED_VIA_SET);
154  }
155 }
156 
157 } // namespace blender::deg
struct ViewLayer * BKE_view_layer_default_render(const struct Scene *scene)
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:172
@ DAG_EVAL_VIEWPORT
Definition: DEG_depsgraph.h:61
Object groups, one object can be in many groups at once.
@ COLLECTION_RESTRICT_RENDER
@ COLLECTION_RESTRICT_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(Base *base)
Definition: deg_builder.cc:80
virtual void build_freestyle_linestyle(FreestyleLineStyle *linestyle)
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
eDepsNode_LinkedState_Type
Definition: deg_node_id.h:40
@ DEG_ID_LINKED_VIA_SET
Definition: deg_node_id.h:44
@ DEG_ID_LINKED_DIRECTLY
Definition: deg_node_id.h:46
struct Collection * group
struct FreestyleLineStyle * linestyle
void * first
Definition: DNA_listBase.h:47
ListBase masks
Definition: BKE_main.h:178
ListBase movieclips
Definition: BKE_main.h:177
struct RigidBodyWorld * rigidbody_world
struct AnimData * adt
struct Object * camera
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:136
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)