Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--intern/cycles/blender/blender_object.cpp10
-rw-r--r--intern/cycles/blender/blender_sync.h4
-rw-r--r--intern/cycles/blender/blender_util.h9
3 files changed, 13 insertions, 10 deletions
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp
index 51fd743956d..932cb2bad41 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -65,13 +65,13 @@ bool BlenderSync::object_is_light(BL::Object b_ob)
/* Light */
-void BlenderSync::sync_light(BL::Object b_ob, Transform& tfm)
+void BlenderSync::sync_light(BL::Object b_parent, int b_index, BL::Object b_ob, Transform& tfm)
{
/* test if we need to sync */
Light *light;
+ ObjectKey key(b_parent, b_index, b_ob);
- /* todo: account for instancing */
- if(!light_map.sync(&light, b_ob))
+ if(!light_map.sync(&light, b_ob, b_parent, key))
return;
/* location */
@@ -98,7 +98,7 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob,
{
/* light is handled separately */
if(object_is_light(b_ob)) {
- sync_light(b_ob, tfm);
+ sync_light(b_parent, b_index, b_ob, tfm);
return;
}
@@ -112,7 +112,7 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob,
bool object_updated = false;
/* object sync */
- if(object_map.sync(&object, b_ob, key)) {
+ if(object_map.sync(&object, b_ob, b_parent, key)) {
object->name = b_ob.name();
object->tfm = tfm;
object->tag_update(scene);
diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h
index f1fce37bfaf..732a1b30260 100644
--- a/intern/cycles/blender/blender_sync.h
+++ b/intern/cycles/blender/blender_sync.h
@@ -76,7 +76,7 @@ private:
void sync_nodes(Shader *shader, BL::ShaderNodeTree b_ntree);
Mesh *sync_mesh(BL::Object b_ob, bool object_updated);
void sync_object(BL::Object b_parent, int b_index, BL::Object b_object, Transform& tfm);
- void sync_light(BL::Object b_ob, Transform& tfm);
+ void sync_light(BL::Object b_parent, int b_index, BL::Object b_ob, Transform& tfm);
/* util */
void find_shader(BL::ID id, vector<uint>& used_shaders);
@@ -91,7 +91,7 @@ private:
id_map<void*, Shader> shader_map;
id_map<ObjectKey, Object> object_map;
id_map<void*, Mesh> mesh_map;
- id_map<void*, Light> light_map;
+ id_map<ObjectKey, Light> light_map;
void *world_map;
bool world_recalc;
diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h
index 715dc7e6fb0..354a195758f 100644
--- a/intern/cycles/blender/blender_util.h
+++ b/intern/cycles/blender/blender_util.h
@@ -225,10 +225,10 @@ public:
bool sync(T **r_data, BL::ID id)
{
- return sync(r_data, id, id.ptr.id.data);
+ return sync(r_data, id, id, id.ptr.id.data);
}
- bool sync(T **r_data, BL::ID id, const K& key)
+ bool sync(T **r_data, BL::ID id, BL::ID parent, const K& key)
{
T *data = find(key);
bool recalc;
@@ -240,8 +240,11 @@ public:
b_map[key] = data;
recalc = true;
}
- else
+ else {
recalc = (b_recalc.find(id.ptr.data) != b_recalc.end());
+ if(parent.ptr.data)
+ recalc = recalc || (b_recalc.find(parent.ptr.data) != b_recalc.end());
+ }
used(data);