• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Main repository of MikuMikuStudio


コミットメタ情報

リビジョンb0ce619c39c5192363c2f99ae6156bce60dcad80 (tree)
日時2013-04-29 20:31:48
作者Kaelthas_Spellsinger@o2.pl <Kaelthas_Spellsinger@o2.p...>
コミッターKaelthas_Spellsinger@o2.pl

ログメッセージ

Code refactoring:
- removed unused methods
- added javadocs
- minor name fixes
- one constructor type for all helpers

git-svn-id: http://jmonkeyengine.googlecode.com/svn/trunk@10585 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

変更サマリ

差分

--- a/engine/src/blender/com/jme3/scene/plugins/blender/AbstractBlenderHelper.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/AbstractBlenderHelper.java
@@ -49,7 +49,8 @@ import com.jme3.scene.plugins.blender.objects.Properties;
4949 * @author Marcin Roguski
5050 */
5151 public abstract class AbstractBlenderHelper {
52-
52+ /** The blender context. */
53+ protected BlenderContext blenderContext;
5354 /** The version of the blend file. */
5455 protected final int blenderVersion;
5556 /** This variable indicates if the Y asxis is the UP axis or not. */
@@ -62,12 +63,13 @@ public abstract class AbstractBlenderHelper {
6263 * versions.
6364 * @param blenderVersion
6465 * the version read from the blend file
65- * @param fixUpAxis
66- * a variable that indicates if the Y asxis is the UP axis or not
66+ * @param blenderContext
67+ * the blender context
6768 */
68- public AbstractBlenderHelper(String blenderVersion, boolean fixUpAxis) {
69+ public AbstractBlenderHelper(String blenderVersion, BlenderContext blenderContext) {
6970 this.blenderVersion = Integer.parseInt(blenderVersion);
70- this.fixUpAxis = fixUpAxis;
71+ this.blenderContext = blenderContext;
72+ this.fixUpAxis = blenderContext.getBlenderKey().isFixUpAxis();
7173 if (fixUpAxis) {
7274 upAxisRotationQuaternion = new Quaternion().fromAngles(-FastMath.HALF_PI, 0, 0);
7375 }
--- a/engine/src/blender/com/jme3/scene/plugins/blender/BlenderContext.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/BlenderContext.java
@@ -54,7 +54,6 @@ import com.jme3.scene.plugins.blender.file.DnaBlockData;
5454 import com.jme3.scene.plugins.blender.file.FileBlockHeader;
5555 import com.jme3.scene.plugins.blender.file.Structure;
5656 import com.jme3.scene.plugins.blender.meshes.MeshContext;
57-import com.jme3.scene.plugins.blender.modifiers.Modifier;
5857 import com.jme3.scene.plugins.ogre.AnimData;
5958
6059 /**
@@ -101,8 +100,6 @@ public class BlenderContext {
101100 private Map<String, Object[]> loadedFeaturesByName = new HashMap<String, Object[]>();
102101 /** A stack that hold the parent structure of currently loaded feature. */
103102 private Stack<Structure> parentStack = new Stack<Structure>();
104- /** A list of modifiers for the specified object. */
105- protected Map<Long, List<Modifier>> modifiers = new HashMap<Long, List<Modifier>>();
106103 /** A list of constraints for the specified object. */
107104 protected Map<Long, List<Constraint>> constraints = new HashMap<Long, List<Constraint>>();
108105 /** Anim data loaded for features. */
@@ -273,14 +270,6 @@ public class BlenderContext {
273270 }
274271
275272 /**
276- * This method clears the saved block headers stored in the features map.
277- */
278- public void clearFileBlocks() {
279- fileBlockHeadersByOma.clear();
280- fileBlockHeadersByCode.clear();
281- }
282-
283- /**
284273 * This method adds a helper instance to the helpers' map.
285274 *
286275 * @param <T>
@@ -343,13 +332,6 @@ public class BlenderContext {
343332 }
344333
345334 /**
346- * This method clears the saved features stored in the features map.
347- */
348- public void clearLoadedFeatures() {
349- loadedFeatures.clear();
350- }
351-
352- /**
353335 * This method adds the structure to the parent stack.
354336 *
355337 * @param parent
@@ -391,48 +373,6 @@ public class BlenderContext {
391373 *
392374 * @param ownerOMA
393375 * the owner's old memory address
394- * @param modifier
395- * the object's modifier
396- */
397- public void addModifier(Long ownerOMA, Modifier modifier) {
398- List<Modifier> objectModifiers = this.modifiers.get(ownerOMA);
399- if (objectModifiers == null) {
400- objectModifiers = new ArrayList<Modifier>();
401- this.modifiers.put(ownerOMA, objectModifiers);
402- }
403- objectModifiers.add(modifier);
404- }
405-
406- /**
407- * This method returns modifiers for the object specified by its old memory
408- * address and the modifier type. If no modifiers are found - empty list is
409- * returned. If the type is null - all modifiers for the object are
410- * returned.
411- *
412- * @param objectOMA
413- * object's old memory address
414- * @param type
415- * the type of the modifier
416- * @return the list of object's modifiers
417- */
418- public List<Modifier> getModifiers(Long objectOMA, String type) {
419- List<Modifier> result = new ArrayList<Modifier>();
420- List<Modifier> readModifiers = modifiers.get(objectOMA);
421- if (readModifiers != null && readModifiers.size() > 0) {
422- for (Modifier modifier : readModifiers) {
423- if (type == null || type.isEmpty() || modifier.getType().equals(type)) {
424- result.add(modifier);
425- }
426- }
427- }
428- return result;
429- }
430-
431- /**
432- * This method adds a new modifier to the list.
433- *
434- * @param ownerOMA
435- * the owner's old memory address
436376 * @param constraints
437377 * the object's constraints
438378 */
@@ -632,13 +572,14 @@ public class BlenderContext {
632572 loadedFeatures.clear();
633573 loadedFeaturesByName.clear();
634574 parentStack.clear();
635- modifiers.clear();
636575 constraints.clear();
637576 animData.clear();
638577 skeletons.clear();
639578 meshContexts.clear();
640579 boneContexts.clear();
641580 helpers.clear();
581+ fileBlockHeadersByOma.clear();
582+ fileBlockHeadersByCode.clear();
642583 }
643584
644585 /**
--- a/engine/src/blender/com/jme3/scene/plugins/blender/BlenderLoader.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/BlenderLoader.java
@@ -195,18 +195,18 @@ public class BlenderLoader extends AbstractBlenderLoader {
195195 blenderContext.setBlenderKey(blenderKey);
196196
197197 // creating helpers
198- blenderContext.putHelper(ArmatureHelper.class, new ArmatureHelper(inputStream.getVersionNumber(), blenderKey.isFixUpAxis()));
199- blenderContext.putHelper(TextureHelper.class, new TextureHelper(inputStream.getVersionNumber(), blenderKey.isFixUpAxis()));
200- blenderContext.putHelper(MeshHelper.class, new MeshHelper(inputStream.getVersionNumber(), blenderKey.isFixUpAxis()));
201- blenderContext.putHelper(ObjectHelper.class, new ObjectHelper(inputStream.getVersionNumber(), blenderKey.isFixUpAxis()));
202- blenderContext.putHelper(CurvesHelper.class, new CurvesHelper(inputStream.getVersionNumber(), blenderKey.isFixUpAxis()));
203- blenderContext.putHelper(LightHelper.class, new LightHelper(inputStream.getVersionNumber(), blenderKey.isFixUpAxis()));
204- blenderContext.putHelper(CameraHelper.class, new CameraHelper(inputStream.getVersionNumber(), blenderKey.isFixUpAxis()));
205- blenderContext.putHelper(ModifierHelper.class, new ModifierHelper(inputStream.getVersionNumber(), blenderKey.isFixUpAxis()));
206- blenderContext.putHelper(MaterialHelper.class, new MaterialHelper(inputStream.getVersionNumber(), blenderKey.isFixUpAxis()));
207- blenderContext.putHelper(ConstraintHelper.class, new ConstraintHelper(inputStream.getVersionNumber(), blenderContext, blenderKey.isFixUpAxis()));
208- blenderContext.putHelper(IpoHelper.class, new IpoHelper(inputStream.getVersionNumber(), blenderKey.isFixUpAxis()));
209- blenderContext.putHelper(ParticlesHelper.class, new ParticlesHelper(inputStream.getVersionNumber(), blenderKey.isFixUpAxis()));
198+ blenderContext.putHelper(ArmatureHelper.class, new ArmatureHelper(inputStream.getVersionNumber(), blenderContext));
199+ blenderContext.putHelper(TextureHelper.class, new TextureHelper(inputStream.getVersionNumber(), blenderContext));
200+ blenderContext.putHelper(MeshHelper.class, new MeshHelper(inputStream.getVersionNumber(), blenderContext));
201+ blenderContext.putHelper(ObjectHelper.class, new ObjectHelper(inputStream.getVersionNumber(), blenderContext));
202+ blenderContext.putHelper(CurvesHelper.class, new CurvesHelper(inputStream.getVersionNumber(), blenderContext));
203+ blenderContext.putHelper(LightHelper.class, new LightHelper(inputStream.getVersionNumber(), blenderContext));
204+ blenderContext.putHelper(CameraHelper.class, new CameraHelper(inputStream.getVersionNumber(), blenderContext));
205+ blenderContext.putHelper(ModifierHelper.class, new ModifierHelper(inputStream.getVersionNumber(), blenderContext));
206+ blenderContext.putHelper(MaterialHelper.class, new MaterialHelper(inputStream.getVersionNumber(), blenderContext));
207+ blenderContext.putHelper(ConstraintHelper.class, new ConstraintHelper(inputStream.getVersionNumber(), blenderContext));
208+ blenderContext.putHelper(IpoHelper.class, new IpoHelper(inputStream.getVersionNumber(), blenderContext));
209+ blenderContext.putHelper(ParticlesHelper.class, new ParticlesHelper(inputStream.getVersionNumber(), blenderContext));
210210
211211 // reading the blocks (dna block is automatically saved in the blender context when found)
212212 FileBlockHeader sceneFileBlock = null;
--- a/engine/src/blender/com/jme3/scene/plugins/blender/animations/ArmatureHelper.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/animations/ArmatureHelper.java
@@ -58,10 +58,7 @@ import com.jme3.scene.plugins.blender.file.Structure;
5858 public class ArmatureHelper extends AbstractBlenderHelper {
5959 private static final Logger LOGGER = Logger.getLogger(ArmatureHelper.class.getName());
6060
61- public static final String ARMETURE_NODE_MARKER = "armeture-node";
62-
63- /** A map of bones and their old memory addresses. */
64- private Map<Bone, Long> bonesOMAs = new HashMap<Bone, Long>();
61+ public static final String ARMATURE_NODE_MARKER = "armature-node";
6562
6663 /**
6764 * This constructor parses the given blender version and stores the result.
@@ -69,11 +66,11 @@ public class ArmatureHelper extends AbstractBlenderHelper {
6966 *
7067 * @param blenderVersion
7168 * the version read from the blend file
72- * @param fixUpAxis
73- * a variable that indicates if the Y asxis is the UP axis or not
69+ * @param blenderContext
70+ * the blender context
7471 */
75- public ArmatureHelper(String blenderVersion, boolean fixUpAxis) {
76- super(blenderVersion, fixUpAxis);
72+ public ArmatureHelper(String blenderVersion, BlenderContext blenderContext) {
73+ super(blenderVersion, blenderContext);
7774 }
7875
7976 /**
@@ -93,23 +90,7 @@ public class ArmatureHelper extends AbstractBlenderHelper {
9390 */
9491 public void buildBones(Long armatureObjectOMA, Structure boneStructure, Bone parent, List<Bone> result, Matrix4f objectToArmatureTransformation, BlenderContext blenderContext) throws BlenderFileException {
9592 BoneContext bc = new BoneContext(armatureObjectOMA, boneStructure, blenderContext);
96- bc.buildBone(result, bonesOMAs, objectToArmatureTransformation, blenderContext);
97- }
98-
99- /**
100- * This method returns the old memory address of a bone. If the bone does
101- * not exist in the blend file - zero is returned.
102- *
103- * @param bone
104- * the bone whose old memory address we seek
105- * @return the old memory address of the given bone
106- */
107- public Long getBoneOMA(Bone bone) {
108- Long result = bonesOMAs.get(bone);
109- if (result == null) {
110- result = Long.valueOf(0);
111- }
112- return result;
93+ bc.buildBone(result, objectToArmatureTransformation, blenderContext);
11394 }
11495
11596 /**
--- a/engine/src/blender/com/jme3/scene/plugins/blender/animations/BoneContext.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/animations/BoneContext.java
@@ -2,7 +2,6 @@ package com.jme3.scene.plugins.blender.animations;
22
33 import java.util.ArrayList;
44 import java.util.List;
5-import java.util.Map;
65
76 import com.jme3.animation.Bone;
87 import com.jme3.animation.Skeleton;
@@ -105,19 +104,16 @@ public class BoneContext {
105104 *
106105 * @param bones
107106 * a list of bones where the newly created bone will be added
108- * @param boneOMAs
109- * the map between bone and its old memory address
110107 * @param objectToArmatureMatrix
111108 * object to armature transformation matrix
112109 * @param blenderContext
113110 * the blender context
114111 * @return newly created bone
115112 */
116- public Bone buildBone(List<Bone> bones, Map<Bone, Long> boneOMAs, Matrix4f objectToArmatureMatrix, BlenderContext blenderContext) {
113+ public Bone buildBone(List<Bone> bones, Matrix4f objectToArmatureMatrix, BlenderContext blenderContext) {
117114 Long boneOMA = boneStructure.getOldMemoryAddress();
118115 bone = new Bone(boneName);
119116 bones.add(bone);
120- boneOMAs.put(bone, boneOMA);
121117 blenderContext.addLoadedFeatures(boneOMA, boneName, boneStructure, bone);
122118
123119 Vector3f poseLocation = restMatrix.toTranslationVector();
@@ -132,7 +128,7 @@ public class BoneContext {
132128
133129 bone.setBindTransforms(poseLocation, rotation, scale);
134130 for (BoneContext child : children) {
135- bone.addChild(child.buildBone(bones, boneOMAs, objectToArmatureMatrix, blenderContext));
131+ bone.addChild(child.buildBone(bones, objectToArmatureMatrix, blenderContext));
136132 }
137133
138134 return bone;
--- a/engine/src/blender/com/jme3/scene/plugins/blender/animations/Ipo.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/animations/Ipo.java
@@ -89,15 +89,6 @@ public class Ipo {
8989 }
9090
9191 /**
92- * This method returns the curves amount.
93- *
94- * @return the curves amount
95- */
96- public int getCurvesAmount() {
97- return bezierCurves.length;
98- }
99-
100- /**
10192 * This method returns the frame where last bezier triple center point of
10293 * the specified bezier curve is located.
10394 *
--- a/engine/src/blender/com/jme3/scene/plugins/blender/animations/IpoHelper.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/animations/IpoHelper.java
@@ -29,11 +29,11 @@ public class IpoHelper extends AbstractBlenderHelper {
2929 *
3030 * @param blenderVersion
3131 * the version read from the blend file
32- * @param fixUpAxis
33- * a variable that indicates if the Y asxis is the UP axis or not
32+ * @param blenderContext
33+ * the blender context
3434 */
35- public IpoHelper(String blenderVersion, boolean fixUpAxis) {
36- super(blenderVersion, fixUpAxis);
35+ public IpoHelper(String blenderVersion, BlenderContext blenderContext) {
36+ super(blenderVersion, blenderContext);
3737 }
3838
3939 /**
@@ -190,11 +190,6 @@ public class IpoHelper extends AbstractBlenderHelper {
190190 }
191191
192192 @Override
193- public int getCurvesAmount() {
194- return 0;
195- }
196-
197- @Override
198193 public BoneTrack calculateTrack(int boneIndex, Quaternion localQuaternionRotation, int startFrame, int stopFrame, int fps, boolean boneTrack) {
199194 throw new IllegalStateException("Constatnt ipo object cannot be used for calculating bone tracks!");
200195 }
--- a/engine/src/blender/com/jme3/scene/plugins/blender/cameras/CameraHelper.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/cameras/CameraHelper.java
@@ -26,11 +26,11 @@ public class CameraHelper extends AbstractBlenderHelper {
2626 * different blender versions.
2727 * @param blenderVersion
2828 * the version read from the blend file
29- * @param fixUpAxis
30- * a variable that indicates if the Y asxis is the UP axis or not
29+ * @param blenderContext
30+ * the blender context
3131 */
32- public CameraHelper(String blenderVersion, boolean fixUpAxis) {
33- super(blenderVersion, fixUpAxis);
32+ public CameraHelper(String blenderVersion, BlenderContext blenderContext) {
33+ super(blenderVersion, blenderContext);
3434 }
3535
3636 /**
--- a/engine/src/blender/com/jme3/scene/plugins/blender/constraints/ConstraintHelper.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/constraints/ConstraintHelper.java
@@ -1,7 +1,6 @@
11 package com.jme3.scene.plugins.blender.constraints;
22
33 import java.util.ArrayList;
4-import java.util.Arrays;
54 import java.util.HashMap;
65 import java.util.List;
76 import java.util.Map;
@@ -40,26 +39,16 @@ public class ConstraintHelper extends AbstractBlenderHelper {
4039 private static final Quaternion POS_PARLOC_SPACE_QUATERNION = new Quaternion(new float[] { FastMath.HALF_PI, 0, 0 });
4140 private static final Quaternion NEG_PARLOC_SPACE_QUATERNION = new Quaternion(new float[] { -FastMath.HALF_PI, 0, 0 });
4241
43- private BlenderContext blenderContext;
44-
4542 /**
46- * Helper constructor. It's main task is to generate the affection
47- * functions. These functions are common to all ConstraintHelper instances.
48- * Unfortunately this constructor might grow large. If it becomes too large
49- * - I shall consider refactoring. The constructor parses the given blender
50- * version and stores the result. Some functionalities may differ in
51- * different blender versions.
43+ * Helper constructor.
5244 *
5345 * @param blenderVersion
5446 * the version read from the blend file
5547 * @param blenderContext
5648 * the blender context
57- * @param fixUpAxis
58- * a variable that indicates if the Y asxis is the UP axis or not
5949 */
60- public ConstraintHelper(String blenderVersion, BlenderContext blenderContext, boolean fixUpAxis) {
61- super(blenderVersion, fixUpAxis);
62- this.blenderContext = blenderContext;
50+ public ConstraintHelper(String blenderVersion, BlenderContext blenderContext) {
51+ super(blenderVersion, blenderContext);
6352 }
6453
6554 /**
@@ -231,16 +220,14 @@ public class ConstraintHelper extends AbstractBlenderHelper {
231220 */
232221 public Transform getTransform(Long oma, String subtargetName, Space space) {
233222 Spatial feature = (Spatial) blenderContext.getLoadedFeature(oma, LoadedFeatureDataType.LOADED_FEATURE);
234- boolean isArmature = feature.getUserData(ArmatureHelper.ARMETURE_NODE_MARKER) != null;
223+ boolean isArmature = feature.getUserData(ArmatureHelper.ARMATURE_NODE_MARKER) != null;
235224 if (isArmature) {
236225 BoneContext targetBoneContext = blenderContext.getBoneByName(subtargetName);
237226 Bone bone = targetBoneContext.getBone();
238227
239228 switch (space) {
240229 case CONSTRAINT_SPACE_WORLD:
241- Transform t = new Transform(bone.getModelSpacePosition(), bone.getModelSpaceRotation(), bone.getModelSpaceScale());
242- System.out.println("A: " + Arrays.toString(t.getRotation().toAngles(null)));
243- return t;
230+ return new Transform(bone.getModelSpacePosition(), bone.getModelSpaceRotation(), bone.getModelSpaceScale());
244231 case CONSTRAINT_SPACE_LOCAL:
245232 Transform localTransform = new Transform(bone.getLocalPosition(), bone.getLocalRotation());
246233 localTransform.setScale(bone.getLocalScale());
@@ -264,8 +251,9 @@ public class ConstraintHelper extends AbstractBlenderHelper {
264251 if (bone.getParent() != null) {
265252 Bone parent = bone.getParent();
266253 parentLocalMatrix = this.toMatrix(parent.getLocalPosition(), parent.getLocalRotation(), parent.getLocalScale());
267- } else {// we need to clone it because otherwise we could
268- // spoil the IDENTITY matrix
254+ } else {
255+ // we need to clone it because otherwise we could spoil
256+ // the IDENTITY matrix
269257 parentLocalMatrix = parentLocalMatrix.clone();
270258 }
271259 Matrix4f boneLocalMatrix = this.toMatrix(bone.getLocalPosition(), bone.getLocalRotation(), bone.getLocalScale());
@@ -309,7 +297,7 @@ public class ConstraintHelper extends AbstractBlenderHelper {
309297 */
310298 public void applyTransform(Long oma, String subtargetName, Space space, Transform transform) {
311299 Spatial feature = (Spatial) blenderContext.getLoadedFeature(oma, LoadedFeatureDataType.LOADED_FEATURE);
312- boolean isArmature = feature.getUserData(ArmatureHelper.ARMETURE_NODE_MARKER) != null;
300+ boolean isArmature = feature.getUserData(ArmatureHelper.ARMATURE_NODE_MARKER) != null;
313301 if (isArmature) {
314302 Skeleton skeleton = blenderContext.getSkeleton(oma);
315303 BoneContext targetBoneContext = blenderContext.getBoneByName(subtargetName);
@@ -324,7 +312,6 @@ public class ConstraintHelper extends AbstractBlenderHelper {
324312 bone.setBindTransforms(transform.getTranslation(), transform.getRotation(), transform.getScale());
325313 break;
326314 case CONSTRAINT_SPACE_WORLD:
327- System.out.println("B: " + Arrays.toString(transform.getRotation().toAngles(null)));
328315 Matrix4f boneMatrix = this.toMatrix(transform);
329316 Bone parent = bone.getParent();
330317 if (parent != null) {
@@ -352,8 +339,9 @@ public class ConstraintHelper extends AbstractBlenderHelper {
352339 if (bone.getParent() != null) {
353340 parentLocalMatrix = this.toMatrix(bone.getParent().getLocalPosition(), bone.getParent().getLocalRotation(), bone.getParent().getLocalScale());
354341 parentLocalMatrix.invertLocal();
355- } else {// we need to clone it because otherwise we could
356- // spoil the IDENTITY matrix
342+ } else {
343+ // we need to clone it because otherwise we could
344+ // spoil the IDENTITY matrix
357345 parentLocalMatrix = parentLocalMatrix.clone();
358346 }
359347 Matrix4f m = this.toMatrix(transform.getTranslation(), transform.getRotation(), transform.getScale());
--- a/engine/src/blender/com/jme3/scene/plugins/blender/constraints/SimulationNode.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/constraints/SimulationNode.java
@@ -43,8 +43,6 @@ public class SimulationNode {
4343 private String name;
4444 /** A list of children for the node (either bones or child spatials). */
4545 private List<SimulationNode> children = new ArrayList<SimulationNode>();
46- /** A virtual track for each of the nodes. */
47- private Map<String, VirtualTrack> virtualTrack = new HashMap<String, VirtualTrack>();
4846 /** A list of constraints that the current node has. */
4947 private List<Constraint> constraints;
5048 /** A list of node's animations. */
@@ -91,7 +89,7 @@ public class SimulationNode {
9189 */
9290 private SimulationNode(Long featureOMA, BlenderContext blenderContext, boolean rootNode) {
9391 Node spatial = (Node) blenderContext.getLoadedFeature(featureOMA, LoadedFeatureDataType.LOADED_FEATURE);
94- if (spatial.getUserData(ArmatureHelper.ARMETURE_NODE_MARKER) != null) {
92+ if (spatial.getUserData(ArmatureHelper.ARMATURE_NODE_MARKER) != null) {
9593 this.skeleton = blenderContext.getSkeleton(featureOMA);
9694
9795 Node nodeWithAnimationControl = blenderContext.getControlledNode(skeleton);
@@ -206,7 +204,6 @@ public class SimulationNode {
206204 float maxTime = animationTimeBoundaries[1];
207205
208206 VirtualTrack vTrack = new VirtualTrack(maxFrame, maxTime);
209- virtualTrack.put(animation.getName(), vTrack);
210207 for (Track track : animation.getTracks()) {
211208 for (int frame = 0; frame < maxFrame; ++frame) {
212209 spatial.setLocalTranslation(((SpatialTrack) track).getTranslations()[frame]);
@@ -260,11 +257,11 @@ public class SimulationNode {
260257 Map<Integer, VirtualTrack> tracks = new HashMap<Integer, VirtualTrack>();
261258 Map<Integer, Transform> previousTransforms = new HashMap<Integer, Transform>();
262259 for (int frame = 0; frame < maxFrame; ++frame) {
263- this.reset();// this MUST be done here, otherwise
264- // setting next frame of animation will
265- // lead to possible errors
266- // first set proper time for all bones in all the tracks
267- // ...
260+ // this MUST be done here, otherwise setting next frame of animation will
261+ // lead to possible errors
262+ this.reset();
263+
264+ // first set proper time for all bones in all the tracks ...
268265 for (Track track : animation.getTracks()) {
269266 float time = ((BoneTrack) track).getTimes()[frame];
270267 Integer boneIndex = ((BoneTrack) track).getTargetBoneIndex();
--- a/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinition.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinition.java
@@ -5,12 +5,32 @@ import com.jme3.scene.plugins.blender.BlenderContext;
55 import com.jme3.scene.plugins.blender.BlenderContext.LoadedFeatureDataType;
66 import com.jme3.scene.plugins.blender.file.Structure;
77
8+/**
9+ * A base class for all constraint definitions.
10+ *
11+ * @author Marcin Roguski (Kaelthas)
12+ */
813 public abstract class ConstraintDefinition {
14+ /** Constraints flag. Used to load user's options applied to the constraint. */
915 protected int flag;
16+ /** The constraint's owner. Loaded during runtime. */
1017 private Object owner;
18+ /** The blender context. */
1119 private BlenderContext blenderContext;
20+ /** The constraint's owner OMA. */
1221 private Long ownerOMA;
1322
23+ /**
24+ * Loads a constraint definition based on the constraint definition
25+ * structure.
26+ *
27+ * @param constraintData
28+ * the constraint definition structure
29+ * @param ownerOMA
30+ * the constraint's owner OMA
31+ * @param blenderContext
32+ * the blender context
33+ */
1434 public ConstraintDefinition(Structure constraintData, Long ownerOMA, BlenderContext blenderContext) {
1535 if (constraintData != null) {// Null constraint has no data
1636 Number flag = (Number) constraintData.getFieldValue("flag");
@@ -29,7 +49,7 @@ public abstract class ConstraintDefinition {
2949 *
3050 * @return the owner of the constraint or null if none is set
3151 */
32- public Object getOwner() {
52+ protected Object getOwner() {
3353 if (ownerOMA != null && owner == null) {
3454 owner = blenderContext.getLoadedFeature(ownerOMA, LoadedFeatureDataType.LOADED_FEATURE);
3555 if (owner == null) {
@@ -39,11 +59,28 @@ public abstract class ConstraintDefinition {
3959 return owner;
4060 }
4161
62+ /**
63+ * @return <b>true</b> if the definition is implemented and <b>false</b>
64+ * otherwise
65+ */
4266 public boolean isImplemented() {
4367 return true;
4468 }
4569
70+ /**
71+ * @return the type name of the constraint
72+ */
4673 public abstract String getConstraintTypeName();
4774
75+ /**
76+ * Bakes the constraint for the current feature (bone or spatial) position.
77+ *
78+ * @param ownerTransform
79+ * the input transform (here the result is stored)
80+ * @param targetTransform
81+ * the target transform used by some of the constraints
82+ * @param influence
83+ * the influence of the constraint (from range <0; 1>)
84+ */
4885 public abstract void bake(Transform ownerTransform, Transform targetTransform, float influence);
4986 }
--- a/engine/src/blender/com/jme3/scene/plugins/blender/curves/CurvesHelper.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/curves/CurvesHelper.java
@@ -89,11 +89,11 @@ public class CurvesHelper extends AbstractBlenderHelper {
8989 * different blender versions.
9090 * @param blenderVersion
9191 * the version read from the blend file
92- * @param fixUpAxis
93- * a variable that indicates if the Y asxis is the UP axis or not
92+ * @param blenderContext
93+ * the blender context
9494 */
95- public CurvesHelper(String blenderVersion, boolean fixUpAxis) {
96- super(blenderVersion, fixUpAxis);
95+ public CurvesHelper(String blenderVersion, BlenderContext blenderContext) {
96+ super(blenderVersion, blenderContext);
9797 }
9898
9999 /**
--- a/engine/src/blender/com/jme3/scene/plugins/blender/file/DnaBlockData.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/file/DnaBlockData.java
@@ -38,7 +38,7 @@ import java.util.Map;
3838
3939 /**
4040 * The data block containing the description of the file.
41- * @author Marcin Roguski
41+ * @author Marcin Roguski (Kaelthas)
4242 */
4343 public class DnaBlockData {
4444
--- a/engine/src/blender/com/jme3/scene/plugins/blender/file/DynamicArray.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/file/DynamicArray.java
@@ -57,26 +57,6 @@ public class DynamicArray<T> implements Cloneable {
5757 * @throws BlenderFileException
5858 * an exception is thrown if one of the sizes is not a positive number
5959 */
60- @SuppressWarnings("unchecked")
61- public DynamicArray(int[] tableSizes) throws BlenderFileException {
62- this.tableSizes = tableSizes;
63- int totalSize = 1;
64- for (int size : tableSizes) {
65- if (size <= 0) {
66- throw new BlenderFileException("The size of the table must be positive!");
67- }
68- totalSize *= size;
69- }
70- this.array = (T[]) new Object[totalSize];
71- }
72-
73- /**
74- * Constructor. Builds an empty array of the specified sizes.
75- * @param tableSizes
76- * the sizes of the table
77- * @throws BlenderFileException
78- * an exception is thrown if one of the sizes is not a positive number
79- */
8060 public DynamicArray(int[] tableSizes, T[] data) throws BlenderFileException {
8161 this.tableSizes = tableSizes;
8262 int totalSize = 1;
--- a/engine/src/blender/com/jme3/scene/plugins/blender/file/Field.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/file/Field.java
@@ -281,7 +281,7 @@ class Field implements Cloneable {
281281 * This method builds the full name of the field (with function, pointer and table indications).
282282 * @return the full name of the field
283283 */
284- public String getFullName() {
284+ /*package*/ String getFullName() {
285285 StringBuilder result = new StringBuilder();
286286 if (function) {
287287 result.append('(');
--- a/engine/src/blender/com/jme3/scene/plugins/blender/file/FileBlockHeader.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/file/FileBlockHeader.java
@@ -130,14 +130,6 @@ public class FileBlockHeader {
130130 }
131131
132132 /**
133- * This method returns the memory address.
134- * @return the memory address
135- */
136- public long getOldMemoryAddress() {
137- return oldMemoryAddress;
138- }
139-
140- /**
141133 * This method returns the sdna index.
142134 * @return the sdna index
143135 */
--- a/engine/src/blender/com/jme3/scene/plugins/blender/file/Structure.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/file/Structure.java
@@ -207,16 +207,6 @@ public class Structure implements Cloneable {
207207 }
208208
209209 /**
210- * This method returns the field name of the given index.
211- * @param fieldIndex
212- * the index of the field
213- * @return the field name of the given index
214- */
215- public String getFieldName(int fieldIndex) {
216- return fields[fieldIndex].name;
217- }
218-
219- /**
220210 * This method returns the full field name of the given index.
221211 * @param fieldIndex
222212 * the index of the field
@@ -278,10 +268,9 @@ public class Structure implements Cloneable {
278268
279269 /**
280270 * This enum enumerates all known data types that can be found in the blend file.
281- * @author Marcin Roguski
271+ * @author Marcin Roguski (Kaelthas)
282272 */
283- /* package */
284- static enum DataType {
273+ /* package */ static enum DataType {
285274
286275 CHARACTER, SHORT, INTEGER, LONG, FLOAT, DOUBLE, VOID, STRUCTURE, POINTER;
287276 /** The map containing the known primary types. */
--- a/engine/src/blender/com/jme3/scene/plugins/blender/lights/LightHelper.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/lights/LightHelper.java
@@ -60,11 +60,11 @@ public class LightHelper extends AbstractBlenderHelper {
6060 * different blender versions.
6161 * @param blenderVersion
6262 * the version read from the blend file
63- * @param fixUpAxis
64- * a variable that indicates if the Y asxis is the UP axis or not
63+ * @param blenderContext
64+ * the blender context
6565 */
66- public LightHelper(String blenderVersion, boolean fixUpAxis) {
67- super(blenderVersion, fixUpAxis);
66+ public LightHelper(String blenderVersion, BlenderContext blenderContext) {
67+ super(blenderVersion, blenderContext);
6868 }
6969
7070 public LightNode toLight(Structure structure, BlenderContext blenderContext) throws BlenderFileException {
--- a/engine/src/blender/com/jme3/scene/plugins/blender/materials/MaterialContext.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/materials/MaterialContext.java
@@ -164,6 +164,18 @@ public final class MaterialContext {
164164 this.transparent = transparent;
165165 }
166166
167+ /**
168+ * Applies material to a given geometry.
169+ *
170+ * @param geometry
171+ * the geometry
172+ * @param geometriesOMA
173+ * the geometries OMA
174+ * @param userDefinedUVCoordinates
175+ * UV coords defined by user
176+ * @param blenderContext
177+ * the blender context
178+ */
167179 public void applyMaterial(Geometry geometry, Long geometriesOMA, List<Vector2f> userDefinedUVCoordinates, BlenderContext blenderContext) {
168180 Material material = null;
169181 if (shadeless) {
@@ -327,13 +339,6 @@ public final class MaterialContext {
327339 }
328340
329341 /**
330- * @return the face cull mode
331- */
332- public FaceCullMode getFaceCullMode() {
333- return faceCullMode;
334- }
335-
336- /**
337342 * This method returns the diffuse color.
338343 *
339344 * @param materialStructure
--- a/engine/src/blender/com/jme3/scene/plugins/blender/materials/MaterialHelper.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/materials/MaterialHelper.java
@@ -31,9 +31,15 @@
3131 */
3232 package com.jme3.scene.plugins.blender.materials;
3333
34+import java.nio.ByteBuffer;
35+import java.util.HashMap;
36+import java.util.List;
37+import java.util.Map;
38+import java.util.logging.Level;
39+import java.util.logging.Logger;
40+
3441 import com.jme3.asset.BlenderKey.FeaturesToLoad;
3542 import com.jme3.material.MatParam;
36-import com.jme3.material.MatParamTexture;
3743 import com.jme3.material.Material;
3844 import com.jme3.math.ColorRGBA;
3945 import com.jme3.math.FastMath;
@@ -48,13 +54,6 @@ import com.jme3.texture.Image;
4854 import com.jme3.texture.Image.Format;
4955 import com.jme3.texture.Texture;
5056 import com.jme3.util.BufferUtils;
51-import java.nio.ByteBuffer;
52-import java.util.HashMap;
53-import java.util.List;
54-import java.util.Map;
55-import java.util.Map.Entry;
56-import java.util.logging.Level;
57-import java.util.logging.Logger;
5857
5958 public class MaterialHelper extends AbstractBlenderHelper {
6059 private static final Logger LOGGER = Logger.getLogger(MaterialHelper.class.getName());
@@ -93,11 +92,11 @@ public class MaterialHelper extends AbstractBlenderHelper {
9392 *
9493 * @param blenderVersion
9594 * the version read from the blend file
96- * @param fixUpAxis
97- * a variable that indicates if the Y asxis is the UP axis or not
95+ * @param blenderContext
96+ * the blender context
9897 */
99- public MaterialHelper(String blenderVersion, boolean fixUpAxis) {
100- super(blenderVersion, false);
98+ public MaterialHelper(String blenderVersion, BlenderContext blenderContext) {
99+ super(blenderVersion, blenderContext);
101100 // setting alpha masks
102101 alphaMasks.put(ALPHA_MASK_NONE, new IAlphaMask() {
103102 public void setImageSize(int width, int height) {
@@ -175,49 +174,6 @@ public class MaterialHelper extends AbstractBlenderHelper {
175174 }
176175
177176 /**
178- * This method returns a material similar to the one given but without textures. If the material has no textures it is not cloned but
179- * returned itself.
180- *
181- * @param material
182- * a material to be cloned without textures
183- * @param imageType
184- * type of image defined by blender; the constants are defined in TextureHelper
185- * @return material without textures of a specified type
186- */
187- public Material getNonTexturedMaterial(Material material, int imageType) {
188- String[] textureParamNames = new String[] { TEXTURE_TYPE_DIFFUSE, TEXTURE_TYPE_NORMAL, TEXTURE_TYPE_GLOW, TEXTURE_TYPE_SPECULAR, TEXTURE_TYPE_ALPHA };
189- Map<String, Texture> textures = new HashMap<String, Texture>(textureParamNames.length);
190- for (String textureParamName : textureParamNames) {
191- MatParamTexture matParamTexture = material.getTextureParam(textureParamName);
192- if (matParamTexture != null) {
193- textures.put(textureParamName, matParamTexture.getTextureValue());
194- }
195- }
196- if (textures.isEmpty()) {
197- return material;
198- } else {
199- // clear all textures first so that wo de not waste resources cloning them
200- for (Entry<String, Texture> textureParamName : textures.entrySet()) {
201- String name = textureParamName.getValue().getName();
202- try {
203- int type = Integer.parseInt(name);
204- if (type == imageType) {
205- material.clearParam(textureParamName.getKey());
206- }
207- } catch (NumberFormatException e) {
208- LOGGER.log(Level.WARNING, "The name of the texture does not contain the texture type value! {0} will not be removed!", name);
209- }
210- }
211- Material result = material.clone();
212- // put the textures back in place
213- for (Entry<String, Texture> textureEntry : textures.entrySet()) {
214- material.setTexture(textureEntry.getKey(), textureEntry.getValue());
215- }
216- return result;
217- }
218- }
219-
220- /**
221177 * This method converts the given material into particles-usable material.
222178 * The texture and glow color are being copied.
223179 * The method assumes it receives the Lighting type of material.
@@ -270,53 +226,6 @@ public class MaterialHelper extends AbstractBlenderHelper {
270226 }
271227
272228 /**
273- * This method indicates if the material has any kind of texture.
274- *
275- * @param material
276- * the material
277- * @return <b>true</b> if the texture exists in the material and <B>false</b> otherwise
278- */
279- public boolean hasTexture(Material material) {
280- if (material != null) {
281- if (material.getTextureParam(TEXTURE_TYPE_ALPHA) != null) {
282- return true;
283- }
284- if (material.getTextureParam(TEXTURE_TYPE_COLOR) != null) {
285- return true;
286- }
287- if (material.getTextureParam(TEXTURE_TYPE_DIFFUSE) != null) {
288- return true;
289- }
290- if (material.getTextureParam(TEXTURE_TYPE_GLOW) != null) {
291- return true;
292- }
293- if (material.getTextureParam(TEXTURE_TYPE_NORMAL) != null) {
294- return true;
295- }
296- if (material.getTextureParam(TEXTURE_TYPE_SPECULAR) != null) {
297- return true;
298- }
299- }
300- return false;
301- }
302-
303- /**
304- * This method indicates if the material has a texture of a specified type.
305- *
306- * @param material
307- * the material
308- * @param textureType
309- * the type of the texture
310- * @return <b>true</b> if the texture exists in the material and <B>false</b> otherwise
311- */
312- public boolean hasTexture(Material material, String textureType) {
313- if (material != null) {
314- return material.getTextureParam(textureType) != null;
315- }
316- return false;
317- }
318-
319- /**
320229 * This method returns the table of materials connected to the specified structure. The given structure can be of any type (ie. mesh or
321230 * curve) but needs to have 'mat' field/
322231 *
--- a/engine/src/blender/com/jme3/scene/plugins/blender/meshes/MeshBuilder.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/meshes/MeshBuilder.java
@@ -12,6 +12,11 @@ import com.jme3.math.Vector2f;
1212 import com.jme3.math.Vector3f;
1313 import com.jme3.util.BufferUtils;
1414
15+/**
16+ * A builder class for meshes.
17+ *
18+ * @author Marcin Roguski (Kaelthas)
19+ */
1520 /*package*/class MeshBuilder {
1621 private static final Logger LOGGER = Logger.getLogger(MeshBuilder.class.getName());
1722
--- a/engine/src/blender/com/jme3/scene/plugins/blender/meshes/MeshContext.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/meshes/MeshContext.java
@@ -18,8 +18,6 @@ public class MeshContext {
1818 private Map<Integer, Geometry> geometries = new HashMap<Integer, Geometry>();
1919 /** The vertex reference map. */
2020 private Map<Integer, Map<Integer, List<Integer>>> vertexReferenceMap;
21- /** The UV-coordinates for each of the geometries. */
22- private Map<Geometry, VertexBuffer> uvCoordinates = new HashMap<Geometry, VertexBuffer>();
2321 /** Bind buffer for vertices is stored here and applied when required. */
2422 private Map<Integer, VertexBuffer> bindPoseBuffer = new HashMap<Integer, VertexBuffer>();
2523 /** Bind buffer for normals is stored here and applied when required. */
@@ -82,29 +80,6 @@ public class MeshContext {
8280 }
8381
8482 /**
85- * This method adds the mesh's UV-coordinates.
86- *
87- * @param geometry
88- * the mesh that has the UV-coordinates
89- * @param vertexBuffer
90- * the mesh's UV-coordinates
91- */
92- public void addUVCoordinates(Geometry geometry, VertexBuffer vertexBuffer) {
93- uvCoordinates.put(geometry, vertexBuffer);
94- }
95-
96- /**
97- * This method returns the mesh's UV-coordinates.
98- *
99- * @param geometry
100- * the mesh
101- * @return the mesh's UV-coordinates
102- */
103- public VertexBuffer getUVCoordinates(Geometry geometry) {
104- return uvCoordinates.get(geometry);
105- }
106-
107- /**
10883 * This method sets the bind buffer for vertices.
10984 *
11085 * @param materialIndex
--- a/engine/src/blender/com/jme3/scene/plugins/blender/meshes/MeshHelper.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/meshes/MeshHelper.java
@@ -71,11 +71,11 @@ public class MeshHelper extends AbstractBlenderHelper {
7171 *
7272 * @param blenderVersion
7373 * the version read from the blend file
74- * @param fixUpAxis
75- * a variable that indicates if the Y asxis is the UP axis or not
74+ * @param blenderContext
75+ * the blender context
7676 */
77- public MeshHelper(String blenderVersion, boolean fixUpAxis) {
78- super(blenderVersion, fixUpAxis);
77+ public MeshHelper(String blenderVersion, BlenderContext blenderContext) {
78+ super(blenderVersion, blenderContext);
7979 }
8080
8181 /**
--- a/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ArmatureModifier.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ArmatureModifier.java
@@ -28,6 +28,7 @@ import com.jme3.scene.VertexBuffer.Usage;
2828 import com.jme3.scene.plugins.blender.BlenderContext;
2929 import com.jme3.scene.plugins.blender.BlenderContext.LoadedFeatureDataType;
3030 import com.jme3.scene.plugins.blender.animations.ArmatureHelper;
31+import com.jme3.scene.plugins.blender.animations.BoneContext;
3132 import com.jme3.scene.plugins.blender.exceptions.BlenderFileException;
3233 import com.jme3.scene.plugins.blender.file.FileBlockHeader;
3334 import com.jme3.scene.plugins.blender.file.Pointer;
@@ -72,9 +73,7 @@ import com.jme3.util.BufferUtils;
7273 */
7374 public ArmatureModifier(Structure objectStructure, Structure modifierStructure, BlenderContext blenderContext) throws BlenderFileException {
7475 Structure meshStructure = ((Pointer) objectStructure.getFieldValue("data")).fetchData(blenderContext.getInputStream()).get(0);
75- Pointer pDvert = (Pointer) meshStructure.getFieldValue("dvert");// dvert
76- // =
77- // DeformVERTices
76+ Pointer pDvert = (Pointer) meshStructure.getFieldValue("dvert");// dvert = DeformVERTices
7877
7978 // if pDvert==null then there are not vertex groups and no need to load
8079 // skeleton (untill bone envelopes are supported)
@@ -162,9 +161,12 @@ import com.jme3.util.BufferUtils;
162161
163162 // store the animation data for each bone
164163 for (Bone bone : bones) {
165- Long boneOma = armatureHelper.getBoneOMA(bone);
166- if (boneOma != null) {
167- blenderContext.setAnimData(boneOma, animData);
164+ if(bone.getName().length() > 0) {
165+ BoneContext boneContext = blenderContext.getBoneContext(bone);
166+ Long boneOma = boneContext.getBoneOma();
167+ if (boneOma != null) {
168+ blenderContext.setAnimData(boneOma, animData);
169+ }
168170 }
169171 }
170172 } else {
@@ -300,39 +302,18 @@ import com.jme3.util.BufferUtils;
300302
301303 if (pDvert.isNotNull()) {// assigning weights and bone indices
302304 boolean warnAboutTooManyVertexWeights = false;
303- List<Structure> dverts = pDvert.fetchData(blenderContext.getInputStream());// dverts.size()
304- // ==
305- // verticesAmount
306- // (one
307- // dvert
308- // per
309- // vertex
310- // in
311- // blender)
305+ // dverts.size() = verticesAmount (one dvert per vertex in blender)
306+ List<Structure> dverts = pDvert.fetchData(blenderContext.getInputStream());
312307 int vertexIndex = 0;
313308 // use tree map to sort weights from the lowest to the highest ones
314309 TreeMap<Float, Integer> weightToIndexMap = new TreeMap<Float, Integer>();
315310
316311 for (Structure dvert : dverts) {
317- List<Integer> vertexIndices = vertexReferenceMap.get(Integer.valueOf(vertexIndex));// we
318- // fetch
319- // the
320- // referenced
321- // vertices
322- // here
312+ //we fetch the referenced vertices here
313+ List<Integer> vertexIndices = vertexReferenceMap.get(Integer.valueOf(vertexIndex));
323314 if (vertexIndices != null) {
324- int totweight = ((Number) dvert.getFieldValue("totweight")).intValue();// total
325- // amount
326- // of
327- // weights
328- // assignet
329- // to
330- // the
331- // vertex
332- // (max.
333- // 4
334- // in
335- // JME)
315+ // total amount of wights assigned to the vertex (max. 4 in JME)
316+ int totweight = ((Number) dvert.getFieldValue("totweight")).intValue();
336317 Pointer pDW = (Pointer) dvert.getFieldValue("dw");
337318 if (totweight > 0 && groupToBoneIndexMap != null) {
338319 weightToIndexMap.clear();
@@ -448,9 +429,4 @@ import com.jme3.util.BufferUtils;
448429 }
449430 weightsFloatData.rewind();
450431 }
451-
452- @Override
453- public String getType() {
454- return Modifier.ARMATURE_MODIFIER_DATA;
455- }
456432 }
--- a/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ArrayModifier.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ArrayModifier.java
@@ -239,9 +239,4 @@ import java.util.logging.Logger;
239239 }
240240 return node;
241241 }
242-
243- @Override
244- public String getType() {
245- return ARRAY_MODIFIER_DATA;
246- }
247242 }
--- a/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/MirrorModifier.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/MirrorModifier.java
@@ -192,9 +192,4 @@ import com.jme3.scene.plugins.blender.objects.ObjectHelper;
192192 }
193193 return node;
194194 }
195-
196- @Override
197- public String getType() {
198- return Modifier.MIRROR_MODIFIER_DATA;
199- }
200195 }
--- a/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/Modifier.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/Modifier.java
@@ -42,13 +42,6 @@ public abstract class Modifier {
4242 public abstract Node apply(Node node, BlenderContext blenderContext);
4343
4444 /**
45- * This method returns blender's type of modifier.
46- *
47- * @return blender's type of modifier
48- */
49- public abstract String getType();
50-
51- /**
5245 * Determines if the modifier can be applied multiple times over one mesh.
5346 * At this moment only armature and object animation modifiers cannot be
5447 * applied multiple times.
--- a/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ModifierHelper.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ModifierHelper.java
@@ -61,11 +61,11 @@ public class ModifierHelper extends AbstractBlenderHelper {
6161 *
6262 * @param blenderVersion
6363 * the version read from the blend file
64- * @param fixUpAxis
65- * a variable that indicates if the Y asxis is the UP axis or not
64+ * @param blenderContext
65+ * the blender context
6666 */
67- public ModifierHelper(String blenderVersion, boolean fixUpAxis) {
68- super(blenderVersion, fixUpAxis);
67+ public ModifierHelper(String blenderVersion, BlenderContext blenderContext) {
68+ super(blenderVersion, blenderContext);
6969 }
7070
7171 /**
@@ -103,7 +103,6 @@ public class ModifierHelper extends AbstractBlenderHelper {
103103 if (modifier != null) {
104104 if (modifier.isModifying()) {
105105 result.add(modifier);
106- blenderContext.addModifier(objectStructure.getOldMemoryAddress(), modifier);
107106 alreadyReadModifiers.add(modifierType);
108107 } else {
109108 LOGGER.log(Level.WARNING, "The modifier {0} will cause no changes in the model. It will be ignored!", modifierStructure.getName());
@@ -155,7 +154,6 @@ public class ModifierHelper extends AbstractBlenderHelper {
155154 Ipo ipo = ipoHelper.fromIpoStructure(ipoStructure, blenderContext);
156155 if (ipo != null) {
157156 result = new ObjectAnimationModifier(ipo, objectStructure.getName(), objectStructure.getOldMemoryAddress(), blenderContext);
158- blenderContext.addModifier(objectStructure.getOldMemoryAddress(), result);
159157 }
160158 }
161159 return result;
@@ -186,7 +184,6 @@ public class ModifierHelper extends AbstractBlenderHelper {
186184 Ipo ipo = ipoHelper.fromAction(actionStructure, blenderContext);
187185 if (ipo != null) {// ipo can be null if it has no curves applied, ommit such modifier then
188186 result = new ObjectAnimationModifier(ipo, actionStructure.getName(), objectStructure.getOldMemoryAddress(), blenderContext);
189- blenderContext.addModifier(objectStructure.getOldMemoryAddress(), result);
190187 }
191188 }
192189 }
--- a/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ObjectAnimationModifier.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ObjectAnimationModifier.java
@@ -86,9 +86,4 @@ import com.jme3.scene.plugins.ogre.AnimData;
8686 }
8787 return node;
8888 }
89-
90- @Override
91- public String getType() {
92- return Modifier.OBJECT_ANIMATION_MODIFIER_DATA;
93- }
9489 }
--- a/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ParticlesModifier.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/modifiers/ParticlesModifier.java
@@ -92,9 +92,4 @@ import java.util.logging.Logger;
9292 node.attachChild(emitter);
9393 return node;
9494 }
95-
96- @Override
97- public String getType() {
98- return Modifier.PARTICLE_MODIFIER_DATA;
99- }
10095 }
--- a/engine/src/blender/com/jme3/scene/plugins/blender/objects/ObjectHelper.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/objects/ObjectHelper.java
@@ -90,11 +90,11 @@ public class ObjectHelper extends AbstractBlenderHelper {
9090 *
9191 * @param blenderVersion
9292 * the version read from the blend file
93- * @param fixUpAxis
94- * a variable that indicates if the Y asxis is the UP axis or not
93+ * @param blenderContext
94+ * the blender context
9595 */
96- public ObjectHelper(String blenderVersion, boolean fixUpAxis) {
97- super(blenderVersion, fixUpAxis);
96+ public ObjectHelper(String blenderVersion, BlenderContext blenderContext) {
97+ super(blenderVersion, blenderContext);
9898 }
9999
100100 /**
@@ -214,7 +214,7 @@ public class ObjectHelper extends AbstractBlenderHelper {
214214 // parent-children relationships between nodes
215215 Node armature = new Node(name);
216216 armature.setLocalTransform(t);
217- armature.setUserData(ArmatureHelper.ARMETURE_NODE_MARKER, Boolean.TRUE);
217+ armature.setUserData(ArmatureHelper.ARMATURE_NODE_MARKER, Boolean.TRUE);
218218
219219 if (parent instanceof Node) {
220220 ((Node) parent).attachChild(armature);
@@ -229,9 +229,9 @@ public class ObjectHelper extends AbstractBlenderHelper {
229229 }
230230
231231 if (result != null) {
232- result.updateModelBound();// I prefer do compute bounding box here
233- // than read it from the file
234-
232+ // I prefer do compute bounding box here than read it from the file
233+ result.updateModelBound();
234+
235235 blenderContext.addLoadedFeatures(objectStructure.getOldMemoryAddress(), name, objectStructure, result);
236236 // TODO: this data is only to help during loading, shall I remove it
237237 // after all the loading is done ???
@@ -341,11 +341,8 @@ public class ObjectHelper extends AbstractBlenderHelper {
341341 public Matrix4f getMatrix(Structure structure, String matrixName, boolean applyFixUpAxis) {
342342 Matrix4f result = new Matrix4f();
343343 DynamicArray<Number> obmat = (DynamicArray<Number>) structure.getFieldValue(matrixName);
344- int rowAndColumnSize = Math.abs((int) Math.sqrt(obmat.getTotalSize()));// the
345- // matrix
346- // must
347- // be
348- // square
344+ //the matrix must be square
345+ int rowAndColumnSize = Math.abs((int) Math.sqrt(obmat.getTotalSize()));
349346 for (int i = 0; i < rowAndColumnSize; ++i) {
350347 for (int j = 0; j < rowAndColumnSize; ++j) {
351348 result.set(i, j, obmat.get(j, i).floatValue());
--- a/engine/src/blender/com/jme3/scene/plugins/blender/objects/Properties.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/objects/Properties.java
@@ -164,22 +164,6 @@ public class Properties implements Cloneable {
164164 }
165165
166166 /**
167- * This method returns the description of the property.
168- * @return the description of the property
169- */
170- public String getDescription() {
171- return description;
172- }
173-
174- /**
175- * This method returns the type of the property.
176- * @return the type of the property
177- */
178- public int getType() {
179- return type;
180- }
181-
182- /**
183167 * This method returns the value of the property.
184168 * The type of the value depends on the type of the property.
185169 * @return the value of the property
--- a/engine/src/blender/com/jme3/scene/plugins/blender/particles/ParticlesHelper.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/particles/ParticlesHelper.java
@@ -86,11 +86,11 @@ public class ParticlesHelper extends AbstractBlenderHelper {
8686 * different blender versions.
8787 * @param blenderVersion
8888 * the version read from the blend file
89- * @param fixUpAxis
90- * a variable that indicates if the Y asxis is the UP axis or not
89+ * @param blenderContext
90+ * the blender context
9191 */
92- public ParticlesHelper(String blenderVersion, boolean fixUpAxis) {
93- super(blenderVersion, fixUpAxis);
92+ public ParticlesHelper(String blenderVersion, BlenderContext blenderContext) {
93+ super(blenderVersion, blenderContext);
9494 }
9595
9696 @SuppressWarnings("unchecked")
--- a/engine/src/blender/com/jme3/scene/plugins/blender/textures/TextureHelper.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/textures/TextureHelper.java
@@ -99,7 +99,7 @@ public class TextureHelper extends AbstractBlenderHelper {
9999 public static final int TEX_VOXELDATA = 15; // v.
100100 // 25+
101101
102- private TextureGeneratorFactory textureGeneratorFactory;
102+ private TextureGeneratorFactory textureGeneratorFactory = new TextureGeneratorFactory();
103103
104104 /**
105105 * This constructor parses the given blender version and stores the result.
@@ -107,12 +107,11 @@ public class TextureHelper extends AbstractBlenderHelper {
107107 *
108108 * @param blenderVersion
109109 * the version read from the blend file
110- * @param fixUpAxis
111- * a variable that indicates if the Y asxis is the UP axis or not
110+ * @param blenderContext
111+ * the blender context
112112 */
113- public TextureHelper(String blenderVersion, boolean fixUpAxis) {
114- super(blenderVersion, false);
115- textureGeneratorFactory = new TextureGeneratorFactory(blenderVersion);
113+ public TextureHelper(String blenderVersion, BlenderContext blenderContext) {
114+ super(blenderVersion, blenderContext);
116115 }
117116
118117 /**
--- a/engine/src/blender/com/jme3/scene/plugins/blender/textures/blending/TextureBlenderAWT.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/textures/blending/TextureBlenderAWT.java
@@ -51,6 +51,7 @@ public class TextureBlenderAWT extends AbstractTextureBlender {
5151 super(flag, negateTexture, blendType, materialColor, color, blendFactor);
5252 }
5353
54+ @Override
5455 public Image blend(Image image, Image baseImage, BlenderContext blenderContext) {
5556 this.prepareImagesForBlending(image, baseImage);
5657
--- a/engine/src/blender/com/jme3/scene/plugins/blender/textures/generating/NoiseGenerator.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/textures/generating/NoiseGenerator.java
@@ -31,11 +31,6 @@
3131 */
3232 package com.jme3.scene.plugins.blender.textures.generating;
3333
34-import com.jme3.math.FastMath;
35-import com.jme3.scene.plugins.blender.AbstractBlenderHelper;
36-import com.jme3.scene.plugins.blender.BlenderContext;
37-import com.jme3.scene.plugins.blender.file.Structure;
38-import com.jme3.scene.plugins.blender.textures.generating.TextureGeneratorMusgrave.MusgraveData;
3934 import java.io.IOException;
4035 import java.io.InputStream;
4136 import java.io.ObjectInputStream;
@@ -44,14 +39,16 @@ import java.util.Map;
4439 import java.util.logging.Level;
4540 import java.util.logging.Logger;
4641
42+import com.jme3.math.FastMath;
43+import com.jme3.scene.plugins.blender.textures.generating.TextureGeneratorMusgrave.MusgraveData;
44+
4745 /**
4846 * This generator is responsible for creating various noises used to create
4947 * generated textures loaded from blender.
50- * It derives from AbstractBlenderHelper but is not stored in blender context.
5148 * It is only used by TextureHelper.
5249 * @author Marcin Roguski (Kaelthas)
5350 */
54-/* package */class NoiseGenerator extends AbstractBlenderHelper {
51+/* package */class NoiseGenerator {
5552 private static final Logger LOGGER = Logger.getLogger(NoiseGenerator.class.getName());
5653
5754 // tex->stype
@@ -79,21 +76,11 @@ import java.util.logging.Logger;
7976 protected static float[][] g;
8077
8178 /**
82- * Constructor. Stores the blender version number and loads the constants needed for computations.
83- * @param blenderVersion
84- * the number of blender version
79+ * Constructor. Loads the constants needed for computations. They are exactly like the ones the blender uses. Each
80+ * deriving class should override this method and load its own constraints.
8581 */
86- public NoiseGenerator(String blenderVersion) {
87- super(blenderVersion, false);
88- this.loadConstants();
89- }
90-
91- /**
92- * This method loads the constants needed for computations. They are exactly like the ones the blender uses. Each
93- * deriving class should override this method and load its own constraints. Be carefult with overriding though, if
94- * an exception will be thrown the class will not be instantiated.
95- */
96- protected void loadConstants() {
82+ public NoiseGenerator() {
83+ LOGGER.fine("Loading noise constants.");
9784 InputStream is = NoiseGenerator.class.getResourceAsStream("noiseconstants.dat");
9885 try {
9986 ObjectInputStream ois = new ObjectInputStream(is);
@@ -791,11 +778,6 @@ import java.util.logging.Logger;
791778 }
792779 }
793780
794- @Override
795- public boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext) {
796- return true;
797- }
798-
799781 /**
800782 * This interface is used for distance calculation classes. Distance metrics for voronoi. e parameter only used in
801783 * Minkovsky.
--- a/engine/src/blender/com/jme3/scene/plugins/blender/textures/generating/TextureGeneratorFactory.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/textures/generating/TextureGeneratorFactory.java
@@ -4,11 +4,7 @@ import com.jme3.scene.plugins.blender.textures.TextureHelper;
44
55 public class TextureGeneratorFactory {
66
7- private NoiseGenerator noiseGenerator;
8-
9- public TextureGeneratorFactory(String blenderVersion) {
10- noiseGenerator = new NoiseGenerator(blenderVersion);
11- }
7+ private NoiseGenerator noiseGenerator = new NoiseGenerator();
128
139 public TextureGenerator createTextureGenerator(int generatedTexture) {
1410 switch (generatedTexture) {