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 floatThe 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.voidaddSelectionListener(Consumer<Joint> listener) Adds a listener that will be notified when a joint is selected.protected voidcleanup(Application app) Called after the app state is detached or during application shutdown if the state is still attached.voidClears all registered selection listeners.protected voidinitialize(Application app) Called during initialization once the app state is attached and before onEnable() is called.booleanReturns whether logging of detailed joint information to `System.err` is currently enabled.booleanChecks if the armature debug gizmos are set to always render on top of other scene geometry.protected voidCalled when the state was previously enabled but is now disabled either because setEnabled(false) was called or the state is being cleaned up.protected voidonEnable()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.voidremoveSelectionListener(Consumer<Joint> listener) Removes a previously added selection listener.voidrender(RenderManager rm) Render the state.voidsetJointInfoLoggingEnabled(boolean enableJointInfoLogging) Sets whether logging of detailed joint information to `System.err` should be enabled.voidsetShowOnTop(boolean showOnTop) Sets whether armature debug gizmos should always render on top of other scene geometry.voidupdate(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:BaseAppStateCalled during initialization once the app state is attached and before onEnable() is called.- Specified by:
initializein classBaseAppState- Parameters:
app- the application
-
cleanup
Description copied from class:BaseAppStateCalled 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:
cleanupin classBaseAppState- Parameters:
app- the application
-
onEnable
protected void onEnable()Description copied from class:BaseAppStateCalled 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:
onEnablein classBaseAppState
-
onDisable
protected void onDisable()Description copied from class:BaseAppStateCalled 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:
onDisablein classBaseAppState
-
update
public void update(float tpf) Description copied from interface:AppStateCalled to update theAppState. This method will be called every render pass if theAppStateis both attached and enabled.- Specified by:
updatein interfaceAppState- Overrides:
updatein classBaseAppState- Parameters:
tpf- Time since the last call to update(), in seconds.
-
render
Description copied from interface:AppStateRender the state. This method will be called every render pass if theAppStateis both attached and enabled.- Specified by:
renderin interfaceAppState- Overrides:
renderin 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.
-