Fix #35672: missing update when changing light ray visibility during viewport render.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Sat, 8 Jun 2013 13:43:38 +0000 (13:43 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Sat, 8 Jun 2013 13:43:38 +0000 (13:43 +0000)
intern/cycles/render/light.cpp
intern/cycles/render/light.h

index 71e1f57eb3679f2b8e19d69894318e5ddb10bce1..1d48ae8f87d098fd3887eb973e65c4431049486b 100644 (file)
@@ -135,6 +135,7 @@ void Light::tag_update(Scene *scene)
 LightManager::LightManager()
 {
        need_update = true;
+       use_light_visibility = false;
 }
 
 LightManager::~LightManager()
@@ -232,15 +233,15 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
 
                        if(!(object->visibility & PATH_RAY_DIFFUSE)) {
                                shader_id |= SHADER_EXCLUDE_DIFFUSE;
-                               scene->film->use_light_visibility = true;
+                               use_light_visibility = true;
                        }
                        if(!(object->visibility & PATH_RAY_GLOSSY)) {
                                shader_id |= SHADER_EXCLUDE_GLOSSY;
-                               scene->film->use_light_visibility = true;
+                               use_light_visibility = true;
                        }
                        if(!(object->visibility & PATH_RAY_TRANSMIT)) {
                                shader_id |= SHADER_EXCLUDE_TRANSMIT;
-                               scene->film->use_light_visibility = true;
+                               use_light_visibility = true;
                        }
 
                        for(size_t i = 0; i < mesh->triangles.size(); i++) {
@@ -511,7 +512,6 @@ void LightManager::device_update_points(Device *device, DeviceScene *dscene, Sce
                        }
                }
        }
-       scene->film->use_light_visibility = false;
 
        for(size_t i = 0; i < scene->lights.size(); i++) {
                Light *light = scene->lights[i];
@@ -525,15 +525,15 @@ void LightManager::device_update_points(Device *device, DeviceScene *dscene, Sce
 
                if(!light->use_diffuse) {
                        shader_id |= SHADER_EXCLUDE_DIFFUSE;
-                       scene->film->use_light_visibility = true;
+                       use_light_visibility = true;
                }
                if(!light->use_glossy) {
                        shader_id |= SHADER_EXCLUDE_GLOSSY;
-                       scene->film->use_light_visibility = true;
+                       use_light_visibility = true;
                }
                if(!light->use_transmission) {
                        shader_id |= SHADER_EXCLUDE_TRANSMIT;
-                       scene->film->use_light_visibility = true;
+                       use_light_visibility = true;
                }
 
                if(light->type == LIGHT_POINT) {
@@ -618,6 +618,8 @@ void LightManager::device_update(Device *device, DeviceScene *dscene, Scene *sce
 
        device_free(device, dscene);
 
+       use_light_visibility = false;
+
        device_update_points(device, dscene, scene);
        if(progress.get_cancel()) return;
 
@@ -627,6 +629,11 @@ void LightManager::device_update(Device *device, DeviceScene *dscene, Scene *sce
        device_update_background(device, dscene, scene, progress);
        if(progress.get_cancel()) return;
 
+       if(use_light_visibility != scene->film->use_light_visibility) {
+               scene->film->use_light_visibility = use_light_visibility;
+               scene->film->tag_update(scene);
+       }
+
        need_update = false;
 }
 
index 0e833fdea1d39ca7265e83701a0bf19f6e9ff09a..5b8d3c1d738cabce28c25a623f4afa1d189d3734 100644 (file)
@@ -65,6 +65,7 @@ public:
 
 class LightManager {
 public:
+       bool use_light_visibility;
        bool need_update;
 
        LightManager();