Fixes condition parsing for shader nodes

monkanim
Nehon 7 years ago
parent f5e11d23b2
commit 47406058a6
  1. 6
      jme3-core/src/plugins/java/com/jme3/material/plugins/ConditionParser.java

@ -51,8 +51,8 @@ public class ConditionParser {
public static void main(String argv[]) {
ConditionParser parser = new ConditionParser();
List<String> defines = parser.extractDefines("(LightMap && SeparateTexCoord) || !ColorMap");
//List<String> defines = parser.extractDefines("(LightMap && SeparateTexCoord) || !ColorMap");
List<String> defines = parser.extractDefines("RoughnessMap && MetallicRoughnessMap");
for (String string : defines) {
System.err.println(string);
}
@ -99,7 +99,7 @@ public class ConditionParser {
while (m.find()) {
String match = m.group();
defines.add(match);
formattedExpression = formattedExpression.replaceAll(match, "defined(" + match.toUpperCase() + ")");
formattedExpression = formattedExpression.replaceAll("\\b" + match + "\\b", "defined(" + match.toUpperCase() + ")");
}
return defines;
}

Loading…
Cancel
Save