com.jme3.scene.plugins.blender.animations
Class ArmatureHelper

java.lang.Object
  extended by com.jme3.scene.plugins.blender.AbstractBlenderHelper
      extended by com.jme3.scene.plugins.blender.animations.ArmatureHelper

public class ArmatureHelper
extends AbstractBlenderHelper

This class defines the methods to calculate certain aspects of animation and armature functionalities.


Field Summary
 
Fields inherited from class com.jme3.scene.plugins.blender.AbstractBlenderHelper
blenderVersion, fixUpAxis, upAxisRotationQuaternion
 
Constructor Summary
ArmatureHelper(java.lang.String blenderVersion, boolean fixUpAxis)
          This constructor parses the given blender version and stores the result.
 
Method Summary
 void buildBones(Structure boneStructure, Bone parent, java.util.List<Bone> result, Matrix4f arbt, java.util.Map<java.lang.Long,Structure> bonesPoseChannels, BlenderContext blenderContext)
          This method builds the object's bones structure.
 java.lang.Long getBoneOMA(Bone bone)
          This method returns the old memory address of a bone.
 java.util.Map<java.lang.Integer,java.lang.Integer> getGroupToBoneIndexMap(Structure defBaseStructure, Skeleton skeleton, BlenderContext blenderContext)
          This method returns a map where the key is the object's group index that is used by a bone and the key is the bone index in the armature.
 BoneTrack[] getTracks(Structure actionStructure, Skeleton skeleton, BlenderContext blenderContext)
          This method retuns the bone tracks for animation.
 boolean shouldBeLoaded(Structure structure, BlenderContext blenderContext)
          This method analyzes the given structure and the data contained within blender context and decides if the feature should be loaded.
 
Methods inherited from class com.jme3.scene.plugins.blender.AbstractBlenderHelper
applyProperties, clearState, isBlank, loadProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArmatureHelper

public ArmatureHelper(java.lang.String blenderVersion,
                      boolean fixUpAxis)
This constructor parses the given blender version and stores the result. Some functionalities may differ in different blender versions.

Parameters:
blenderVersion - the version read from the blend file
fixUpAxis - a variable that indicates if the Y asxis is the UP axis or not
Method Detail

buildBones

public void buildBones(Structure boneStructure,
                       Bone parent,
                       java.util.List<Bone> result,
                       Matrix4f arbt,
                       java.util.Map<java.lang.Long,Structure> bonesPoseChannels,
                       BlenderContext blenderContext)
                throws BlenderFileException
This method builds the object's bones structure.

Parameters:
boneStructure - the structure containing the bones' data
parent - the parent bone
result - the list where the newly created bone will be added
bonesPoseChannels - a map of bones poses channels
blenderContext - the blender context
Throws:
BlenderFileException - an exception is thrown when there is problem with the blender file

getBoneOMA

public java.lang.Long getBoneOMA(Bone bone)
This method returns the old memory address of a bone. If the bone does not exist in the blend file - zero is returned.

Parameters:
bone - the bone whose old memory address we seek
Returns:
the old memory address of the given bone

getGroupToBoneIndexMap

public java.util.Map<java.lang.Integer,java.lang.Integer> getGroupToBoneIndexMap(Structure defBaseStructure,
                                                                                 Skeleton skeleton,
                                                                                 BlenderContext blenderContext)
                                                                          throws BlenderFileException
This method returns a map where the key is the object's group index that is used by a bone and the key is the bone index in the armature.

Parameters:
defBaseStructure - a bPose structure of the object
Returns:
bone group-to-index map
Throws:
BlenderFileException - this exception is thrown when the blender file is somehow corrupted

shouldBeLoaded

public boolean shouldBeLoaded(Structure structure,
                              BlenderContext blenderContext)
Description copied from class: AbstractBlenderHelper
This method analyzes the given structure and the data contained within blender context and decides if the feature should be loaded.

Specified by:
shouldBeLoaded in class AbstractBlenderHelper
Parameters:
structure - structure to be analyzed
blenderContext - the blender context
Returns:
true if the feature should be loaded and false otherwise

getTracks

public BoneTrack[] getTracks(Structure actionStructure,
                             Skeleton skeleton,
                             BlenderContext blenderContext)
                      throws BlenderFileException
This method retuns the bone tracks for animation.

Parameters:
actionStructure - the structure containing the tracks
blenderContext - the blender context
Returns:
a list of tracks for the specified animation
Throws:
BlenderFileException - an exception is thrown when there are problems with the blend file