Refactoring: unsupported (but known) constraint definitions are now represented by a single class instead of many classes that do nothing except logging a warning.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10403 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Kae..pl 12 years ago
parent 28ea9d8a0d
commit 4de3be91a9
  1. 26
      engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionAction.java
  2. 26
      engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionCameraSolver.java
  3. 26
      engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionChildOf.java
  4. 26
      engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionClampTo.java
  5. 26
      engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionDampTrack.java
  6. 55
      engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionFactory.java
  7. 26
      engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionFollowPath.java
  8. 26
      engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionFollowTrack.java
  9. 144
      engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionInverseKinematics.java
  10. 26
      engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionLockTrack.java
  11. 26
      engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionMinMax.java
  12. 26
      engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionObjectSolver.java
  13. 26
      engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionPivot.java
  14. 26
      engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionPython.java
  15. 26
      engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionRigidBodyJoint.java
  16. 27
      engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionSameVolume.java
  17. 61
      engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionShrinkWrap.java
  18. 26
      engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionSplineInverseKinematic.java
  19. 26
      engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionStretchTo.java
  20. 27
      engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionTrackTo.java
  21. 27
      engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionTransLike.java
  22. 26
      engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/ConstraintDefinitionTransform.java
  23. 28
      engine/src/blender/com/jme3/scene/plugins/blender/constraints/definitions/UnsupportedConstraintDefinition.java

@ -1,26 +0,0 @@
package com.jme3.scene.plugins.blender.constraints.definitions;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jme3.math.Transform;
import com.jme3.scene.plugins.blender.BlenderContext;
import com.jme3.scene.plugins.blender.file.Structure;
/**
* This class represents 'Action' constraint type in blender.
* @author Marcin Roguski (Kaelthas)
*/
/* package */class ConstraintDefinitionAction extends ConstraintDefinition {
private static final Logger LOGGER = Logger.getLogger(ConstraintDefinitionAction.class.getName());
public ConstraintDefinitionAction(Structure constraintData, BlenderContext blenderContext) {
super(constraintData, blenderContext);
}
@Override
public void bake(Transform ownerTransform, Transform targetTransform, float influence) {
// TODO: implement 'Action' constraint
LOGGER.log(Level.WARNING, "'Action' constraint NOT implemented!");
}
}

@ -1,26 +0,0 @@
package com.jme3.scene.plugins.blender.constraints.definitions;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jme3.math.Transform;
import com.jme3.scene.plugins.blender.BlenderContext;
import com.jme3.scene.plugins.blender.file.Structure;
/**
* This class represents 'Camera solver' constraint type in blender.
* @author Marcin Roguski (Kaelthas)
*/
/* package */class ConstraintDefinitionCameraSolver extends ConstraintDefinition {
private static final Logger LOGGER = Logger.getLogger(ConstraintDefinitionAction.class.getName());
public ConstraintDefinitionCameraSolver(Structure constraintData, BlenderContext blenderContext) {
super(constraintData, blenderContext);
}
@Override
public void bake(Transform ownerTransform, Transform targetTransform, float influence) {
// TODO: implement 'Camera solver' constraint
LOGGER.log(Level.WARNING, "'Camera solver' constraint NOT implemented!");
}
}

@ -1,26 +0,0 @@
package com.jme3.scene.plugins.blender.constraints.definitions;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jme3.math.Transform;
import com.jme3.scene.plugins.blender.BlenderContext;
import com.jme3.scene.plugins.blender.file.Structure;
/**
* This class represents 'ChildOf' constraint type in blender.
* @author Marcin Roguski (Kaelthas)
*/
/* package */class ConstraintDefinitionChildOf extends ConstraintDefinition {
private static final Logger LOGGER = Logger.getLogger(ConstraintDefinitionChildOf.class.getName());
public ConstraintDefinitionChildOf(Structure constraintData, BlenderContext blenderContext) {
super(constraintData, blenderContext);
}
@Override
public void bake(Transform ownerTransform, Transform targetTransform, float influence) {
// TODO: implement ChildOf constraint
LOGGER.log(Level.WARNING, "ChildOf constraint NOT implemented!");
}
}

@ -1,26 +0,0 @@
package com.jme3.scene.plugins.blender.constraints.definitions;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jme3.math.Transform;
import com.jme3.scene.plugins.blender.BlenderContext;
import com.jme3.scene.plugins.blender.file.Structure;
/**
* This class represents 'Clamp to' constraint type in blender.
* @author Marcin Roguski (Kaelthas)
*/
/* package */class ConstraintDefinitionClampTo extends ConstraintDefinition {
private static final Logger LOGGER = Logger.getLogger(ConstraintDefinitionClampTo.class.getName());
public ConstraintDefinitionClampTo(Structure constraintData, BlenderContext blenderContext) {
super(constraintData, blenderContext);
}
@Override
public void bake(Transform ownerTransform, Transform targetTransform, float influence) {
// TODO: implement when curves are implemented
LOGGER.log(Level.WARNING, "'Clamp to' not yet implemented!");
}
}

@ -1,26 +0,0 @@
package com.jme3.scene.plugins.blender.constraints.definitions;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jme3.math.Transform;
import com.jme3.scene.plugins.blender.BlenderContext;
import com.jme3.scene.plugins.blender.file.Structure;
/**
* The damp track constraint. Available for blender 2.50+.
* @author Marcin Roguski (Kaelthas)
*/
/* package */class ConstraintDefinitionDampTrack extends ConstraintDefinition {
private static final Logger LOGGER = Logger.getLogger(ConstraintDefinitionDampTrack.class.getName());
public ConstraintDefinitionDampTrack(Structure constraintData, BlenderContext blenderContext) {
super(constraintData, blenderContext);
}
@Override
public void bake(Transform ownerTransform, Transform targetTransform, float influence) {
// TODO Auto-generated method stub
LOGGER.log(Level.WARNING, "'Damp Track' constraint NOT implemented!");
}
}

@ -42,38 +42,42 @@ import com.jme3.scene.plugins.blender.file.Structure;
public class ConstraintDefinitionFactory {
private static final Map<String, Class<? extends ConstraintDefinition>> CONSTRAINT_CLASSES = new HashMap<String, Class<? extends ConstraintDefinition>>();
static {
CONSTRAINT_CLASSES.put("bActionConstraint", ConstraintDefinitionAction.class);
CONSTRAINT_CLASSES.put("bChildOfConstraint", ConstraintDefinitionChildOf.class);
CONSTRAINT_CLASSES.put("bClampToConstraint", ConstraintDefinitionClampTo.class);
CONSTRAINT_CLASSES.put("bDistLimitConstraint", ConstraintDefinitionDistLimit.class);
CONSTRAINT_CLASSES.put("bFollowPathConstraint", ConstraintDefinitionFollowPath.class);
CONSTRAINT_CLASSES.put("bKinematicConstraint", ConstraintDefinitionInverseKinematics.class);
CONSTRAINT_CLASSES.put("bLockTrackConstraint", ConstraintDefinitionLockTrack.class);
CONSTRAINT_CLASSES.put("bLocateLikeConstraint", ConstraintDefinitionLocLike.class);
CONSTRAINT_CLASSES.put("bLocLimitConstraint", ConstraintDefinitionLocLimit.class);
CONSTRAINT_CLASSES.put("bMinMaxConstraint", ConstraintDefinitionMinMax.class);
CONSTRAINT_CLASSES.put("bNullConstraint", ConstraintDefinitionNull.class);
CONSTRAINT_CLASSES.put("bPythonConstraint", ConstraintDefinitionPython.class);
CONSTRAINT_CLASSES.put("bRigidBodyJointConstraint", ConstraintDefinitionRigidBodyJoint.class);
CONSTRAINT_CLASSES.put("bRotateLikeConstraint", ConstraintDefinitionRotLike.class);
CONSTRAINT_CLASSES.put("bShrinkWrapConstraint", ConstraintDefinitionShrinkWrap.class);
CONSTRAINT_CLASSES.put("bRotLimitConstraint", ConstraintDefinitionRotLimit.class);
CONSTRAINT_CLASSES.put("bSizeLikeConstraint", ConstraintDefinitionSizeLike.class);
CONSTRAINT_CLASSES.put("bSizeLimitConstraint", ConstraintDefinitionSizeLimit.class);
CONSTRAINT_CLASSES.put("bStretchToConstraint", ConstraintDefinitionStretchTo.class);
CONSTRAINT_CLASSES.put("bTransformConstraint", ConstraintDefinitionTransform.class);
CONSTRAINT_CLASSES.put("bRotLimitConstraint", ConstraintDefinitionRotLimit.class);
}
private static final Map<String, String> UNSUPPORTED_CONSTRAINTS = new HashMap<String, String>();
static {
UNSUPPORTED_CONSTRAINTS.put("bActionConstraint", "Action");
UNSUPPORTED_CONSTRAINTS.put("bChildOfConstraint", "Child of");
UNSUPPORTED_CONSTRAINTS.put("bClampToConstraint", "Clamp to");
UNSUPPORTED_CONSTRAINTS.put("bFollowPathConstraint", "Follow path");
UNSUPPORTED_CONSTRAINTS.put("bKinematicConstraint", "Inverse kinematic");
UNSUPPORTED_CONSTRAINTS.put("bLockTrackConstraint", "Lock track");
UNSUPPORTED_CONSTRAINTS.put("bMinMaxConstraint", "Min max");
UNSUPPORTED_CONSTRAINTS.put("bPythonConstraint", "Python/Script");
UNSUPPORTED_CONSTRAINTS.put("bRigidBodyJointConstraint", "Rigid body joint");
UNSUPPORTED_CONSTRAINTS.put("bShrinkWrapConstraint", "Shrinkwrap");
UNSUPPORTED_CONSTRAINTS.put("bStretchToConstraint", "Stretch to");
UNSUPPORTED_CONSTRAINTS.put("bTransformConstraint", "Transform");
// Blender 2.50+
CONSTRAINT_CLASSES.put("bSplineIKConstraint", ConstraintDefinitionSplineInverseKinematic.class);
CONSTRAINT_CLASSES.put("bDampTrackConstraint", ConstraintDefinitionDampTrack.class);
CONSTRAINT_CLASSES.put("bPivotConstraint", ConstraintDefinitionDampTrack.class);
UNSUPPORTED_CONSTRAINTS.put("bSplineIKConstraint", "Spline inverse kinematics");
UNSUPPORTED_CONSTRAINTS.put("bDampTrackConstraint", "Damp track");
UNSUPPORTED_CONSTRAINTS.put("bPivotConstraint", "Pivot");
// Blender 2.56+
CONSTRAINT_CLASSES.put("bTrackToConstraint", ConstraintDefinitionTrackTo.class);
CONSTRAINT_CLASSES.put("bSameVolumeConstraint", ConstraintDefinitionSameVolume.class);
CONSTRAINT_CLASSES.put("bTransLikeConstraint", ConstraintDefinitionTransLike.class);
UNSUPPORTED_CONSTRAINTS.put("bTrackToConstraint", "Track to");
UNSUPPORTED_CONSTRAINTS.put("bSameVolumeConstraint", "Same volume");
UNSUPPORTED_CONSTRAINTS.put("bTransLikeConstraint", "Trans like");
// Blender 2.62+
CONSTRAINT_CLASSES.put("bCameraSolverConstraint", ConstraintDefinitionCameraSolver.class);
CONSTRAINT_CLASSES.put("bObjectSolverConstraint", ConstraintDefinitionObjectSolver.class);
CONSTRAINT_CLASSES.put("bFollowTrackConstraint", ConstraintDefinitionFollowTrack.class);
UNSUPPORTED_CONSTRAINTS.put("bCameraSolverConstraint", "Camera solver");
UNSUPPORTED_CONSTRAINTS.put("bObjectSolverConstraint", "Object solver");
UNSUPPORTED_CONSTRAINTS.put("bFollowTrackConstraint", "Follow track");
}
/**
@ -108,7 +112,12 @@ public class ConstraintDefinitionFactory {
throw new BlenderFileException(e.getLocalizedMessage(), e);
}
} else {
throw new BlenderFileException("Unknown constraint type: " + constraintClassName);
String constraintName = UNSUPPORTED_CONSTRAINTS.get(constraintClassName);
if(constraintName != null) {
return new UnsupportedConstraintDefinition(constraintName);
} else {
throw new BlenderFileException("Unknown constraint type: " + constraintClassName);
}
}
}
}

@ -1,26 +0,0 @@
package com.jme3.scene.plugins.blender.constraints.definitions;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jme3.math.Transform;
import com.jme3.scene.plugins.blender.BlenderContext;
import com.jme3.scene.plugins.blender.file.Structure;
/**
* This class represents 'Follow path' constraint type in blender.
* @author Marcin Roguski (Kaelthas)
*/
/* package */class ConstraintDefinitionFollowPath extends ConstraintDefinition {
private static final Logger LOGGER = Logger.getLogger(ConstraintDefinitionFollowPath.class.getName());
public ConstraintDefinitionFollowPath(Structure constraintData, BlenderContext blenderContext) {
super(constraintData, blenderContext);
}
@Override
public void bake(Transform ownerTransform, Transform targetTransform, float influence) {
// TODO: implement when curves are implemented
LOGGER.log(Level.WARNING, "'Follow path' not implemented! Curves not yet implemented!");
}
}

@ -1,26 +0,0 @@
package com.jme3.scene.plugins.blender.constraints.definitions;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jme3.math.Transform;
import com.jme3.scene.plugins.blender.BlenderContext;
import com.jme3.scene.plugins.blender.file.Structure;
/**
* This class represents 'Follow track' constraint type in blender.
* @author Marcin Roguski (Kaelthas)
*/
/* package */class ConstraintDefinitionFollowTrack extends ConstraintDefinition {
private static final Logger LOGGER = Logger.getLogger(ConstraintDefinitionAction.class.getName());
public ConstraintDefinitionFollowTrack(Structure constraintData, BlenderContext blenderContext) {
super(constraintData, blenderContext);
}
@Override
public void bake(Transform ownerTransform, Transform targetTransform, float influence) {
// TODO: implement 'Follow track' constraint
LOGGER.log(Level.WARNING, "'Follow track' constraint NOT implemented!");
}
}

@ -1,144 +0,0 @@
package com.jme3.scene.plugins.blender.constraints.definitions;
import com.jme3.animation.Animation;
import com.jme3.animation.Skeleton;
import com.jme3.math.Transform;
import com.jme3.scene.plugins.blender.BlenderContext;
import com.jme3.scene.plugins.blender.animations.CalculationBone;
import com.jme3.scene.plugins.blender.file.Structure;
/**
* This class represents 'Inverse kinematics' constraint type in blender.
* @author Marcin Roguski (Kaelthas)
*/
/* package */class ConstraintDefinitionInverseKinematics extends ConstraintDefinition {
// private static final Logger LOGGER = Logger.getLogger(ConstraintDefinitionInverseKinematics.class.getName());
// private static final float IK_SOLVER_ERROR = 0.5f;
public ConstraintDefinitionInverseKinematics(Structure constraintData, BlenderContext blenderContext) {
super(constraintData, blenderContext);
}
@Override
public void bake(Transform ownerTransform, Transform targetTransform, float influence) {
// try {
// IK solver is only attached to bones
// Bone ownerBone = (Bone) blenderContext.getLoadedFeature(ownerOMA, LoadedFeatureDataType.LOADED_FEATURE);
// AnimData animData = blenderContext.getAnimData(ownerOMA);
// if(animData == null) {
// TODO: to nie moxe byx null, utworzyx dane bez ruchu, w zalexnoxci czy target six rusza
// }
// prepare a list of all parents of this bone
// CalculationBone[] bones = this.getBonesToCalculate(skeleton, boneAnimation);
// get the target point
// Object targetObject = this.getTarget(LoadedFeatureDataType.LOADED_FEATURE);
// Vector3f pt = null;// Point Target
// if (targetObject instanceof Bone) {
// pt = ((Bone) targetObject).getModelSpacePosition();
// } else if (targetObject instanceof Spatial) {
// pt = ((Spatial) targetObject).getWorldTranslation();
// } else if (targetObject instanceof Skeleton) {
// Structure armatureNodeStructure = (Structure) this.getTarget(LoadedFeatureDataType.LOADED_STRUCTURE);
// ObjectHelper objectHelper = blenderContext.getHelper(ObjectHelper.class);
// Transform transform = objectHelper.getTransformation(armatureNodeStructure, blenderContext);
// pt = transform.getTranslation();
// } else {
// throw new IllegalStateException(
// "Unknown target object type! Should be Node, Bone or Skeleton and there is: "
// + targetObject.getClass().getName());
// }
// fetching the owner's bone track
// BoneTrack ownerBoneTrack = null;
// int boneIndex = skeleton.getBoneIndex(ownerBone);
// for (int i = 0; i < boneAnimation.getTracks().length; ++i) {
// if (boneAnimation.getTracks()[i].getTargetBoneIndex() == boneIndex) {
// ownerBoneTrack = boneAnimation.getTracks()[i];
// break;
// }
// }
// int ownerBoneFramesCount = ownerBoneTrack==null ? 0 : ownerBoneTrack.getTimes().length;
//
// // preparing data
// int maxIterations = ((Number) data.getFieldValue("iterations")).intValue();
// CalculationBone[] bones = this.getBonesToCalculate(ownerBone, skeleton, boneAnimation);
// for (int i = 0; i < bones.length; ++i) {
// System.out.println(Arrays.toString(bones[i].track.getTranslations()));
// System.out.println(Arrays.toString(bones[i].track.getRotations()));
// System.out.println("===============================");
// }
// Quaternion rotation = new Quaternion();
// //all tracks should have the same amount of frames
// int framesCount = bones[0].getBoneFramesCount();
// assert framesCount >=1;
// for (int frame = 0; frame < framesCount; ++frame) {
// float error = IK_SOLVER_ERROR;
// int iteration = 0;
// while (error >= IK_SOLVER_ERROR && iteration <= maxIterations) {
// // rotating the bones
// for (int i = 0; i < bones.length - 1; ++i) {
// Vector3f pe = bones[i].getEndPoint();
// Vector3f pc = bones[i + 1].getWorldTranslation().clone();
//
// Vector3f peSUBpc = pe.subtract(pc).normalizeLocal();
// Vector3f ptSUBpc = pt.subtract(pc).normalizeLocal();
//
// float theta = FastMath.acos(peSUBpc.dot(ptSUBpc));
// Vector3f direction = peSUBpc.cross(ptSUBpc).normalizeLocal();
// bones[i].rotate(rotation.fromAngleAxis(theta, direction), frame);
// }
// error = pt.subtract(bones[0].getEndPoint()).length();
// ++iteration;
// }
// }
//
// for (CalculationBone bone : bones) {
// bone.applyCalculatedTracks();
// }
//
// System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
// for (int i = 0; i < bones.length; ++i) {
// System.out.println(Arrays.toString(bones[i].track.getTranslations()));
// System.out.println(Arrays.toString(bones[i].track.getRotations()));
// System.out.println("===============================");
// }
// } catch(BlenderFileException e) {
// LOGGER.severe(e.getLocalizedMessage());
// }
}
/**
* This method returns bones used for rotation calculations.
* @param bone
* the bone to which the constraint is applied
* @param skeleton
* the skeleton owning the bone and its ancestors
* @param boneAnimation
* the bone animation data that stores the traces for the skeleton's bones
* @return a list of bones to imitate the bone's movement during IK solving
*/
private CalculationBone[] getBonesToCalculate(Skeleton skeleton, Animation boneAnimation) {
// Bone ownerBone = (Bone) blenderContext.getLoadedFeature(ownerOMA, LoadedFeatureDataType.LOADED_FEATURE);
// List<CalculationBone> bonesList = new ArrayList<CalculationBone>();
// do {
// bonesList.add(new CalculationBone(ownerBone, 1));
// int boneIndex = skeleton.getBoneIndex(ownerBone);
// for (int i = 0; i < boneAnimation.getTracks().length; ++i) {
// if (((BoneTrack[])boneAnimation.getTracks())[i].getTargetBoneIndex() == boneIndex) {
// bonesList.add(new CalculationBone(ownerBone, (BoneTrack)boneAnimation.getTracks()[i]));
// break;
// }
// }
// ownerBone = ownerBone.getParent();
// } while (ownerBone != null);
// //attaching children
// CalculationBone[] result = bonesList.toArray(new CalculationBone[bonesList.size()]);
// for (int i = result.length - 1; i > 0; --i) {
// result[i].attachChild(result[i - 1]);
// }
// return result;
return null;
}
}

@ -1,26 +0,0 @@
package com.jme3.scene.plugins.blender.constraints.definitions;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jme3.math.Transform;
import com.jme3.scene.plugins.blender.BlenderContext;
import com.jme3.scene.plugins.blender.file.Structure;
/**
* This class represents 'Action' constraint type in blender.
* @author Marcin Roguski (Kaelthas)
*/
/* package */class ConstraintDefinitionLockTrack extends ConstraintDefinition {
private static final Logger LOGGER = Logger.getLogger(ConstraintDefinitionLockTrack.class.getName());
public ConstraintDefinitionLockTrack(Structure constraintData, BlenderContext blenderContext) {
super(constraintData, blenderContext);
}
@Override
public void bake(Transform ownerTransform, Transform targetTransform, float influence) {
// TODO: implement 'Lock track' constraint
LOGGER.log(Level.WARNING, "'Lock track' constraint NOT implemented!");
}
}

@ -1,26 +0,0 @@
package com.jme3.scene.plugins.blender.constraints.definitions;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jme3.math.Transform;
import com.jme3.scene.plugins.blender.BlenderContext;
import com.jme3.scene.plugins.blender.file.Structure;
/**
* This class represents 'Min max' constraint type in blender.
* @author Marcin Roguski (Kaelthas)
*/
/* package */class ConstraintDefinitionMinMax extends ConstraintDefinition {
private static final Logger LOGGER = Logger.getLogger(ConstraintDefinitionMinMax.class.getName());
public ConstraintDefinitionMinMax(Structure constraintData, BlenderContext blenderContext) {
super(constraintData, blenderContext);
}
@Override
public void bake(Transform ownerTransform, Transform targetTransform, float influence) {
// TODO: implement 'Min max' constraint
LOGGER.log(Level.WARNING, "'Min max' constraint NOT implemented!");
}
}

@ -1,26 +0,0 @@
package com.jme3.scene.plugins.blender.constraints.definitions;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jme3.math.Transform;
import com.jme3.scene.plugins.blender.BlenderContext;
import com.jme3.scene.plugins.blender.file.Structure;
/**
* This class represents 'Object solver' constraint type in blender.
* @author Marcin Roguski (Kaelthas)
*/
/* package */class ConstraintDefinitionObjectSolver extends ConstraintDefinition {
private static final Logger LOGGER = Logger.getLogger(ConstraintDefinitionAction.class.getName());
public ConstraintDefinitionObjectSolver(Structure constraintData, BlenderContext blenderContext) {
super(constraintData, blenderContext);
}
@Override
public void bake(Transform ownerTransform, Transform targetTransform, float influence) {
// TODO: implement 'Object solver' constraint
LOGGER.log(Level.WARNING, "'Object solver' constraint NOT implemented!");
}
}

@ -1,26 +0,0 @@
package com.jme3.scene.plugins.blender.constraints.definitions;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jme3.math.Transform;
import com.jme3.scene.plugins.blender.BlenderContext;
import com.jme3.scene.plugins.blender.file.Structure;
/**
* The pivot constraint. Available for blender 2.50+.
* @author Marcin Roguski (Kaelthas)
*/
/* package */class ConstraintDefinitionPivot extends ConstraintDefinition {
private static final Logger LOGGER = Logger.getLogger(ConstraintDefinitionPivot.class.getName());
public ConstraintDefinitionPivot(Structure constraintData, BlenderContext blenderContext) {
super(constraintData, blenderContext);
}
@Override
public void bake(Transform ownerTransform, Transform targetTransform, float influence) {
// TODO: implement 'Pivot' constraint
LOGGER.log(Level.WARNING, "'Pivot' constraint NOT implemented!");
}
}

@ -1,26 +0,0 @@
package com.jme3.scene.plugins.blender.constraints.definitions;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jme3.math.Transform;
import com.jme3.scene.plugins.blender.BlenderContext;
import com.jme3.scene.plugins.blender.file.Structure;
/**
* This class represents 'Python' constraint type in blender.
* @author Marcin Roguski (Kaelthas)
*/
/* package */class ConstraintDefinitionPython extends ConstraintDefinition {
private static final Logger LOGGER = Logger.getLogger(ConstraintDefinitionPython.class.getName());
public ConstraintDefinitionPython(Structure constraintData, BlenderContext blenderContext) {
super(constraintData, blenderContext);
}
@Override
public void bake(Transform ownerTransform, Transform targetTransform, float influence) {
// TODO: implement 'Python' constraint
LOGGER.log(Level.WARNING, "'Python' constraint NOT implemented!");
}
}

@ -1,26 +0,0 @@
package com.jme3.scene.plugins.blender.constraints.definitions;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jme3.math.Transform;
import com.jme3.scene.plugins.blender.BlenderContext;
import com.jme3.scene.plugins.blender.file.Structure;
/**
* This class represents 'Rigid body joint' constraint type in blender.
* @author Marcin Roguski (Kaelthas)
*/
/* package */class ConstraintDefinitionRigidBodyJoint extends ConstraintDefinition {
private static final Logger LOGGER = Logger.getLogger(ConstraintDefinitionRigidBodyJoint.class.getName());
public ConstraintDefinitionRigidBodyJoint(Structure constraintData, BlenderContext blenderContext) {
super(constraintData, blenderContext);
}
@Override
public void bake(Transform ownerTransform, Transform targetTransform, float influence) {
// TODO: implement 'Rigid body joint' constraint
LOGGER.log(Level.WARNING, "'Rigid body joint' constraint NOT implemented!");
}
}

@ -1,27 +0,0 @@
package com.jme3.scene.plugins.blender.constraints.definitions;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jme3.math.Transform;
import com.jme3.scene.plugins.blender.BlenderContext;
import com.jme3.scene.plugins.blender.file.Structure;
/**
* This class represents 'Same volume' constraint type in blender.
*
* @author Marcin Roguski (Kaelthas)
*/
/* package */class ConstraintDefinitionSameVolume extends ConstraintDefinition {
private static final Logger LOGGER = Logger.getLogger(ConstraintDefinitionSameVolume.class.getName());
public ConstraintDefinitionSameVolume(Structure constraintData, BlenderContext blenderContext) {
super(constraintData, blenderContext);
}
@Override
public void bake(Transform ownerTransform, Transform targetTransform, float influence) {
// TODO: implement 'Same volume' constraint
LOGGER.log(Level.WARNING, "'Same volume' constraint NOT implemented!");
}
}

@ -1,61 +0,0 @@
package com.jme3.scene.plugins.blender.constraints.definitions;
import com.jme3.math.Transform;
import com.jme3.scene.plugins.blender.BlenderContext;
import com.jme3.scene.plugins.blender.file.Structure;
/**
* This class represents 'Shrink wrap' constraint type in blender.
* @author Marcin Roguski (Kaelthas)
*/
/* package */class ConstraintDefinitionShrinkWrap extends ConstraintDefinition {
public ConstraintDefinitionShrinkWrap(Structure constraintData, BlenderContext blenderContext) {
super(constraintData, blenderContext);
}
@Override
public void bake(Transform ownerTransform, Transform targetTransform, float influence) {
// loading mesh points (blender ensures that the target is a mesh-object)
/*
* List<Vector3f> pts = new ArrayList<Vector3f>();
* Node target = (Node) this.target.getObject();
* for(Spatial spatial : target.getChildren()) {
* if(spatial instanceof Geometry) {
* Mesh mesh = ((Geometry) spatial).getMesh();
* FloatBuffer floatBuffer = mesh.getFloatBuffer(Type.Position);
* for(int i=0;i<floatBuffer.limit();i+=3) {
* pts.add(new Vector3f(floatBuffer.get(i), floatBuffer.get(i + 1), floatBuffer.get(i + 2)));
* }
* }
* }
* AnimData animData = blenderContext.getAnimData(this.owner.getOma());
* if(animData != null) {
* Object owner = this.owner.getObject();
* for(Animation animation : animData.anims) {
* BlenderTrack track = this.getTrack(owner, animData.skeleton, animation);
* Vector3f[] translations = track.getTranslations();
* Quaternion[] rotations = track.getRotations();
* int maxFrames = translations.length;
* for (int frame = 0; frame < maxFrames; ++frame) {
* Vector3f currentTranslation = translations[frame];
* //looking for minimum distanced point
* Vector3f minDistancePoint = null;
* float distance = Float.MAX_VALUE;
* for(Vector3f p : pts) {
* float temp = currentTranslation.distance(p);
* if(temp < distance) {
* distance = temp;
* minDistancePoint = p;
* }
* }
* translations[frame] = minDistancePoint.clone();
* }
* track.setKeyframes(track.getTimes(), translations, rotations, track.getScales());
* }
* }
*/
// TODO: static constraint for spatials
}
}

@ -1,26 +0,0 @@
package com.jme3.scene.plugins.blender.constraints.definitions;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jme3.math.Transform;
import com.jme3.scene.plugins.blender.BlenderContext;
import com.jme3.scene.plugins.blender.file.Structure;
/**
* The spline inverse kinematic constraint. Available for blender 2.50+.
* @author Marcin Roguski (Kaelthas)
*/
/* package */class ConstraintDefinitionSplineInverseKinematic extends ConstraintDefinition {
private static final Logger LOGGER = Logger.getLogger(ConstraintDefinitionSplineInverseKinematic.class.getName());
public ConstraintDefinitionSplineInverseKinematic(Structure constraintData, BlenderContext blenderContext) {
super(constraintData, blenderContext);
}
@Override
public void bake(Transform ownerTransform, Transform targetTransform, float influence) {
// TODO Auto-generated method stub
LOGGER.log(Level.WARNING, "'Splie IK' constraint NOT implemented!");
}
}

@ -1,26 +0,0 @@
package com.jme3.scene.plugins.blender.constraints.definitions;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jme3.math.Transform;
import com.jme3.scene.plugins.blender.BlenderContext;
import com.jme3.scene.plugins.blender.file.Structure;
/**
* This class represents 'Stretch to' constraint type in blender.
* @author Marcin Roguski (Kaelthas)
*/
/* package */class ConstraintDefinitionStretchTo extends ConstraintDefinition {
private static final Logger LOGGER = Logger.getLogger(ConstraintDefinitionStretchTo.class.getName());
public ConstraintDefinitionStretchTo(Structure constraintData, BlenderContext blenderContext) {
super(constraintData, blenderContext);
}
@Override
public void bake(Transform ownerTransform, Transform targetTransform, float influence) {
// TODO: implement 'Stretch to' constraint
LOGGER.log(Level.WARNING, "'Stretch to' constraint NOT implemented!");
}
}

@ -1,27 +0,0 @@
package com.jme3.scene.plugins.blender.constraints.definitions;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jme3.math.Transform;
import com.jme3.scene.plugins.blender.BlenderContext;
import com.jme3.scene.plugins.blender.file.Structure;
/**
* This class represents 'Track to' constraint type in blender.
*
* @author Marcin Roguski (Kaelthas)
*/
/* package */class ConstraintDefinitionTrackTo extends ConstraintDefinition {
private static final Logger LOGGER = Logger.getLogger(ConstraintDefinitionTrackTo.class.getName());
public ConstraintDefinitionTrackTo(Structure constraintData, BlenderContext blenderContext) {
super(constraintData, blenderContext);
}
@Override
public void bake(Transform ownerTransform, Transform targetTransform, float influence) {
// TODO: implement 'Track to' constraint
LOGGER.log(Level.WARNING, "'Track to' constraint NOT implemented!");
}
}

@ -1,27 +0,0 @@
package com.jme3.scene.plugins.blender.constraints.definitions;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jme3.math.Transform;
import com.jme3.scene.plugins.blender.BlenderContext;
import com.jme3.scene.plugins.blender.file.Structure;
/**
* This class represents 'Trans like' constraint type in blender.
*
* @author Marcin Roguski (Kaelthas)
*/
/* package */class ConstraintDefinitionTransLike extends ConstraintDefinition {
private static final Logger LOGGER = Logger.getLogger(ConstraintDefinitionTransLike.class.getName());
public ConstraintDefinitionTransLike(Structure constraintData, BlenderContext blenderContext) {
super(constraintData, blenderContext);
}
@Override
public void bake(Transform ownerTransform, Transform targetTransform, float influence) {
// TODO: implement 'Trans like' constraint
LOGGER.log(Level.WARNING, "'Trans like' constraint NOT implemented!");
}
}

@ -1,26 +0,0 @@
package com.jme3.scene.plugins.blender.constraints.definitions;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jme3.math.Transform;
import com.jme3.scene.plugins.blender.BlenderContext;
import com.jme3.scene.plugins.blender.file.Structure;
/**
* This class represents 'Transform' constraint type in blender.
* @author Marcin Roguski (Kaelthas)
*/
/* package */class ConstraintDefinitionTransform extends ConstraintDefinition {
private static final Logger LOGGER = Logger.getLogger(ConstraintDefinitionAction.class.getName());
public ConstraintDefinitionTransform(Structure constraintData, BlenderContext blenderContext) {
super(constraintData, blenderContext);
}
@Override
public void bake(Transform ownerTransform, Transform targetTransform, float influence) {
// TODO: implement 'Transform' constraint
LOGGER.log(Level.WARNING, "'Transform' constraint NOT implemented!");
}
}

@ -0,0 +1,28 @@
package com.jme3.scene.plugins.blender.constraints.definitions;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jme3.math.Transform;
/**
* This class represents a constraint that is defined by blender but not supported by either importer
* ot jme. It only wirtes down a warning when baking is called.
*
* @author Marcin Roguski (Kaelthas)
*/
/* package */ class UnsupportedConstraintDefinition extends ConstraintDefinition {
private static final Logger LOGGER = Logger.getLogger(UnsupportedConstraintDefinition.class.getName());
private String name;
public UnsupportedConstraintDefinition(String name) {
super(null, null);
this.name = name;
}
@Override
protected void bake(Transform ownerTransform, Transform targetTransform, float influence) {
LOGGER.log(Level.WARNING, "'{0}' constraint NOT implemented!", name);
}
}
Loading…
Cancel
Save