diff options
-rw-r--r-- | intern/cycles/blender/blender_shader.cpp | 3 | ||||
-rw-r--r-- | intern/cycles/blender/blender_util.h | 2 | ||||
-rw-r--r-- | intern/cycles/render/light.cpp | 6 | ||||
-rw-r--r-- | intern/cycles/util/util_ies.cpp | 4 |
4 files changed, 12 insertions, 3 deletions
diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index 15d633b5c9a..8847d651b02 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -820,6 +820,9 @@ static ShaderNode *add_node(Scene *scene, break; case BL::ShaderNodeTexIES::mode_INTERNAL: ies->ies = get_text_datablock_content(b_ies_node.ies().ptr); + if(ies->ies.empty()) { + ies->ies = "\n"; + } break; } node = ies; diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index 983988f4e36..8a874b7063e 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -468,7 +468,7 @@ static inline string blender_absolute_path(BL::BlendData& b_data, return path; } -static inline string get_text_datablock_content(const PointerRNA&& ptr) +static inline string get_text_datablock_content(const PointerRNA& ptr) { if(ptr.data == NULL) { return ""; diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index 91f9b4e3bec..806f1cad03e 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -898,8 +898,10 @@ void LightManager::tag_update(Scene * /*scene*/) int LightManager::add_ies_from_file(ustring filename) { string content; - /* If the file can't be opened, call with an empty string */ - path_read_text(filename.c_str(), content); + /* If the file can't be opened, call with an empty line */ + if(filename.empty() || !path_read_text(filename.c_str(), content)) { + content == "\n"; + } return add_ies(ustring(content)); } diff --git a/intern/cycles/util/util_ies.cpp b/intern/cycles/util/util_ies.cpp index 4824c886609..e068957325b 100644 --- a/intern/cycles/util/util_ies.cpp +++ b/intern/cycles/util/util_ies.cpp @@ -109,6 +109,10 @@ public: bool IESFile::parse(ustring ies) { + if(ies.empty()) { + return false; + } + IESTextParser parser(ies); if(parser.eof()) { return false; |