diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/AbstractBlenderHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/AbstractBlenderHelper.java index 3c7794bf9..6cab22b91 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/AbstractBlenderHelper.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/AbstractBlenderHelper.java @@ -75,30 +75,6 @@ public abstract class AbstractBlenderHelper { } } - /** - * This method clears the state of the helper so that it can be used for different calculations of another feature. - */ - public void clearState() { - } - - /** - * This method should be used to check if the text is blank. Avoid using text.trim().length()==0. This causes that more strings are - * being created and stored in the memory. It can be unwise especially inside loops. - * @param text - * the text to be checked - * @return true if the text is blank and false otherwise - */ - protected boolean isBlank(String text) { - if (text != null) { - for (int i = 0; i < text.length(); ++i) { - if (!Character.isWhitespace(text.charAt(i))) { - return false; - } - } - } - return true; - } - /** * This method loads the properties if they are available and defined for the structure. * @param structure @@ -153,15 +129,4 @@ public abstract class AbstractBlenderHelper { } } } - - /** - * This method analyzes the given structure and the data contained within - * blender context and decides if the feature should be loaded. - * @param structure - * structure to be analyzed - * @param blenderContext - * the blender context - * @return true if the feature should be loaded and false otherwise - */ - public abstract boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext); } diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/animations/ArmatureHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/animations/ArmatureHelper.java index 9984fa01e..f5fc203de 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/animations/ArmatureHelper.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/animations/ArmatureHelper.java @@ -112,7 +112,7 @@ public class ArmatureHelper extends AbstractBlenderHelper { int groupIndex = 0; for (Structure deformGroup : deformGroups) { String deformGroupName = deformGroup.getFieldValue("name").toString(); - int boneIndex = this.getBoneIndex(skeleton, deformGroupName); + int boneIndex = skeleton.getBoneIndex(deformGroupName); if (boneIndex >= 0) { result.put(groupIndex, boneIndex); } @@ -122,11 +122,6 @@ public class ArmatureHelper extends AbstractBlenderHelper { return result; } - @Override - public boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext) { - return true; - } - /** * This method retuns the bone tracks for animation. * @@ -169,7 +164,7 @@ public class ArmatureHelper extends AbstractBlenderHelper { List tracks = new ArrayList(); for (Structure actionGroup : actionGroups) { String name = actionGroup.getFieldValue("name").toString(); - int boneIndex = this.getBoneIndex(skeleton, name); + int boneIndex = skeleton.getBoneIndex(name); if (boneIndex >= 0) { List channels = ((Structure) actionGroup.getFieldValue("channels")).evaluateListBase(blenderContext); BezierCurve[] bezierCurves = new BezierCurve[channels.size()]; @@ -211,7 +206,7 @@ public class ArmatureHelper extends AbstractBlenderHelper { List tracks = new ArrayList(); for (Structure bActionChannel : actionChannels) { String name = bActionChannel.getFieldValue("name").toString(); - int boneIndex = this.getBoneIndex(skeleton, name); + int boneIndex = skeleton.getBoneIndex(name); if (boneIndex >= 0) { Pointer p = (Pointer) bActionChannel.getFieldValue("ipo"); if (!p.isNull()) { @@ -227,23 +222,4 @@ public class ArmatureHelper extends AbstractBlenderHelper { } return tracks.toArray(new BoneTrack[tracks.size()]); } - - /** - * This method returns the index of the bone in the given skeleton. - * - * @param skeleton - * the skeleton - * @param boneName - * the name of the bone - * @return the index of the bone - */ - private int getBoneIndex(Skeleton skeleton, String boneName) { - int result = -1; - for (int i = 0; i < skeleton.getBoneCount() && result == -1; ++i) { - if (boneName.equals(skeleton.getBone(i).getName())) { - result = i; - } - } - return result; - } } diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/animations/IpoHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/animations/IpoHelper.java index aa6583e7a..5dbf9232f 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/animations/IpoHelper.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/animations/IpoHelper.java @@ -152,17 +152,12 @@ public class IpoHelper extends AbstractBlenderHelper { return new ConstIpo(constValue); } - @Override - public boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext) { - return true; - } - /** * Ipo constant curve. This is a curve with only one value and no specified * type. This type of ipo cannot be used to calculate tracks. It should only * be used to calculate single value for a given frame. * - * @author Marcin Roguski + * @author Marcin Roguski (Kaelthas) */ private class ConstIpo extends Ipo { diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/cameras/CameraHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/cameras/CameraHelper.java index 1e6552c76..c5e1f0192 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/cameras/CameraHelper.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/cameras/CameraHelper.java @@ -1,6 +1,8 @@ package com.jme3.scene.plugins.blender.cameras; -import com.jme3.asset.BlenderKey.FeaturesToLoad; +import java.util.logging.Level; +import java.util.logging.Logger; + import com.jme3.math.FastMath; import com.jme3.renderer.Camera; import com.jme3.scene.CameraNode; @@ -9,9 +11,6 @@ import com.jme3.scene.plugins.blender.BlenderContext; import com.jme3.scene.plugins.blender.file.BlenderFileException; import com.jme3.scene.plugins.blender.file.Structure; -import java.util.logging.Level; -import java.util.logging.Logger; - /** * A class that is used to load cameras into the scene. * @author Marcin Roguski @@ -145,9 +144,4 @@ public class CameraHelper extends AbstractBlenderHelper { camera.setFrustumPerspective(aspect, camera.getWidth() / camera.getHeight(), clipsta, clipend); return new CameraNode(null, camera); } - - @Override - public boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext) { - return (blenderContext.getBlenderKey().getFeaturesToLoad() & FeaturesToLoad.CAMERAS) != 0; - } } diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/constraints/ConstraintHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/constraints/ConstraintHelper.java index 7588ded8d..debe37018 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/constraints/ConstraintHelper.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/constraints/ConstraintHelper.java @@ -413,11 +413,6 @@ public class ConstraintHelper extends AbstractBlenderHelper { return result; } - @Override - public boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext) { - return true; - } - /** * The space of target or owner transformation. * diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/curves/CurvesHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/curves/CurvesHelper.java index e3fd83226..5c36fcbdb 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/curves/CurvesHelper.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/curves/CurvesHelper.java @@ -53,7 +53,6 @@ import com.jme3.math.Vector3f; import com.jme3.math.Vector4f; import com.jme3.scene.Geometry; import com.jme3.scene.Mesh; -import com.jme3.scene.Spatial; import com.jme3.scene.VertexBuffer.Type; import com.jme3.scene.mesh.IndexBuffer; import com.jme3.scene.plugins.blender.AbstractBlenderHelper; @@ -838,9 +837,4 @@ public class CurvesHelper extends AbstractBlenderHelper { return new Vector3f(locArray.get(0).floatValue(), locArray.get(2).floatValue(), locArray.get(1).floatValue()); } } - - @Override - public boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext) { - return true; - } } \ No newline at end of file diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/landscape/LandscapeHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/landscape/LandscapeHelper.java index 4639a2f10..6b8685c79 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/landscape/LandscapeHelper.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/landscape/LandscapeHelper.java @@ -184,9 +184,4 @@ public class LandscapeHelper extends AbstractBlenderHelper { LOGGER.fine("Sky texture created. Creating sky."); return SkyFactory.createSky(blenderContext.getAssetManager(), texture, false); } - - @Override - public boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext) { - return true; - } } diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/lights/LightHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/lights/LightHelper.java index 9f0c4909b..914d6f6b1 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/lights/LightHelper.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/lights/LightHelper.java @@ -31,7 +31,9 @@ */ package com.jme3.scene.plugins.blender.lights; -import com.jme3.asset.BlenderKey.FeaturesToLoad; +import java.util.logging.Level; +import java.util.logging.Logger; + import com.jme3.light.DirectionalLight; import com.jme3.light.Light; import com.jme3.light.PointLight; @@ -45,9 +47,6 @@ import com.jme3.scene.plugins.blender.BlenderContext.LoadedFeatureDataType; import com.jme3.scene.plugins.blender.file.BlenderFileException; import com.jme3.scene.plugins.blender.file.Structure; -import java.util.logging.Level; -import java.util.logging.Logger; - /** * A class that is used in light calculations. * @author Marcin Roguski @@ -116,9 +115,4 @@ public class LightHelper extends AbstractBlenderHelper { } return result; } - - @Override - public boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext) { - return (blenderContext.getBlenderKey().getFeaturesToLoad() & FeaturesToLoad.LIGHTS) != 0; - } } diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/materials/MaterialHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/materials/MaterialHelper.java index 9ce112ace..a26ca5f4a 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/materials/MaterialHelper.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/materials/MaterialHelper.java @@ -38,7 +38,6 @@ import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; -import com.jme3.asset.BlenderKey.FeaturesToLoad; import com.jme3.material.MatParam; import com.jme3.material.Material; import com.jme3.math.ColorRGBA; @@ -369,9 +368,4 @@ public class MaterialHelper extends AbstractBlenderHelper { } } } - - @Override - public boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext) { - return (blenderContext.getBlenderKey().getFeaturesToLoad() & FeaturesToLoad.MATERIALS) != 0; - } } diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/meshes/MeshHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/meshes/MeshHelper.java index 36c70aacd..92da5770a 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/meshes/MeshHelper.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/meshes/MeshHelper.java @@ -543,9 +543,4 @@ public class MeshHelper extends AbstractBlenderHelper { } return result; } - - @Override - public boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext) { - return true; - } } diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ModifierHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ModifierHelper.java index e72b0c21c..da174e089 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ModifierHelper.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ModifierHelper.java @@ -128,11 +128,6 @@ public class ModifierHelper extends AbstractBlenderHelper { return result; } - @Override - public boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext) { - return true; - } - /** * This method reads the object's animation modifier for blender version * 2.49 and lower. diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/objects/ObjectHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/objects/ObjectHelper.java index 75f05a54f..1156031cf 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/objects/ObjectHelper.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/objects/ObjectHelper.java @@ -113,6 +113,11 @@ public class ObjectHelper extends AbstractBlenderHelper { if(!blenderContext.getBlenderKey().shouldLoad(FeaturesToLoad.OBJECTS)) { LOGGER.fine("Objects are not included in loading."); return null; + } + int lay = ((Number) objectStructure.getFieldValue("lay")).intValue(); + if((lay & blenderContext.getBlenderKey().getLayersToLoad()) == 0) { + LOGGER.fine("The layer this object is located in is not included in loading."); + return null; } LOGGER.fine("Checking if the object has not been already loaded."); @@ -356,17 +361,6 @@ public class ObjectHelper extends AbstractBlenderHelper { return result; } - - @Override - public void clearState() { - fixUpAxis = false; - } - - @Override - public boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext) { - int lay = ((Number) structure.getFieldValue("lay")).intValue(); - return (lay & blenderContext.getBlenderKey().getLayersToLoad()) != 0 && (blenderContext.getBlenderKey().getFeaturesToLoad() & FeaturesToLoad.OBJECTS) != 0; - } private static enum ObjectType { EMPTY(0), diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/particles/ParticlesHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/particles/ParticlesHelper.java index 97e0caab2..255fe8c82 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/particles/ParticlesHelper.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/particles/ParticlesHelper.java @@ -189,9 +189,4 @@ public class ParticlesHelper extends AbstractBlenderHelper { } return result; } - - @Override - public boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext) { - return true; - } } diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/textures/TextureHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/textures/TextureHelper.java index 9197e9532..f6dafcb00 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/textures/TextureHelper.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/textures/TextureHelper.java @@ -45,7 +45,6 @@ import com.jme3.asset.AssetInfo; import com.jme3.asset.AssetManager; import com.jme3.asset.AssetNotFoundException; import com.jme3.asset.BlenderKey; -import com.jme3.asset.BlenderKey.FeaturesToLoad; import com.jme3.asset.GeneratedTextureKey; import com.jme3.asset.TextureKey; import com.jme3.math.Vector2f; @@ -602,13 +601,8 @@ public class TextureHelper extends AbstractBlenderHelper { } return result; } - - @Override - public boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext) { - return (blenderContext.getBlenderKey().getFeaturesToLoad() & FeaturesToLoad.TEXTURES) != 0; - } - public static class TextureData { + private static class TextureData { public Structure mtex; public Structure textureStructure; public int uvCoordinatesType;