Class SkeletonVisualizer

java.lang.Object
com.jme3.scene.control.AbstractControl
jme3utilities.SimpleControl
jme3utilities.SubtreeControl
jme3utilities.debug.SkeletonVisualizer
All Implemented Interfaces:
com.jme3.export.Savable, com.jme3.scene.control.Control, com.jme3.util.clone.JmeCloneable, Cloneable

public class SkeletonVisualizer extends SubtreeControl
A SubtreeControl to visualize a Skeleton.

The controlled spatial must be a Node.

A new Control is disabled by default. When enabled, it attaches 2 geometries to the subtree.

  • Field Summary

    Fields inherited from class com.jme3.scene.control.AbstractControl

    enabled, spatial
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    No-argument constructor needed by SavableClassUtil.
     
    SkeletonVisualizer(com.jme3.asset.AssetManager assetManager, com.jme3.scene.control.AbstractControl subject)
    Instantiate a disabled control.
  • Method Summary

    Modifier and Type
    Method
    Description
    Create a shallow copy of this Control.
    void
    cloneFields(com.jme3.util.clone.Cloner cloner, Object original)
    Convert this shallow-cloned Control into a deep-cloned one, using the specified Cloner and original to resolve copied fields.
    protected void
    controlUpdate(float updateInterval)
    Callback invoked when the controlled spatial's geometric state is about to be updated, once per frame while attached and enabled.
    com.jme3.math.ColorRGBA
    copyHeadColor(int boneIndex, com.jme3.math.ColorRGBA storeResult)
    Copy the color for the head of the indexed Bone.
    com.jme3.math.ColorRGBA
    copyLineColor(com.jme3.math.ColorRGBA storeResult)
    Copy the color for link lines.
    int
    Count the bones in the skeleton that's being visualized.
    float
    Read the size for bone heads (in pixels).
    float
    Read the effective line width for links.
    void
    read(com.jme3.export.JmeImporter importer)
    De-serialize this Control from the specified importer, for example when loading from a J3O file.
    void
    setColor(com.jme3.math.ColorRGBA newColor)
    Alter the colors of all link lines and bone heads.
    void
    setEnabled(boolean newState)
    Alter the visibility of the visualization.
    void
    setHeadColor(int boneIndex, com.jme3.math.ColorRGBA newColor)
    Alter the color of the indexed bone's head.
    void
    setHeadColor(com.jme3.math.ColorRGBA newColor)
    Alter the colors of all bone heads.
    void
    setHeadShape(com.jme3.texture.Texture shape)
    Alter the shape used to visualize bone heads.
    void
    setHeadSize(float size)
    Alter the size of bone heads.
    void
    setLineColor(com.jme3.math.ColorRGBA newColor)
    Alter the colors of all link lines.
    void
    setLineWidth(float width)
    Alter the effective line width for links.
    final void
    setSubject(com.jme3.scene.control.AbstractControl subject)
    Configure the Armature (or Skeleton) and transform spatial based on the specified Control.
    void
    setTransformSpatial(com.jme3.scene.Spatial spatial)
    Alter which Spatial provides the world transform
    void
    write(com.jme3.export.JmeExporter exporter)
    Serialize this Control to the specified exporter, for example when saving to a J3O file.

    Methods inherited from class jme3utilities.SubtreeControl

    cloneForSpatial, getSubtree, setSpatial, setSubtree

    Methods inherited from class jme3utilities.SimpleControl

    controlRender, isEnabled, toggleEnabled

    Methods inherited from class com.jme3.scene.control.AbstractControl

    getSpatial, jmeClone, render, update

    Methods inherited from class java.lang.Object

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

    • SkeletonVisualizer

      protected SkeletonVisualizer()
      No-argument constructor needed by SavableClassUtil.
    • SkeletonVisualizer

      public SkeletonVisualizer(com.jme3.asset.AssetManager assetManager, com.jme3.scene.control.AbstractControl subject)
      Instantiate a disabled control.
      Parameters:
      assetManager - for loading material definitions (not null)
      subject - the SkeletonControl or SkinningControl to visualize (may be null)
  • Method Details

    • copyHeadColor

      public com.jme3.math.ColorRGBA copyHeadColor(int boneIndex, com.jme3.math.ColorRGBA storeResult)
      Copy the color for the head of the indexed Bone.
      Parameters:
      boneIndex - which Bone (≥0)
      storeResult - storage for the result (modified if not null)
      Returns:
      the color (either storeResult or a new instance)
    • copyLineColor

      public com.jme3.math.ColorRGBA copyLineColor(com.jme3.math.ColorRGBA storeResult)
      Copy the color for link lines.
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      the color (either storeResult or a new instance)
    • countBones

      public int countBones()
      Count the bones in the skeleton that's being visualized.
      Returns:
      the count (≥0)
    • headSize

      public float headSize()
      Read the size for bone heads (in pixels).
      Returns:
      size (in pixels, ≥1)
    • lineWidth

      public float lineWidth()
      Read the effective line width for links.
      Returns:
      width (in pixels, ≥0)
    • setColor

      public void setColor(com.jme3.math.ColorRGBA newColor)
      Alter the colors of all link lines and bone heads.
      Parameters:
      newColor - (not null, unaffected)
    • setHeadColor

      public void setHeadColor(com.jme3.math.ColorRGBA newColor)
      Alter the colors of all bone heads.
      Parameters:
      newColor - (not null, unaffected)
    • setHeadColor

      public void setHeadColor(int boneIndex, com.jme3.math.ColorRGBA newColor)
      Alter the color of the indexed bone's head.
      Parameters:
      boneIndex - which bone (≥0)
      newColor - (not null, unaffected)
    • setHeadShape

      public void setHeadShape(com.jme3.texture.Texture shape)
      Alter the shape used to visualize bone heads.
      Parameters:
      shape - shape texture (not null, alias created)
    • setHeadSize

      public void setHeadSize(float size)
      Alter the size of bone heads.
      Parameters:
      size - (in pixels, ≥0, 0 → hide the heads)
    • setLineColor

      public void setLineColor(com.jme3.math.ColorRGBA newColor)
      Alter the colors of all link lines.
      Parameters:
      newColor - (not null, unaffected)
    • setLineWidth

      public void setLineWidth(float width)
      Alter the effective line width for links.
      Parameters:
      width - (in pixels, ≥0, values <1 hide the lines)
    • setSubject

      public final void setSubject(com.jme3.scene.control.AbstractControl subject)
      Configure the Armature (or Skeleton) and transform spatial based on the specified Control.
      Parameters:
      subject - the SkeletonControl or SkinningControl to analyze (may be null)
    • setTransformSpatial

      public void setTransformSpatial(com.jme3.scene.Spatial spatial)
      Alter which Spatial provides the world transform
      Parameters:
      spatial - which spatial to use (may be null, alias created)
    • clone

      Create a shallow copy of this Control.
      Overrides:
      clone in class SubtreeControl
      Returns:
      a new Control, equivalent to this one
      Throws:
      CloneNotSupportedException - if superclass isn't cloneable
    • cloneFields

      public void cloneFields(com.jme3.util.clone.Cloner cloner, Object original)
      Convert this shallow-cloned Control into a deep-cloned one, using the specified Cloner and original to resolve copied fields.
      Specified by:
      cloneFields in interface com.jme3.util.clone.JmeCloneable
      Overrides:
      cloneFields in class SubtreeControl
      Parameters:
      cloner - the Cloner currently cloning this Control
      original - the instance from which this Control was shallow-cloned
    • controlUpdate

      protected void controlUpdate(float updateInterval)
      Callback invoked when the controlled spatial's geometric state is about to be updated, once per frame while attached and enabled.
      Overrides:
      controlUpdate in class SimpleControl
      Parameters:
      updateInterval - time interval between updates (in seconds, ≥0)
    • read

      public void read(com.jme3.export.JmeImporter importer) throws IOException
      De-serialize this Control from the specified importer, for example when loading from a J3O file.
      Specified by:
      read in interface com.jme3.export.Savable
      Overrides:
      read in class SubtreeControl
      Parameters:
      importer - (not null)
      Throws:
      IOException - from the importer
    • setEnabled

      public void setEnabled(boolean newState)
      Alter the visibility of the visualization.
      Overrides:
      setEnabled in class SubtreeControl
      Parameters:
      newState - if true, reveal the visualization; if false, hide it
    • write

      public void write(com.jme3.export.JmeExporter exporter) throws IOException
      Serialize this Control to the specified exporter, for example when saving to a J3O file.
      Specified by:
      write in interface com.jme3.export.Savable
      Overrides:
      write in class SubtreeControl
      Parameters:
      exporter - (not null)
      Throws:
      IOException - from the exporter