Bugfix: fixed NullPointerExceptions and IndexOutOfBoundExceptions in

Inverse Kinematics and several other constraints.
experimental
jmekaelthas 10 years ago
parent 64b3be5334
commit 40c942ff66
  1. 3
      jme3-blender/src/main/java/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionDistLimit.java
  2. 5
      jme3-blender/src/main/java/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionIK.java
  3. 3
      jme3-blender/src/main/java/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionLocLike.java
  4. 3
      jme3-blender/src/main/java/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionRotLike.java
  5. 3
      jme3-blender/src/main/java/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionSizeLike.java
  6. 3
      jme3-blender/src/main/java/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionTransLike.java

@ -34,6 +34,9 @@ import com.jme3.scene.plugins.blender.file.Structure;
// distance limit does not work on bones who are connected to their parent
return;
}
if(influence == 0 || targetTransform == null) {
return ;// no need to do anything
}
Transform ownerTransform = this.getOwnerTransform(ownerSpace);

@ -53,12 +53,15 @@ public class ConstraintDefinitionIK extends ConstraintDefinition {
@Override
public void bake(Space ownerSpace, Space targetSpace, Transform targetTransform, float influence) {
if (influence == 0 || !needToCompute) {
if (influence == 0 || !needToCompute || targetTransform == null) {
return;// no need to do anything
}
Quaternion q = new Quaternion();
Vector3f t = targetTransform.getTranslation();
List<BoneContext> bones = this.loadBones();
if(bones.size() == 0) {
return;// no need to do anything
}
float distanceFromTarget = Float.MAX_VALUE;
int iterations = this.iterations;

@ -49,6 +49,9 @@ import com.jme3.scene.plugins.blender.file.Structure;
// location copy does not work on bones who are connected to their parent
return;
}
if(influence == 0 || targetTransform == null) {
return ;// no need to do anything
}
Transform ownerTransform = this.getOwnerTransform(ownerSpace);

@ -29,6 +29,9 @@ import com.jme3.scene.plugins.blender.file.Structure;
@Override
public void bake(Space ownerSpace, Space targetSpace, Transform targetTransform, float influence) {
if(influence == 0 || targetTransform == null) {
return ;// no need to do anything
}
Transform ownerTransform = this.getOwnerTransform(ownerSpace);
Quaternion ownerRotation = ownerTransform.getRotation();

@ -32,6 +32,9 @@ import com.jme3.scene.plugins.blender.file.Structure;
@Override
public void bake(Space ownerSpace, Space targetSpace, Transform targetTransform, float influence) {
if(influence == 0 || targetTransform == null) {
return;// no need to do anything
}
Transform ownerTransform = this.getOwnerTransform(ownerSpace);
Vector3f ownerScale = ownerTransform.getScale();

@ -35,6 +35,9 @@ public class ConstraintDefinitionTransLike extends ConstraintDefinition {
@Override
public void bake(Space ownerSpace, Space targetSpace, Transform targetTransform, float influence) {
if(influence == 0 || targetTransform == null) {
return ;// no need to do anything
}
Object target = this.getTarget();// Bone or Node
Object owner = this.getOwner();// Bone or Node
if (!target.getClass().equals(owner.getClass())) {

Loading…
Cancel
Save