Cycles: fix sync issue with group instances.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user