@@ -91,13 +91,13 @@ public class ArmatureDebugAppState extends BaseAppState {
9191 private Node debugNode = new Node ("debugNode" );
9292 private final Map <Armature , ArmatureDebugger > armatures = new HashMap <>();
9393 private final List <Consumer <Joint >> selectionListeners = new ArrayList <>();
94- private boolean displayAllJoints = false ;
94+ private boolean displayNonDeformingJoints = false ;
9595 private float clickDelay = -1 ;
9696 private ViewPort vp ;
9797 private Camera cam ;
9898 private InputManager inputManager ;
9999 private boolean showOnTop = true ;
100- private boolean enableLogging = true ;
100+ private boolean enableJointInfoLogging = true ;
101101
102102 @ Override
103103 protected void initialize (Application app ) {
@@ -199,7 +199,7 @@ public ArmatureDebugger addArmatureFrom(Armature armature, Spatial sp) {
199199 debugger .setLocalTransform (sp .getWorldTransform ());
200200 if (sp instanceof Node ) {
201201 List <Geometry > geoms = new ArrayList <>();
202- findGeoms ((Node ) sp , geoms );
202+ collectGeometries ((Node ) sp , geoms );
203203 if (geoms .size () == 1 ) {
204204 debugger .setLocalTransform (geoms .get (0 ).getWorldTransform ());
205205 }
@@ -223,12 +223,18 @@ public ArmatureDebugger addArmatureFrom(Armature armature, Spatial sp) {
223223 * @param node The starting Node to search from.
224224 * @param geoms The list to which found Geometry instances will be added.
225225 */
226- private void findGeoms (Node node , List <Geometry > geoms ) {
226+ /**
227+ * Recursively finds all `Geometry` instances within a given `Node` and its children.
228+ *
229+ * @param node The starting `Node` to search from.
230+ * @param geometries The list to which found `Geometry` instances will be added.
231+ */
232+ private void collectGeometries (Node node , List <Geometry > geometries ) {
227233 for (Spatial s : node .getChildren ()) {
228234 if (s instanceof Geometry ) {
229- geoms .add ((Geometry ) s );
235+ geometries .add ((Geometry ) s );
230236 } else if (s instanceof Node ) {
231- findGeoms ((Node ) s , geoms );
237+ collectGeometries ((Node ) s , geometries );
232238 }
233239 }
234240 }
@@ -279,15 +285,15 @@ public void onAction(String name, boolean isPressed, float tpf) {
279285 }
280286 }
281287 else if (name .equals (TOGGLE_JOINTS ) && isPressed ) {
282- displayAllJoints = !displayAllJoints ;
288+ displayNonDeformingJoints = !displayNonDeformingJoints ;
283289 for (ArmatureDebugger ad : armatures .values ()) {
284- ad .displayNonDeformingJoint (displayAllJoints );
290+ ad .displayNonDeformingJoint (displayNonDeformingJoints );
285291 }
286292 }
287293 }
288294
289295 private void printJointInfo (Joint selectedjoint , ArmatureDebugger ad ) {
290- if (enableLogging ) {
296+ if (enableJointInfoLogging ) {
291297 System .err .println ("-----------------------" );
292298 System .err .println ("Selected Joint : " + selectedjoint .getName () + " in armature " + ad .getName ());
293299 System .err .println ("Root Bone : " + (selectedjoint .getParent () == null ));
@@ -305,14 +311,21 @@ private void printJointInfo(Joint selectedjoint, ArmatureDebugger ad) {
305311 }
306312 }
307313
308- private Ray screenPointToRay (Camera cam , Vector2f click2d ) {
314+ /**
315+ * Creates a `Ray` from a 2D screen point (e.g., mouse cursor position).
316+ *
317+ * @param cam The camera to use for ray projection.
318+ * @param screenPoint The 2D screen coordinates.
319+ * @return A `Ray` originating from the near plane and extending into the scene.
320+ */
321+ private Ray screenPointToRay (Camera cam , Vector2f screenPoint ) {
309322 TempVars vars = TempVars .get ();
310323 Vector3f nearPoint = vars .vect1 ;
311324 Vector3f farPoint = vars .vect2 ;
312325
313326 // Get the world coordinates for the near and far points
314- cam .getWorldCoordinates (click2d , 0 , nearPoint );
315- cam .getWorldCoordinates (click2d , 1 , farPoint );
327+ cam .getWorldCoordinates (screenPoint , 0 , nearPoint );
328+ cam .getWorldCoordinates (screenPoint , 1 , farPoint );
316329
317330 // Calculate direction and normalize
318331 Vector3f direction = farPoint .subtractLocal (nearPoint ).normalizeLocal ();
@@ -398,21 +411,21 @@ public void setShowOnTop(boolean showOnTop) {
398411 }
399412
400413 /**
401- * Returns whether logging of detailed joint information is currently enabled.
414+ * Returns whether logging of detailed joint information to `System.err` is currently enabled.
402415 *
403416 * @return true if logging is enabled, false otherwise.
404417 */
405- public boolean isEnableLogging () {
406- return enableLogging ;
418+ public boolean isJointInfoLoggingEnabled () {
419+ return enableJointInfoLogging ;
407420 }
408421
409422 /**
410- * Sets whether logging of detailed joint information should be enabled.
423+ * Sets whether logging of detailed joint information to `System.err` should be enabled.
411424 *
412- * @param enableLogging true to enable logging, false to disable.
425+ * @param enableJointInfoLogging true to enable logging, false to disable.
413426 */
414- public void setEnableLogging (boolean enableLogging ) {
415- this .enableLogging = enableLogging ;
427+ public void setJointInfoLoggingEnabled (boolean enableJointInfoLogging ) {
428+ this .enableJointInfoLogging = enableJointInfoLogging ;
416429 }
417430
418431 /**
@@ -438,13 +451,13 @@ public JointInfoVisitor(Armature armature) {
438451 * For each Geometry, it checks all joints in the associated armature
439452 * to see if they influence this mesh.
440453 *
441- * @param g The Geometry node being visited.
454+ * @param geo The Geometry node being visited.
442455 */
443456 @ Override
444- public void visit (Geometry g ) {
457+ public void visit (Geometry geo ) {
445458 for (Joint joint : armature .getJointList ()) {
446459 int index = armature .getJointIndex (joint );
447- if (g .getMesh ().isAnimatedByJoint (index )) {
460+ if (geo .getMesh ().isAnimatedByJoint (index )) {
448461 deformingJoints .add (joint );
449462 }
450463 }
0 commit comments