Skip to content

Commit

Permalink
Merge pull request #17 from johnhaddon/appleseedUpdate
Browse files Browse the repository at this point in the history
Fix OSL string params when they are empty or contain spaces.
  • Loading branch information
johnhaddon authored Nov 1, 2016
2 parents 9413ed6 + c74b181 commit e47b939
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ namespace renderer
//

ShaderParamParser::ShaderParamParser(const string& s)
: m_original_string(s)
{
tokenize(s, Blanks, m_tokens);

Expand Down Expand Up @@ -106,12 +107,9 @@ string ShaderParamParser::parse_string_value()
{
assert(param_type() == OSLParamTypeString);

const string val(*m_tok_it++);

if (m_tok_it != m_tok_end)
throw ExceptionOSLParamParseError();

return val;
// Remove the string prefix and trim whitespace.
string val(m_original_string, 6, string::npos);
return trim_both(val);
}

} // namespace renderer
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class ShaderParamParser
std::string parse_string_value();

private:
std::string m_original_string;
std::vector<std::string> m_tokens;
OSLParamType m_param_type;
std::vector<std::string>::const_iterator m_tok_it;
Expand Down

0 comments on commit e47b939

Please sign in to comment.