If we are loading a material from a J3O file, do not crash on missing material parameters, but log it instead.

Fixes test crash on any tests using cornellbox.j3o
experimental
shadowislord 10 years ago
parent b7ae8e6e3a
commit bf2656abf3
  1. 9
      jme3-core/src/main/java/com/jme3/material/Material.java

@ -1320,8 +1320,13 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
param.setName(param.getName().substring(2)); param.setName(param.getName().substring(2));
} }
checkSetParam(param.getVarType(), param.getName()); if (def.getMaterialParam(name) == null) {
paramValues.put(param.getName(), param); logger.log(Level.WARNING, "The material parameter is not defined: " +
name + ". Ignoring..");
} else {
checkSetParam(param.getVarType(), param.getName());
paramValues.put(param.getName(), param);
}
} }
if (applyDefaultValues) { if (applyDefaultValues) {

Loading…
Cancel
Save