Refactoring: removed unused methods.
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10826 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
8538706254
commit
11d77cfdc2
engine/src/blender/com/jme3/scene/plugins/blender
AbstractBlenderHelper.java
animations
cameras
constraints
curves
landscape
lights
materials
meshes
modifiers
objects
particles
textures
@ -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 <b>true</b> if the text is blank and <b>false</b> 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.
|
* This method loads the properties if they are available and defined for the structure.
|
||||||
* @param 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 <b>true</b> if the feature should be loaded and false otherwise
|
|
||||||
*/
|
|
||||||
public abstract boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext);
|
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ public class ArmatureHelper extends AbstractBlenderHelper {
|
|||||||
int groupIndex = 0;
|
int groupIndex = 0;
|
||||||
for (Structure deformGroup : deformGroups) {
|
for (Structure deformGroup : deformGroups) {
|
||||||
String deformGroupName = deformGroup.getFieldValue("name").toString();
|
String deformGroupName = deformGroup.getFieldValue("name").toString();
|
||||||
int boneIndex = this.getBoneIndex(skeleton, deformGroupName);
|
int boneIndex = skeleton.getBoneIndex(deformGroupName);
|
||||||
if (boneIndex >= 0) {
|
if (boneIndex >= 0) {
|
||||||
result.put(groupIndex, boneIndex);
|
result.put(groupIndex, boneIndex);
|
||||||
}
|
}
|
||||||
@ -122,11 +122,6 @@ public class ArmatureHelper extends AbstractBlenderHelper {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method retuns the bone tracks for animation.
|
* This method retuns the bone tracks for animation.
|
||||||
*
|
*
|
||||||
@ -169,7 +164,7 @@ public class ArmatureHelper extends AbstractBlenderHelper {
|
|||||||
List<BoneTrack> tracks = new ArrayList<BoneTrack>();
|
List<BoneTrack> tracks = new ArrayList<BoneTrack>();
|
||||||
for (Structure actionGroup : actionGroups) {
|
for (Structure actionGroup : actionGroups) {
|
||||||
String name = actionGroup.getFieldValue("name").toString();
|
String name = actionGroup.getFieldValue("name").toString();
|
||||||
int boneIndex = this.getBoneIndex(skeleton, name);
|
int boneIndex = skeleton.getBoneIndex(name);
|
||||||
if (boneIndex >= 0) {
|
if (boneIndex >= 0) {
|
||||||
List<Structure> channels = ((Structure) actionGroup.getFieldValue("channels")).evaluateListBase(blenderContext);
|
List<Structure> channels = ((Structure) actionGroup.getFieldValue("channels")).evaluateListBase(blenderContext);
|
||||||
BezierCurve[] bezierCurves = new BezierCurve[channels.size()];
|
BezierCurve[] bezierCurves = new BezierCurve[channels.size()];
|
||||||
@ -211,7 +206,7 @@ public class ArmatureHelper extends AbstractBlenderHelper {
|
|||||||
List<BoneTrack> tracks = new ArrayList<BoneTrack>();
|
List<BoneTrack> tracks = new ArrayList<BoneTrack>();
|
||||||
for (Structure bActionChannel : actionChannels) {
|
for (Structure bActionChannel : actionChannels) {
|
||||||
String name = bActionChannel.getFieldValue("name").toString();
|
String name = bActionChannel.getFieldValue("name").toString();
|
||||||
int boneIndex = this.getBoneIndex(skeleton, name);
|
int boneIndex = skeleton.getBoneIndex(name);
|
||||||
if (boneIndex >= 0) {
|
if (boneIndex >= 0) {
|
||||||
Pointer p = (Pointer) bActionChannel.getFieldValue("ipo");
|
Pointer p = (Pointer) bActionChannel.getFieldValue("ipo");
|
||||||
if (!p.isNull()) {
|
if (!p.isNull()) {
|
||||||
@ -227,23 +222,4 @@ public class ArmatureHelper extends AbstractBlenderHelper {
|
|||||||
}
|
}
|
||||||
return tracks.toArray(new BoneTrack[tracks.size()]);
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -152,17 +152,12 @@ public class IpoHelper extends AbstractBlenderHelper {
|
|||||||
return new ConstIpo(constValue);
|
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
|
* 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
|
* type. This type of ipo cannot be used to calculate tracks. It should only
|
||||||
* be used to calculate single value for a given frame.
|
* be used to calculate single value for a given frame.
|
||||||
*
|
*
|
||||||
* @author Marcin Roguski
|
* @author Marcin Roguski (Kaelthas)
|
||||||
*/
|
*/
|
||||||
private class ConstIpo extends Ipo {
|
private class ConstIpo extends Ipo {
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.jme3.scene.plugins.blender.cameras;
|
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.math.FastMath;
|
||||||
import com.jme3.renderer.Camera;
|
import com.jme3.renderer.Camera;
|
||||||
import com.jme3.scene.CameraNode;
|
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.BlenderFileException;
|
||||||
import com.jme3.scene.plugins.blender.file.Structure;
|
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.
|
* A class that is used to load cameras into the scene.
|
||||||
* @author Marcin Roguski
|
* @author Marcin Roguski
|
||||||
@ -145,9 +144,4 @@ public class CameraHelper extends AbstractBlenderHelper {
|
|||||||
camera.setFrustumPerspective(aspect, camera.getWidth() / camera.getHeight(), clipsta, clipend);
|
camera.setFrustumPerspective(aspect, camera.getWidth() / camera.getHeight(), clipsta, clipend);
|
||||||
return new CameraNode(null, camera);
|
return new CameraNode(null, camera);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext) {
|
|
||||||
return (blenderContext.getBlenderKey().getFeaturesToLoad() & FeaturesToLoad.CAMERAS) != 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -413,11 +413,6 @@ public class ConstraintHelper extends AbstractBlenderHelper {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The space of target or owner transformation.
|
* The space of target or owner transformation.
|
||||||
*
|
*
|
||||||
|
@ -53,7 +53,6 @@ import com.jme3.math.Vector3f;
|
|||||||
import com.jme3.math.Vector4f;
|
import com.jme3.math.Vector4f;
|
||||||
import com.jme3.scene.Geometry;
|
import com.jme3.scene.Geometry;
|
||||||
import com.jme3.scene.Mesh;
|
import com.jme3.scene.Mesh;
|
||||||
import com.jme3.scene.Spatial;
|
|
||||||
import com.jme3.scene.VertexBuffer.Type;
|
import com.jme3.scene.VertexBuffer.Type;
|
||||||
import com.jme3.scene.mesh.IndexBuffer;
|
import com.jme3.scene.mesh.IndexBuffer;
|
||||||
import com.jme3.scene.plugins.blender.AbstractBlenderHelper;
|
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());
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -184,9 +184,4 @@ public class LandscapeHelper extends AbstractBlenderHelper {
|
|||||||
LOGGER.fine("Sky texture created. Creating sky.");
|
LOGGER.fine("Sky texture created. Creating sky.");
|
||||||
return SkyFactory.createSky(blenderContext.getAssetManager(), texture, false);
|
return SkyFactory.createSky(blenderContext.getAssetManager(), texture, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,9 @@
|
|||||||
*/
|
*/
|
||||||
package com.jme3.scene.plugins.blender.lights;
|
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.DirectionalLight;
|
||||||
import com.jme3.light.Light;
|
import com.jme3.light.Light;
|
||||||
import com.jme3.light.PointLight;
|
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.BlenderFileException;
|
||||||
import com.jme3.scene.plugins.blender.file.Structure;
|
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.
|
* A class that is used in light calculations.
|
||||||
* @author Marcin Roguski
|
* @author Marcin Roguski
|
||||||
@ -116,9 +115,4 @@ public class LightHelper extends AbstractBlenderHelper {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext) {
|
|
||||||
return (blenderContext.getBlenderKey().getFeaturesToLoad() & FeaturesToLoad.LIGHTS) != 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,6 @@ import java.util.Map;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import com.jme3.asset.BlenderKey.FeaturesToLoad;
|
|
||||||
import com.jme3.material.MatParam;
|
import com.jme3.material.MatParam;
|
||||||
import com.jme3.material.Material;
|
import com.jme3.material.Material;
|
||||||
import com.jme3.math.ColorRGBA;
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -543,9 +543,4 @@ public class MeshHelper extends AbstractBlenderHelper {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -128,11 +128,6 @@ public class ModifierHelper extends AbstractBlenderHelper {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method reads the object's animation modifier for blender version
|
* This method reads the object's animation modifier for blender version
|
||||||
* 2.49 and lower.
|
* 2.49 and lower.
|
||||||
|
@ -113,6 +113,11 @@ public class ObjectHelper extends AbstractBlenderHelper {
|
|||||||
if(!blenderContext.getBlenderKey().shouldLoad(FeaturesToLoad.OBJECTS)) {
|
if(!blenderContext.getBlenderKey().shouldLoad(FeaturesToLoad.OBJECTS)) {
|
||||||
LOGGER.fine("Objects are not included in loading.");
|
LOGGER.fine("Objects are not included in loading.");
|
||||||
return null;
|
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.");
|
LOGGER.fine("Checking if the object has not been already loaded.");
|
||||||
@ -356,17 +361,6 @@ public class ObjectHelper extends AbstractBlenderHelper {
|
|||||||
|
|
||||||
return result;
|
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 {
|
private static enum ObjectType {
|
||||||
EMPTY(0),
|
EMPTY(0),
|
||||||
|
@ -189,9 +189,4 @@ public class ParticlesHelper extends AbstractBlenderHelper {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,6 @@ import com.jme3.asset.AssetInfo;
|
|||||||
import com.jme3.asset.AssetManager;
|
import com.jme3.asset.AssetManager;
|
||||||
import com.jme3.asset.AssetNotFoundException;
|
import com.jme3.asset.AssetNotFoundException;
|
||||||
import com.jme3.asset.BlenderKey;
|
import com.jme3.asset.BlenderKey;
|
||||||
import com.jme3.asset.BlenderKey.FeaturesToLoad;
|
|
||||||
import com.jme3.asset.GeneratedTextureKey;
|
import com.jme3.asset.GeneratedTextureKey;
|
||||||
import com.jme3.asset.TextureKey;
|
import com.jme3.asset.TextureKey;
|
||||||
import com.jme3.math.Vector2f;
|
import com.jme3.math.Vector2f;
|
||||||
@ -602,13 +601,8 @@ public class TextureHelper extends AbstractBlenderHelper {
|
|||||||
}
|
}
|
||||||
return result;
|
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 mtex;
|
||||||
public Structure textureStructure;
|
public Structure textureStructure;
|
||||||
public int uvCoordinatesType;
|
public int uvCoordinatesType;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user