Cycles: Fix problems in the IES loader when rendering with no file selected
This commit is contained in:
parent
56254a42e0
commit
edce44d693
|
@ -827,6 +827,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;
|
||||
|
|
|
@ -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 "";
|
||||
|
|
|
@ -891,8 +891,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));
|
||||
}
|
||||
|
|
|
@ -109,6 +109,10 @@ public:
|
|||
|
||||
bool IESFile::parse(ustring ies)
|
||||
{
|
||||
if(ies.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
IESTextParser parser(ies);
|
||||
if(parser.eof()) {
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue