Cycles: support for mask layers in render layer, this has the same effect as
[blender.git] / intern / cycles / blender / blender_mesh.cpp
index c7844782e78c5d95c30bb3a62ec91e4a70692801..9f5446f6e693506ce239a747432e324d8b86b1c9 100644 (file)
@@ -222,20 +222,22 @@ static void create_subd_mesh(Mesh *mesh, BL::Mesh b_mesh, PointerRNA *cmesh, con
 
 /* Sync */
 
 
 /* Sync */
 
-Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated)
+Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool holdout, bool object_updated)
 {
        /* test if we can instance or if the object is modified */
        BL::ID b_ob_data = b_ob.data();
 {
        /* test if we can instance or if the object is modified */
        BL::ID b_ob_data = b_ob.data();
-       BL::ID key = (object_is_modified(b_ob))? b_ob: b_ob_data;
+       BL::ID key = (object_is_modified(b_ob) || holdout)? b_ob: b_ob_data;
 
        /* find shader indices */
        vector<uint> used_shaders;
 
        BL::Object::material_slots_iterator slot;
        for(b_ob.material_slots.begin(slot); slot != b_ob.material_slots.end(); ++slot) {
 
        /* find shader indices */
        vector<uint> used_shaders;
 
        BL::Object::material_slots_iterator slot;
        for(b_ob.material_slots.begin(slot); slot != b_ob.material_slots.end(); ++slot) {
-               BL::Material material_override = render_layers.front().material_override;
+               BL::Material material_override = render_layer.material_override;
 
 
-               if(material_override)
+               if(holdout)
+                       find_shader(PointerRNA_NULL, used_shaders, scene->default_holdout);
+               else if(material_override)
                        find_shader(material_override, used_shaders, scene->default_surface);
                else
                        find_shader(slot->material(), used_shaders, scene->default_surface);
                        find_shader(material_override, used_shaders, scene->default_surface);
                else
                        find_shader(slot->material(), used_shaders, scene->default_surface);