|
|
|
@ -232,6 +232,7 @@ public class ShaderNodeLoaderDelegate { |
|
|
|
|
protected void readShaderNodeDefinition(List<Statement> statements, ShaderNodeDefinitionKey key) throws IOException { |
|
|
|
|
boolean isLoadDoc = key instanceof ShaderNodeDefinitionKey && ((ShaderNodeDefinitionKey) key).isLoadDocumentation(); |
|
|
|
|
for (Statement statement : statements) { |
|
|
|
|
try { |
|
|
|
|
String[] split = statement.getLine().split("[ \\{]"); |
|
|
|
|
String line = statement.getLine(); |
|
|
|
|
|
|
|
|
@ -253,20 +254,31 @@ public class ShaderNodeLoaderDelegate { |
|
|
|
|
} else if (line.startsWith("Input")) { |
|
|
|
|
varNames = ""; |
|
|
|
|
for (Statement statement1 : statement.getContents()) { |
|
|
|
|
try { |
|
|
|
|
shaderNodeDefinition.getInputs().add(readVariable(statement1)); |
|
|
|
|
} catch (RuntimeException e) { |
|
|
|
|
throw new MatParseException(e.getMessage(), statement1, e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else if (line.startsWith("Output")) { |
|
|
|
|
varNames = ""; |
|
|
|
|
for (Statement statement1 : statement.getContents()) { |
|
|
|
|
if(statement1.getLine().trim().equals("None")){ |
|
|
|
|
try { |
|
|
|
|
if (statement1.getLine().trim().equals("None")) { |
|
|
|
|
shaderNodeDefinition.setNoOutput(true); |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
shaderNodeDefinition.getOutputs().add(readVariable(statement1)); |
|
|
|
|
} |
|
|
|
|
} catch (RuntimeException e) { |
|
|
|
|
throw new MatParseException(e.getMessage(), statement1, e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
throw new MatParseException("one of Type, Shader, Documentation, Input, Output", split[0], statement); |
|
|
|
|
} |
|
|
|
|
} catch (RuntimeException e) { |
|
|
|
|
throw new MatParseException(e.getMessage(), statement, e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -280,6 +292,9 @@ public class ShaderNodeLoaderDelegate { |
|
|
|
|
protected ShaderNodeVariable readVariable(Statement statement) throws IOException { |
|
|
|
|
String line = statement.getLine().trim().replaceAll("\\s*\\[", "["); |
|
|
|
|
String[] splitVar = line.split("\\s"); |
|
|
|
|
if (splitVar.length != 2) { |
|
|
|
|
throw new MatParseException("2 arguments", splitVar.length + "", statement); |
|
|
|
|
} |
|
|
|
|
String varName = splitVar[1]; |
|
|
|
|
String varType = splitVar[0]; |
|
|
|
|
String multiplicity = null; |
|
|
|
|