Class SkeletonMapping

java.lang.Object
com.jme3.scene.plugins.bvh.SkeletonMapping
All Implemented Interfaces:
com.jme3.export.Savable, Cloneable

public class SkeletonMapping extends Object implements Cloneable, com.jme3.export.Savable
Data used to map poses from one skeleton to another: a collection of bone mappings.
  • Constructor Summary

    Constructors
    Constructor
    Description
    A no-arg constructor to avoid javadoc warnings from JDK 18.
    SkeletonMapping(com.jme3.anim.Armature armature)
    Construct a one-to-one mapping for the specified Armature.
    SkeletonMapping(com.jme3.animation.Skeleton skeleton)
    Construct a one-to-one mapping for the specified Skeleton.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add a bone mapping to this skeleton mapping.
    void
    Empty this skeleton mapping.
    Create a deep copy of this mapping.
    int
    Count the number of bone mappings in this skeleton mapping.
    get(String targetBoneName)
    Find the bone mapping for the named target bone.
    getForSource(String sourceBoneName)
    Find the bone mapping for the named source bone.
    Generate an inverse for this mapping.
    Enumerate all source bones in this mapping.
    Enumerate all target bones in this mapping.
    map(String targetBone, String sourceBone)
    Builds a BoneMapping with the given bone from the target skeleton and the given bone from the source skeleton.
    map(String targetBone, 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.
    map(String targetName, 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.
    void
    read(com.jme3.export.JmeImporter im)
    De-serialize this mapping.
    void
    Remove a bone mapping from this skeleton mapping.
    void
    renameSourceBone(String oldName, String newName)
    Update this mapping after a source bone is renamed.
    void
    renameTargetBone(String oldName, String newName)
    Update this mapping after a target bone is renamed.
    void
    write(com.jme3.export.JmeExporter ex)
    Serialize this instance.

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SkeletonMapping

      public SkeletonMapping()
      A no-arg constructor to avoid javadoc warnings from JDK 18.
    • SkeletonMapping

      public SkeletonMapping(com.jme3.anim.Armature armature)
      Construct a one-to-one mapping for the specified Armature.
      Parameters:
      armature - the Armature to provide the joint names (not null, unaffected)
    • SkeletonMapping

      public SkeletonMapping(com.jme3.animation.Skeleton skeleton)
      Construct a one-to-one mapping for the specified Skeleton.
      Parameters:
      skeleton - the Skeleton to provide the bone names (not null, unaffected)
  • Method Details

    • 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(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(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 List<String> listSourceBones()
      Enumerate all source bones in this mapping.
      Returns:
      a new list of names
    • listTargetBones

      public List<String> listTargetBones()
      Enumerate all target bones in this mapping.
      Returns:
      a new list of names
    • map

      public BoneMapping map(String targetBone, 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(String targetName, 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 skeleton
      sourceName - name of bone in the source skeleton
      twist - twist rotation to apply to the animation data
      Returns:
      a new instance
    • map

      public BoneMapping map(String targetBone, 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 skeleton
      sourceBone - name of bone in the source skeleton
      twistAngle - twist rotation angle
      twistAxis - 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(String oldName, String newName)
      Update this mapping after a source bone is renamed.
      Parameters:
      oldName - old name of bone
      newName - new name for bone
    • renameTargetBone

      public void renameTargetBone(String oldName, String newName)
      Update this mapping after a target bone is renamed.
      Parameters:
      oldName - old name of bone
      newName - new name for bone
    • clone

      Create a deep copy of this mapping.
      Overrides:
      clone in class Object
      Returns:
      a new mapping, equivalent to this one
      Throws:
      CloneNotSupportedException - if superclass isn't cloneable
    • read

      public void read(com.jme3.export.JmeImporter im) throws IOException
      De-serialize this mapping.
      Specified by:
      read in interface com.jme3.export.Savable
      Parameters:
      im - importer to use (not null)
      Throws:
      IOException - from importer
    • write

      public void write(com.jme3.export.JmeExporter ex) throws IOException
      Serialize this instance.
      Specified by:
      write in interface com.jme3.export.Savable
      Parameters:
      ex - exporter to use (not null)
      Throws:
      IOException - from exporter