From f416d7af18c91173042786a4918f9accf095f549 Mon Sep 17 00:00:00 2001 From: delt0r Date: Wed, 8 Feb 2017 14:53:45 +1300 Subject: [PATCH] Fixed a exception in Materal toString with blender materials. Some blender materials have null Material Param keys. This shouldn't throw an exception in a toString method. So rather than throwing a OperaitonNotSupported exception a string is returned informative of the null state of the key. --- jme3-core/src/main/java/com/jme3/material/MatParam.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jme3-core/src/main/java/com/jme3/material/MatParam.java b/jme3-core/src/main/java/com/jme3/material/MatParam.java index 6c069a14d..b30aab0c5 100644 --- a/jme3-core/src/main/java/com/jme3/material/MatParam.java +++ b/jme3-core/src/main/java/com/jme3/material/MatParam.java @@ -237,7 +237,11 @@ When arrays can be inserted in J3M files Texture texVal = (Texture) value; TextureKey texKey = (TextureKey) texVal.getKey(); if (texKey == null){ - throw new UnsupportedOperationException("The specified MatParam cannot be represented in J3M"); + //throw new UnsupportedOperationException("The specified MatParam cannot be represented in J3M"); + // this is used in toString and the above line causes blender materials to throw this exception. + // toStrings should be very robust IMO as even debuggers often invoke toString and logging code + // often does as well, even implicitly. + return texVal+":returned null key"; } String ret = "";