feat: Improve ArmatureDebugAppState #2491
Open
+340
−112
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here’s a summary of the main differences between the original ArmatureDebugAppState.java file and the proposed modified version, focusing on new features, refactoring, and improvements:
1. Expanded Documentation & Comments
2. Refined Imports
com.jme3.anim.*
,com.jme3.input.controls.*
,java.util.*
, etc.) are replaced with explicit imports for only the required classes.3. Field and Property Changes
Logger logger
,selectionListeners
, andenableJointInfoLogging
.displayAllJoints
is renamed todisplayNonDeformingJoints
for clarity.app
,tmp
, andtmp2
are removed, and their functionality is refactored to use local variables or utility classes.4. Input Handling Refactor
registerInput()
andunregisterInput()
methods.PICK_JOINT
,TOGGLE_JOINTS
), reducing the risk of typos and improving maintainability.5. Viewport and Debug Node Initialization
showOnTop
property is introduced, allowing the debug view to optionally render on top of other scene geometry.6. ArmatureDebugger Management
findGeoms
→collectGeometries
).7. Selection Listener Mechanism
addSelectionListener
,removeSelectionListener
,notifySelectionListeners
,clearSelectionListeners
).8. Improved Joint Selection and Logging
Ray
projected from the screen point, encapsulated in a helper method (screenPointToRay
).9. General Code Clean-Up & Encapsulation
private
andfinal
modifiers for encapsulation and immutability.JointInfoVisitor
) are improved and better documented.10. Additional Utility Methods
isShowOnTop
,setShowOnTop
, and joint info logging toggles).In summary:
The modified version introduces improved documentation, refines and clarifies internal logic and state management, enhances input and selection handling, supports extensibility via listeners, and overall moves the code toward better maintainability, robustness, and clarity without fundamentally changing the external behavior of the class.