Merge branch 'master' into blender2.8
[blender.git] / source / blender / depsgraph / intern / builder / deg_builder_nodes_scene.cc
index 1ea44093cd7a46af9c6a517c75f94d7632f85835..941a9bed5f169ed7ee4875a0b108fd102ea76665 100644 (file)
 
 extern "C" {
 #include "DNA_node_types.h"
+#include "DNA_layer_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 
+#include "BKE_layer.h"
 #include "BKE_main.h"
 #include "BKE_node.h"
 } /* extern "C" */
@@ -63,7 +65,7 @@ extern "C" {
 
 namespace DEG {
 
-void DepsgraphNodeBuilder::build_scene(Scene *scene)
+void DepsgraphNodeBuilder::build_scene(Scene *scene, eDepsNode_LinkedState_Type linked_state)
 {
        /* scene ID block */
        add_id_node(&scene->id);
@@ -75,16 +77,23 @@ void DepsgraphNodeBuilder::build_scene(Scene *scene)
        // XXX: depending on how this goes, that scene itself could probably store its
        //      own little partial depsgraph?
        if (scene->set) {
-               build_scene(scene->set);
+               build_scene(scene->set, DEG_ID_LINKED_VIA_SET);
        }
 
        /* Setup currently building context. */
        scene_ = scene;
 
        /* scene objects */
-       LINKLIST_FOREACH (Base *, base, &scene->base) {
-               Object *ob = base->object;
-               build_object(base, ob);
+       int select_color = 1;
+       for (SceneLayer *sl = (SceneLayer *)scene->render_layers.first; sl; sl = sl->next) {
+               for (Base *base = (Base *)sl->object_bases.first; base; base = base->next) {
+                       /* object itself */
+                       build_object(base->object, linked_state);
+                       base->object->select_color = select_color++;
+               }
+       }
+       if (scene->camera != NULL) {
+               build_object(scene->camera, linked_state);
        }
 
        /* rigidbody */
@@ -130,6 +139,9 @@ void DepsgraphNodeBuilder::build_scene(Scene *scene)
                build_movieclip(clip);
        }
 
+       /* Collections. */
+       build_scene_layer_collections(scene);
+
        /* Parameters evaluation for scene relations mainly. */
        add_operation_node(&scene->id,
                           DEG_NODE_TYPE_PARAMETERS,