Support for object animation constraints loading.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7684 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Kae..pl 14 years ago
parent 542559738d
commit 697a02e7c5
  1. 1346
      engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/ConstraintHelper.java
  2. 10
      engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/ModifierHelper.java
  3. 2
      engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/ObjectHelper.java
  4. 2
      engine/src/blender/com/jme3/scene/plugins/blender/structures/AbstractInfluenceFunction.java
  5. BIN
      engine/src/test-data/Blender/2.4x/constraints.blend

@ -663,16 +663,14 @@ public class ModifierHelper extends AbstractBlenderHelper {
Vector3f[] translations = new Vector3f[tablesLength];
Quaternion[] rotations = new Quaternion[tablesLength];
Vector3f[] scales = sourceScales == null ? null : new Vector3f[tablesLength];
Vector3f[] scales = new Vector3f[tablesLength];
for (int j = 0; j < tablesLength; ++j) {
translations[j] = sourceTranslations[j].clone();
rotations[j] = sourceRotations[j].clone();
if (sourceScales != null) {// only scales may not be applied
scales[j] = sourceScales[j].clone();
}
scales[j] = sourceScales != null ? sourceScales[j].clone() : new Vector3f(1.0f, 1.0f, 1.0f);
}
boneTracks[i] = new BoneTrack(sourceTracks[i].getTargetBoneIndex(), sourceTracks[i].getTimes(),// times do not change, no need
// to clone them,
// times do not change, no need to clone them
boneTracks[i] = new BoneTrack(sourceTracks[i].getTargetBoneIndex(), sourceTracks[i].getTimes(),
translations, rotations, scales);
}
result.setTracks(boneTracks);

@ -403,7 +403,7 @@ public class ObjectHelper extends AbstractBlenderHelper {
Bone bone = new Bone(null);
bone.setBindTransforms(t.getTranslation(), t.getRotation(), t.getScale());
return new Modifier(Modifier.ARMATURE_MODIFIER_DATA, new AnimData(new Skeleton(new Bone[] {bone}), animations), null);
return new Modifier(Modifier.ARMATURE_MODIFIER_DATA, new AnimData(new Skeleton(new Bone[] {bone}), animations), objectStructure.getOldMemoryAddress());
}
return null;
}

@ -117,7 +117,7 @@ public abstract class AbstractInfluenceFunction {
protected BoneTrack getBoneTrack(Skeleton skeleton, BoneAnimation boneAnimation, Constraint constraint) {
Long boneOMA = constraint.getBoneOMA();
Bone bone = (Bone) dataRepository.getLoadedFeature(boneOMA, LoadedFeatureDataType.LOADED_FEATURE);
int boneIndex = skeleton.getBoneIndex(bone);
int boneIndex = bone==null ? 0 : skeleton.getBoneIndex(bone);//bone==null may mean the object animation
if (boneIndex != -1) {
//searching for track for this bone
for (BoneTrack boneTrack : boneAnimation.getTracks()) {

Loading…
Cancel
Save