Package com.jme3.scene.debug.custom
Class ArmatureDebugAppState
java.lang.Object
com.jme3.app.state.BaseAppState
com.jme3.scene.debug.custom.ArmatureDebugAppState
- All Implemented Interfaces:
AppState
A debug application state for visualizing and interacting with JME3 armatures (skeletons).
This state allows users to see the joints of an armature, select individual joints
by clicking on them, and view their local and model transforms.
It also provides a toggle to display non-deforming joints.
This debug state operates on its own `ViewPort` and `debugNode` to prevent interference with the main scene's rendering.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final float
The maximum delay for a mouse click to be registered as a single click. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddArmatureFrom
(Armature armature, Spatial sp) Adds an ArmatureDebugger for a specific Armature, associating it with a Spatial.addArmatureFrom
(SkinningControl skControl) Adds an ArmatureDebugger for the armature associated with a given SkinningControl.void
addSelectionListener
(Consumer<Joint> listener) Adds a listener that will be notified when a joint is selected.protected void
cleanup
(Application app) Called after the app state is detached or during application shutdown if the state is still attached.void
Clears all registered selection listeners.protected void
initialize
(Application app) Called during initialization once the app state is attached and before onEnable() is called.boolean
Returns whether logging of detailed joint information to `System.err` is currently enabled.boolean
Checks if the armature debug gizmos are set to always render on top of other scene geometry.protected void
Called when the state was previously enabled but is now disabled either because setEnabled(false) was called or the state is being cleaned up.protected void
onEnable()
Called when the state is fully enabled, ie: is attached and isEnabled() is true or when the setEnabled() status changes after the state is attached.void
removeSelectionListener
(Consumer<Joint> listener) Removes a previously added selection listener.void
render
(RenderManager rm) Render the state.void
setJointInfoLoggingEnabled
(boolean enableJointInfoLogging) Sets whether logging of detailed joint information to `System.err` should be enabled.void
setShowOnTop
(boolean showOnTop) Sets whether armature debug gizmos should always render on top of other scene geometry.void
update
(float tpf) Called to update theAppState
.Methods inherited from class com.jme3.app.state.BaseAppState
cleanup, getApplication, getId, getState, getState, getState, getState, getStateManager, initialize, isEnabled, isInitialized, postRender, setEnabled, setId, stateAttached, stateDetached
-
Field Details
-
CLICK_MAX_DELAY
public static final float CLICK_MAX_DELAYThe maximum delay for a mouse click to be registered as a single click.- See Also:
-
-
Constructor Details
-
ArmatureDebugAppState
public ArmatureDebugAppState()
-
-
Method Details
-
initialize
Description copied from class:BaseAppState
Called during initialization once the app state is attached and before onEnable() is called.- Specified by:
initialize
in classBaseAppState
- Parameters:
app
- the application
-
cleanup
Description copied from class:BaseAppState
Called after the app state is detached or during application shutdown if the state is still attached. onDisable() is called before this cleanup() method if the state is enabled at the time of cleanup.- Specified by:
cleanup
in classBaseAppState
- Parameters:
app
- the application
-
onEnable
protected void onEnable()Description copied from class:BaseAppState
Called when the state is fully enabled, ie: is attached and isEnabled() is true or when the setEnabled() status changes after the state is attached.- Specified by:
onEnable
in classBaseAppState
-
onDisable
protected void onDisable()Description copied from class:BaseAppState
Called when the state was previously enabled but is now disabled either because setEnabled(false) was called or the state is being cleaned up.- Specified by:
onDisable
in classBaseAppState
-
update
public void update(float tpf) Description copied from interface:AppState
Called to update theAppState
. This method will be called every render pass if theAppState
is both attached and enabled.- Specified by:
update
in interfaceAppState
- Overrides:
update
in classBaseAppState
- Parameters:
tpf
- Time since the last call to update(), in seconds.
-
render
Description copied from interface:AppState
Render the state. This method will be called every render pass if theAppState
is both attached and enabled.- Specified by:
render
in interfaceAppState
- Overrides:
render
in classBaseAppState
- Parameters:
rm
- RenderManager
-
addArmatureFrom
Adds an ArmatureDebugger for the armature associated with a given SkinningControl.- Parameters:
skControl
- The SkinningControl whose armature needs to be debugged.- Returns:
- The newly created or existing ArmatureDebugger for the given armature.
-
addArmatureFrom
Adds an ArmatureDebugger for a specific Armature, associating it with a Spatial. If an ArmatureDebugger for this armature already exists, it is returned. Otherwise, a new ArmatureDebugger is created, initialized, and attached to the debug node.- Parameters:
armature
- The Armature to debug.sp
- The Spatial associated with this armature (used for determining world transform and deforming joints).- Returns:
- The newly created or existing ArmatureDebugger for the given armature.
-
addSelectionListener
Adds a listener that will be notified when a joint is selected.- Parameters:
listener
- TheConsumer<Joint>
listener to add.
-
removeSelectionListener
Removes a previously added selection listener.- Parameters:
listener
- TheConsumer<Joint>
listener to remove.
-
clearSelectionListeners
public void clearSelectionListeners()Clears all registered selection listeners. -
isShowOnTop
public boolean isShowOnTop()Checks if the armature debug gizmos are set to always render on top of other scene geometry.- Returns:
- true if gizmos always render on top, false otherwise.
-
setShowOnTop
public void setShowOnTop(boolean showOnTop) Sets whether armature debug gizmos should always render on top of other scene geometry.- Parameters:
showOnTop
- true to always show gizmos on top, false to respect depth.
-
isJointInfoLoggingEnabled
public boolean isJointInfoLoggingEnabled()Returns whether logging of detailed joint information to `System.err` is currently enabled.- Returns:
- true if logging is enabled, false otherwise.
-
setJointInfoLoggingEnabled
public void setJointInfoLoggingEnabled(boolean enableJointInfoLogging) Sets whether logging of detailed joint information to `System.err` should be enabled.- Parameters:
enableJointInfoLogging
- true to enable logging, false to disable.
-