Merge branch 'master' into blender2.8
authorLukas Stockner <lukas.stockner@freenet.de>
Sun, 27 May 2018 15:26:59 +0000 (17:26 +0200)
committerLukas Stockner <lukas.stockner@freenet.de>
Sun, 27 May 2018 15:26:59 +0000 (17:26 +0200)
intern/cycles/blender/blender_shader.cpp
intern/cycles/blender/blender_util.h
intern/cycles/render/light.cpp
intern/cycles/util/util_ies.cpp

index 15d633b5c9ae5f3d441d6bbb86ce9141010d5398..8847d651b02445bd3c69af8794fe196b8e07ad1a 100644 (file)
@@ -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;
index 983988f4e361c5e98a734a00d365f0bae50b0204..8a874b7063e664f03e3c7e1908c6c783c2419f6d 100644 (file)
@@ -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 "";
index 91f9b4e3bec6a0950a1bf79073abd71714c72928..806f1cad03ea5b2dc9a7722949ab95116658ec84 100644 (file)
@@ -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));
 }
index 4824c8866090ece13038a1748d10b87a1523c083..e068957325b45261aa43b46a728b341b3e4bf5b7 100644 (file)
@@ -109,6 +109,10 @@ public:
 
 bool IESFile::parse(ustring ies)
 {
+       if(ies.empty()) {
+               return false;
+       }
+
        IESTextParser parser(ies);
        if(parser.eof()) {
                return false;