Package com.jme3.scene.plugins.bvh
Class SkeletonMapping
- java.lang.Object
-
- com.jme3.scene.plugins.bvh.SkeletonMapping
-
- All Implemented Interfaces:
com.jme3.export.Savable,java.lang.Cloneable
public class SkeletonMapping extends java.lang.Object implements java.lang.Cloneable, com.jme3.export.SavableData used to map poses from one skeleton to another: a collection of bone mappings.
-
-
Constructor Summary
Constructors Constructor Description SkeletonMapping()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMapping(BoneMapping mapping)Add a bone mapping to this skeleton mapping.voidclear()Empty this skeleton mapping.SkeletonMappingclone()Create a deep copy of this mapping.intcountMappings()Count the number of bone mappings in this skeleton mapping.BoneMappingget(java.lang.String targetBoneName)Find the bone mapping for the named target bone.BoneMappinggetForSource(java.lang.String sourceBoneName)Find the bone mapping for the named source bone.SkeletonMappinginverse()Generate an inverse for this mapping.java.util.List<java.lang.String>listSourceBones()Enumerate all source bones in this mapping.java.util.List<java.lang.String>listTargetBones()Enumerate all target bones in this mapping.BoneMappingmap(java.lang.String targetBone, java.lang.String sourceBone)Builds a BoneMapping with the given bone from the target skeleton and the given bone from the source skeleton.BoneMappingmap(java.lang.String targetBone, java.lang.String sourceBone, float twistAngle, com.jme3.math.Vector3f twistAxis)Add a mapping from the named bone in the target skeleton to the named bone in the source skeleton, applying the specified twist.BoneMappingmap(java.lang.String targetName, java.lang.String sourceName, com.jme3.math.Quaternion twist)Add a mapping from the named bone in the target skeleton to the named bone in the source skeleton, applying the specified twist.voidread(com.jme3.export.JmeImporter im)De-serialize this mapping.voidremoveMapping(BoneMapping mapping)Remove a bone mapping from this skeleton mapping.voidrenameSourceBone(java.lang.String oldName, java.lang.String newName)Update this mapping after a source bone is renamed.voidrenameTargetBone(java.lang.String oldName, java.lang.String newName)Update this mapping after a target bone is renamed.voidwrite(com.jme3.export.JmeExporter ex)Serialize this instance.
-
-
-
Method Detail
-
addMapping
public void addMapping(BoneMapping mapping)
Add a bone mapping to this skeleton mapping.- Parameters:
mapping- bone mapping (not null)
-
clear
public void clear()
Empty this skeleton mapping.
-
countMappings
public int countMappings()
Count the number of bone mappings in this skeleton mapping.- Returns:
- count (≥0)
-
get
public BoneMapping get(java.lang.String targetBoneName)
Find the bone mapping for the named target bone.- Parameters:
targetBoneName- which target bone- Returns:
- the pre-existing instance, or null if none found
-
getForSource
public BoneMapping getForSource(java.lang.String sourceBoneName)
Find the bone mapping for the named source bone.- Parameters:
sourceBoneName- which source bone- Returns:
- the pre-existing instance, or null if none found
-
inverse
public SkeletonMapping inverse()
Generate an inverse for this mapping.- Returns:
- a new mapping
-
listSourceBones
public java.util.List<java.lang.String> listSourceBones()
Enumerate all source bones in this mapping.- Returns:
- a new list of names
-
listTargetBones
public java.util.List<java.lang.String> listTargetBones()
Enumerate all target bones in this mapping.- Returns:
- a new list of names
-
map
public BoneMapping map(java.lang.String targetBone, java.lang.String sourceBone)
Builds a BoneMapping with the given bone from the target skeleton and the given bone from the source skeleton.- Parameters:
targetBone- the name of the bone from the target skeleton.sourceBone- the name of the bone from the source skeleton.- Returns:
- a new instance
-
map
public BoneMapping map(java.lang.String targetName, java.lang.String sourceName, com.jme3.math.Quaternion twist)
Add a mapping from the named bone in the target skeleton to the named bone in the source skeleton, applying the specified twist.- Parameters:
targetName- name of bone in the target skeletonsourceName- name of bone in the source skeletontwist- twist rotation to apply to the animation data- Returns:
- a new instance
-
map
public BoneMapping map(java.lang.String targetBone, java.lang.String sourceBone, float twistAngle, com.jme3.math.Vector3f twistAxis)
Add a mapping from the named bone in the target skeleton to the named bone in the source skeleton, applying the specified twist.- Parameters:
targetBone- name of bone in the target skeletonsourceBone- name of bone in the source skeletontwistAngle- twist rotation angletwistAxis- twist rotation axis- Returns:
- a new instance
-
removeMapping
public void removeMapping(BoneMapping mapping)
Remove a bone mapping from this skeleton mapping.- Parameters:
mapping- bone mapping (not null)
-
renameSourceBone
public void renameSourceBone(java.lang.String oldName, java.lang.String newName)Update this mapping after a source bone is renamed.- Parameters:
oldName- old name of bonenewName- new name for bone
-
renameTargetBone
public void renameTargetBone(java.lang.String oldName, java.lang.String newName)Update this mapping after a target bone is renamed.- Parameters:
oldName- old name of bonenewName- new name for bone
-
clone
public SkeletonMapping clone() throws java.lang.CloneNotSupportedException
Create a deep copy of this mapping.- Overrides:
clonein classjava.lang.Object- Returns:
- a new mapping, equivalent to this one
- Throws:
java.lang.CloneNotSupportedException- if superclass isn't cloneable
-
read
public void read(com.jme3.export.JmeImporter im) throws java.io.IOExceptionDe-serialize this mapping.- Specified by:
readin interfacecom.jme3.export.Savable- Parameters:
im- importer to use (not null)- Throws:
java.io.IOException- from importer
-
write
public void write(com.jme3.export.JmeExporter ex) throws java.io.IOExceptionSerialize this instance.- Specified by:
writein interfacecom.jme3.export.Savable- Parameters:
ex- exporter to use (not null)- Throws:
java.io.IOException- from exporter
-
-