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-0572b91ccdca3.0
parent
28ea9d8a0d
commit
4de3be91a9
@ -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!"); |
||||
} |
||||
} |
@ -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…
Reference in new issue