Class ArmatureDebugAppState

java.lang.Object
com.jme3.app.state.BaseAppState
com.jme3.scene.debug.custom.ArmatureDebugAppState
All Implemented Interfaces:
AppState

public class ArmatureDebugAppState extends BaseAppState
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 Details

    • CLICK_MAX_DELAY

      public static final float CLICK_MAX_DELAY
      The maximum delay for a mouse click to be registered as a single click.
      See Also:
  • Constructor Details

    • ArmatureDebugAppState

      public ArmatureDebugAppState()
  • Method Details

    • initialize

      protected void initialize(Application app)
      Description copied from class: BaseAppState
      Called during initialization once the app state is attached and before onEnable() is called.
      Specified by:
      initialize in class BaseAppState
      Parameters:
      app - the application
    • cleanup

      protected void cleanup(Application app)
      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 class BaseAppState
      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 class BaseAppState
    • 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 class BaseAppState
    • update

      public void update(float tpf)
      Description copied from interface: AppState
      Called to update the AppState. This method will be called every render pass if the AppState is both attached and enabled.
      Specified by:
      update in interface AppState
      Overrides:
      update in class BaseAppState
      Parameters:
      tpf - Time since the last call to update(), in seconds.
    • render

      public void render(RenderManager rm)
      Description copied from interface: AppState
      Render the state. This method will be called every render pass if the AppState is both attached and enabled.
      Specified by:
      render in interface AppState
      Overrides:
      render in class BaseAppState
      Parameters:
      rm - RenderManager
    • addArmatureFrom

      public ArmatureDebugger addArmatureFrom(SkinningControl skControl)
      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

      public ArmatureDebugger addArmatureFrom(Armature armature, Spatial sp)
      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

      public void addSelectionListener(Consumer<Joint> listener)
      Adds a listener that will be notified when a joint is selected.
      Parameters:
      listener - The Consumer<Joint> listener to add.
    • removeSelectionListener

      public void removeSelectionListener(Consumer<Joint> listener)
      Removes a previously added selection listener.
      Parameters:
      listener - The Consumer<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.