浏览代码

BlenderImporter: Don't silently fail when a packed file couldn't be loaded but use a Placeholder Texture

MeFisto94 8 年之前
父节点
当前提交
9100cff4aa

+ 3 - 1
jme3-blender/src/main/java/com/jme3/scene/plugins/blender/textures/TextureHelper.java

@@ -72,6 +72,7 @@ import com.jme3.texture.Texture.WrapMode;
 import com.jme3.texture.Texture2D;
 import com.jme3.texture.image.ColorSpace;
 import com.jme3.util.BufferUtils;
+import com.jme3.util.PlaceholderAssets;
 
 /**
  * A class that is used in texture calculations.
@@ -256,7 +257,8 @@ public class TextureHelper extends AbstractBlenderHelper {
                     if (img != null) {
                         result = new Texture2D(img);
                     } else {
-                        LOGGER.fine("ImageLoader returned null. It probably failed to load the packed texture");
+                        result = new Texture2D(PlaceholderAssets.getPlaceholderImage(blenderContext.getAssetManager()));
+                        LOGGER.fine("ImageLoader returned null. It probably failed to load the packed texture, using placeholder asset");
                     }
                 }
             }