Package jme3utilities.debug
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
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
ConstructorsModifierConstructorDescriptionprotectedNo-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 TypeMethodDescriptionclone()Create a shallow copy of this Control.voidcloneFields(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 voidcontrolUpdate(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.ColorRGBAcopyHeadColor(int boneIndex, com.jme3.math.ColorRGBA storeResult) Copy the color for the head of the indexed Bone.com.jme3.math.ColorRGBAcopyLineColor(com.jme3.math.ColorRGBA storeResult) Copy the color for link lines.intCount the bones in the skeleton that's being visualized.floatheadSize()Read the size for bone heads (in pixels).floatRead the effective line width for links.voidread(com.jme3.export.JmeImporter importer) De-serialize this Control from the specified importer, for example when loading from a J3O file.voidsetColor(com.jme3.math.ColorRGBA newColor) Alter the colors of all link lines and bone heads.voidsetEnabled(boolean newState) Alter the visibility of the visualization.voidsetHeadColor(int boneIndex, com.jme3.math.ColorRGBA newColor) Alter the color of the indexed bone's head.voidsetHeadColor(com.jme3.math.ColorRGBA newColor) Alter the colors of all bone heads.voidsetHeadShape(com.jme3.texture.Texture shape) Alter the shape used to visualize bone heads.voidsetHeadSize(float size) Alter the size of bone heads.voidsetLineColor(com.jme3.math.ColorRGBA newColor) Alter the colors of all link lines.voidsetLineWidth(float width) Alter the effective line width for links.final voidsetSubject(com.jme3.scene.control.AbstractControl subject) Configure the Armature (or Skeleton) and transform spatial based on the specified Control.voidsetTransformSpatial(com.jme3.scene.Spatial spatial) Alter which Spatial provides the world transformvoidwrite(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, setSubtreeMethods inherited from class jme3utilities.SimpleControl
controlRender, isEnabled, toggleEnabledMethods inherited from class com.jme3.scene.control.AbstractControl
getSpatial, jmeClone, render, update
-
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:
clonein classSubtreeControl- Returns:
- a new Control, equivalent to this one
- Throws:
CloneNotSupportedException- if superclass isn't cloneable
-
cloneFields
Convert this shallow-cloned Control into a deep-cloned one, using the specified Cloner and original to resolve copied fields.- Specified by:
cloneFieldsin interfacecom.jme3.util.clone.JmeCloneable- Overrides:
cloneFieldsin classSubtreeControl- Parameters:
cloner- the Cloner currently cloning this Controloriginal- 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:
controlUpdatein classSimpleControl- Parameters:
updateInterval- time interval between updates (in seconds, ≥0)
-
read
De-serialize this Control from the specified importer, for example when loading from a J3O file.- Specified by:
readin interfacecom.jme3.export.Savable- Overrides:
readin classSubtreeControl- Parameters:
importer- (not null)- Throws:
IOException- from the importer
-
setEnabled
public void setEnabled(boolean newState) Alter the visibility of the visualization.- Overrides:
setEnabledin classSubtreeControl- Parameters:
newState- if true, reveal the visualization; if false, hide it
-
write
Serialize this Control to the specified exporter, for example when saving to a J3O file.- Specified by:
writein interfacecom.jme3.export.Savable- Overrides:
writein classSubtreeControl- Parameters:
exporter- (not null)- Throws:
IOException- from the exporter
-