diff --git a/engine/src/blender/com/jme3/asset/BlenderKey.java b/engine/src/blender/com/jme3/asset/BlenderKey.java
index b8fd35fce..c82da1083 100644
--- a/engine/src/blender/com/jme3/asset/BlenderKey.java
+++ b/engine/src/blender/com/jme3/asset/BlenderKey.java
@@ -100,6 +100,8 @@ public class BlenderKey extends ModelKey {
protected boolean loadObjectProperties = true;
/** Maximum texture size. Might be dependant on the graphic card.*/
protected int maxTextureSize = -1;
+ /** Allows to toggle generated textures loading. Disabled by default because it very often takes too much memory and needs to be used wisely. */
+ protected boolean loadGeneratedTextures;
/**
* Constructor used by serialization mechanisms.
@@ -205,6 +207,21 @@ public class BlenderKey extends ModelKey {
this.maxTextureSize = maxTextureSize;
}
+ /**
+ * This method sets the flag that toggles the generated textures loading.
+ * @param loadGeneratedTextures true if generated textures should be loaded and false otherwise
+ */
+ public void setLoadGeneratedTextures(boolean loadGeneratedTextures) {
+ this.loadGeneratedTextures = loadGeneratedTextures;
+ }
+
+ /**
+ * @return tells if the generated textures should be loaded (false is the default value)
+ */
+ public boolean isLoadGeneratedTextures() {
+ return loadGeneratedTextures;
+ }
+
/**
* This method sets the asset root path.
* @param assetRootPath
diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/textures/CombinedTexture.java b/engine/src/blender/com/jme3/scene/plugins/blender/textures/CombinedTexture.java
index eedd5f19c..70dae5be0 100644
--- a/engine/src/blender/com/jme3/scene/plugins/blender/textures/CombinedTexture.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/textures/CombinedTexture.java
@@ -84,21 +84,23 @@ public class CombinedTexture {
if (!(texture instanceof GeneratedTexture) && !(texture instanceof Texture2D)) {
throw new IllegalArgumentException("Unsupported texture type: " + (texture == null ? "null" : texture.getClass()));
}
- if(UVCoordinatesGenerator.isTextureCoordinateTypeSupported(UVCoordinatesType.valueOf(uvCoordinatesType))) {
- TextureData textureData = new TextureData();
- textureData.texture = texture;
- textureData.textureBlender = textureBlender;
- textureData.uvCoordinatesType = UVCoordinatesType.valueOf(uvCoordinatesType);
- textureData.projectionType = UVProjectionType.valueOf(projectionType);
- textureData.textureStructure = textureStructure;
-
- if (this.isWithoutAlpha(textureData, blenderContext)) {
- textureDatas.clear();// clear previous textures, they will be covered anyway
+ if(!(texture instanceof GeneratedTexture) || blenderContext.getBlenderKey().isLoadGeneratedTextures()) {
+ if(UVCoordinatesGenerator.isTextureCoordinateTypeSupported(UVCoordinatesType.valueOf(uvCoordinatesType))) {
+ TextureData textureData = new TextureData();
+ textureData.texture = texture;
+ textureData.textureBlender = textureBlender;
+ textureData.uvCoordinatesType = UVCoordinatesType.valueOf(uvCoordinatesType);
+ textureData.projectionType = UVProjectionType.valueOf(projectionType);
+ textureData.textureStructure = textureStructure;
+
+ if (this.isWithoutAlpha(textureData, blenderContext)) {
+ textureDatas.clear();// clear previous textures, they will be covered anyway
+ }
+ textureDatas.add(textureData);
+ } else {
+ LOGGER.warning("The texture coordinates type is not supported: " + UVCoordinatesType.valueOf(uvCoordinatesType) + ". The texture '" + textureStructure.getName() + "'.");
}
- textureDatas.add(textureData);
- } else {
- LOGGER.warning("The texture coordinates type is not supported: " + UVCoordinatesType.valueOf(uvCoordinatesType) + ". The texture '" + textureStructure.getName() + "'.");
- }
+ }
}
/**