diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-12-09 04:24:48 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-12-09 04:24:48 +0400 |
commit | ea399744e7807b63f995c60724e773a0335d1d89 (patch) | |
tree | 1baec8db1eef200a12248b0e83a081a270cb47f9 /intern | |
parent | 3314184f4d77bed0d9b4cdc186154b2289b5ab75 (diff) |
Fix #29555: cycles crash rendering with no material in material slot.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/blender/blender_mesh.cpp | 4 | ||||
-rw-r--r-- | intern/cycles/blender/blender_object.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/blender/blender_shader.cpp | 4 | ||||
-rw-r--r-- | intern/cycles/blender/blender_sync.h | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp index e247b3744fa..4b7651dba4c 100644 --- a/intern/cycles/blender/blender_mesh.cpp +++ b/intern/cycles/blender/blender_mesh.cpp @@ -233,9 +233,9 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated) BL::Object::material_slots_iterator slot; for(b_ob.material_slots.begin(slot); slot != b_ob.material_slots.end(); ++slot) { if(render_layer.material_override) - find_shader(render_layer.material_override, used_shaders); + find_shader(render_layer.material_override, used_shaders, scene->default_surface); else - find_shader(slot->material(), used_shaders); + find_shader(slot->material(), used_shaders, scene->default_surface); } if(used_shaders.size() == 0) diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp index abadee9328e..ec22d3db6f7 100644 --- a/intern/cycles/blender/blender_object.cpp +++ b/intern/cycles/blender/blender_object.cpp @@ -137,7 +137,7 @@ void BlenderSync::sync_light(BL::Object b_parent, int b_index, BL::Object b_ob, /* shader */ vector<uint> used_shaders; - find_shader(b_lamp, used_shaders); + find_shader(b_lamp, used_shaders, scene->default_light); if(used_shaders.size() == 0) used_shaders.push_back(scene->default_light); diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index 930ac1d495a..b0dd6988457 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -36,9 +36,9 @@ typedef map<void*, SocketPair> PtrSockMap; /* Find */ -void BlenderSync::find_shader(BL::ID id, vector<uint>& used_shaders) +void BlenderSync::find_shader(BL::ID id, vector<uint>& used_shaders, int default_shader) { - Shader *shader = shader_map.find(id); + Shader *shader = (id)? shader_map.find(id): scene->shaders[default_shader]; for(size_t i = 0; i < scene->shaders.size(); i++) { if(scene->shaders[i] == shader) { diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h index bde3207e1be..83c7f70fd59 100644 --- a/intern/cycles/blender/blender_sync.h +++ b/intern/cycles/blender/blender_sync.h @@ -81,7 +81,7 @@ private: 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); + void find_shader(BL::ID id, vector<uint>& used_shaders, int default_shader); bool object_is_modified(BL::Object b_ob); bool object_is_mesh(BL::Object b_ob); bool object_is_light(BL::Object b_ob); |