[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37044] branches/cycles/intern/cycles/ blender: Cycles: fix sync issue with group instances.
Brecht Van Lommel
brechtvanlommel at pandora.be
Tue May 31 12:41:01 CEST 2011
Revision: 37044
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37044
Author: blendix
Date: 2011-05-31 10:41:01 +0000 (Tue, 31 May 2011)
Log Message:
-----------
Cycles: fix sync issue with group instances.
Modified Paths:
--------------
branches/cycles/intern/cycles/blender/blender_object.cpp
branches/cycles/intern/cycles/blender/blender_sync.h
branches/cycles/intern/cycles/blender/blender_util.h
Modified: branches/cycles/intern/cycles/blender/blender_object.cpp
===================================================================
--- branches/cycles/intern/cycles/blender/blender_object.cpp 2011-05-31 09:56:38 UTC (rev 37043)
+++ branches/cycles/intern/cycles/blender/blender_object.cpp 2011-05-31 10:41:01 UTC (rev 37044)
@@ -65,13 +65,13 @@
/* 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 @@
{
/* 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 @@
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);
Modified: branches/cycles/intern/cycles/blender/blender_sync.h
===================================================================
--- branches/cycles/intern/cycles/blender/blender_sync.h 2011-05-31 09:56:38 UTC (rev 37043)
+++ branches/cycles/intern/cycles/blender/blender_sync.h 2011-05-31 10:41:01 UTC (rev 37044)
@@ -76,7 +76,7 @@
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 @@
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;
Modified: branches/cycles/intern/cycles/blender/blender_util.h
===================================================================
--- branches/cycles/intern/cycles/blender/blender_util.h 2011-05-31 09:56:38 UTC (rev 37043)
+++ branches/cycles/intern/cycles/blender/blender_util.h 2011-05-31 10:41:01 UTC (rev 37044)
@@ -225,10 +225,10 @@
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 @@
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);
More information about the Bf-blender-cvs
mailing list