Class 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.Savable
    Data 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
      void addMapping​(BoneMapping mapping)
      Add a bone mapping to this skeleton mapping.
      void clear()
      Empty this skeleton mapping.
      SkeletonMapping clone()
      Create a deep copy of this mapping.
      int countMappings()
      Count the number of bone mappings in this skeleton mapping.
      BoneMapping get​(java.lang.String targetBoneName)
      Find the bone mapping for the named target bone.
      BoneMapping getForSource​(java.lang.String sourceBoneName)
      Find the bone mapping for the named source bone.
      SkeletonMapping inverse()
      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.
      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.
      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.
      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.
      void read​(com.jme3.export.JmeImporter im)
      De-serialize this mapping.
      void removeMapping​(BoneMapping mapping)
      Remove a bone mapping from this skeleton mapping.
      void renameSourceBone​(java.lang.String oldName, java.lang.String newName)
      Update this mapping after a source bone is renamed.
      void renameTargetBone​(java.lang.String oldName, java.lang.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 Detail

      • SkeletonMapping

        public SkeletonMapping()
    • 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 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​(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 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​(java.lang.String oldName,
                                     java.lang.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​(java.lang.String oldName,
                                     java.lang.String newName)
        Update this mapping after a target bone is renamed.
        Parameters:
        oldName - old name of bone
        newName - new name for bone
      • clone

        public SkeletonMapping clone()
                              throws java.lang.CloneNotSupportedException
        Create a deep copy of this mapping.
        Overrides:
        clone in class java.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.IOException
        De-serialize this mapping.
        Specified by:
        read in interface com.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.IOException
        Serialize this instance.
        Specified by:
        write in interface com.jme3.export.Savable
        Parameters:
        ex - exporter to use (not null)
        Throws:
        java.io.IOException - from exporter