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
This commit is contained in:
shadowislord 2014-11-05 23:11:35 -05:00
parent b7ae8e6e3a
commit bf2656abf3

View File

@ -1320,9 +1320,14 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
param.setName(param.getName().substring(2)); param.setName(param.getName().substring(2));
} }
if (def.getMaterialParam(name) == null) {
logger.log(Level.WARNING, "The material parameter is not defined: " +
name + ". Ignoring..");
} else {
checkSetParam(param.getVarType(), param.getName()); checkSetParam(param.getVarType(), param.getName());
paramValues.put(param.getName(), param); paramValues.put(param.getName(), param);
} }
}
if (applyDefaultValues) { if (applyDefaultValues) {
// compatability with old versions where default vars were // compatability with old versions where default vars were