diff options
Diffstat (limited to 'intern/cycles/blender/blender_object.cpp')
-rw-r--r-- | intern/cycles/blender/blender_object.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp index 608cb33eadd..bc7868e0192 100644 --- a/intern/cycles/blender/blender_object.cpp +++ b/intern/cycles/blender/blender_object.cpp @@ -16,10 +16,13 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "graph.h" #include "light.h" #include "mesh.h" #include "object.h" #include "scene.h" +#include "nodes.h" +#include "shader.h" #include "blender_sync.h" #include "blender_util.h" @@ -152,6 +155,35 @@ void BlenderSync::sync_light(BL::Object b_parent, int b_index, BL::Object b_ob, light->tag_update(scene); } +void BlenderSync::sync_background_light() +{ + BL::World b_world = b_scene.world(); + + PointerRNA cworld = RNA_pointer_get(&b_world.ptr, "cycles"); + bool sample_as_light = get_boolean(cworld, "sample_as_light"); + + if(sample_as_light) { + /* test if we need to sync */ + Light *light; + ObjectKey key(b_world, 0, b_world); + + if(light_map.sync(&light, b_world, b_world, key) || + world_recalc || + b_world.ptr.data != world_map) + { + light->type = LIGHT_BACKGROUND; + light->map_resolution = get_int(cworld, "sample_map_resolution"); + light->shader = scene->default_background; + + light->tag_update(scene); + light_map.set_recalc(b_world); + } + } + + world_map = b_world.ptr.data; + world_recalc = false; +} + /* Object */ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob, Transform& tfm, uint layer_flag) @@ -263,6 +295,8 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d) } } + sync_background_light(); + /* handle removed data and modified pointers */ if(light_map.post_sync()) scene->light_manager->tag_update(scene); |