Skip to content

Allow partial/separate resets for feet and fingers #1441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Erimelowo
Copy link
Member

@Erimelowo Erimelowo commented May 21, 2025

This adds an array on every reset used to specify which trackers should be reset.
If the array is empty, the server will decide which trackers will be reset (all except fingers and feet during mounting basically).
This deprecates the feet reset feature since I believe it is much better to keep it a separate mounting reset.
This is also backwards compatible.

Needs SlimeVR/SolarXR-Protocol#173

@github-actions github-actions bot added Area: Skeletal Model Deals with the model of the skeleton and its pose Area: Application Protocol Related to communication with apps like the GUI, overlay, games Area: GUI Related to the GUI Area: Translation Improvements or additions to translations Area: Server Related to the server labels May 21, 2025
Comment on lines 139 to 231
fun isThigh(trackerPosition: TrackerPosition?): Boolean {
trackerPosition?.let {
return it == TrackerPosition.LEFT_UPPER_LEG ||
it == TrackerPosition.RIGHT_UPPER_LEG
}
return false
}

fun isLeftArm(trackerPosition: TrackerPosition?): Boolean {
trackerPosition?.let {
return it == TrackerPosition.LEFT_SHOULDER ||
it == TrackerPosition.LEFT_UPPER_ARM ||
it == TrackerPosition.LEFT_LOWER_ARM ||
it == TrackerPosition.LEFT_HAND
}
return false
}

fun isRightArm(trackerPosition: TrackerPosition?): Boolean {
trackerPosition?.let {
return it == TrackerPosition.RIGHT_SHOULDER ||
it == TrackerPosition.RIGHT_UPPER_ARM ||
it == TrackerPosition.RIGHT_LOWER_ARM ||
it == TrackerPosition.RIGHT_HAND
}
return false
}

fun isLeftLowerArm(trackerPosition: TrackerPosition?): Boolean {
trackerPosition?.let {
return it == TrackerPosition.LEFT_LOWER_ARM ||
it == TrackerPosition.LEFT_HAND
}
return false
}

fun isRightLowerArm(trackerPosition: TrackerPosition?): Boolean {
trackerPosition?.let {
return it == TrackerPosition.RIGHT_LOWER_ARM ||
it == TrackerPosition.RIGHT_HAND
}
return false
}

fun isFoot(trackerPosition: TrackerPosition?): Boolean {
trackerPosition?.let {
return it == TrackerPosition.LEFT_FOOT ||
it == TrackerPosition.RIGHT_FOOT
}
return false
}

fun isLeftFinger(trackerPosition: TrackerPosition?): Boolean {
trackerPosition?.let {
return it == TrackerPosition.LEFT_THUMB_METACARPAL ||
it == TrackerPosition.LEFT_THUMB_PROXIMAL ||
it == TrackerPosition.LEFT_THUMB_DISTAL ||
it == TrackerPosition.LEFT_INDEX_PROXIMAL ||
it == TrackerPosition.LEFT_INDEX_INTERMEDIATE ||
it == TrackerPosition.LEFT_INDEX_DISTAL ||
it == TrackerPosition.LEFT_MIDDLE_PROXIMAL ||
it == TrackerPosition.LEFT_MIDDLE_INTERMEDIATE ||
it == TrackerPosition.LEFT_MIDDLE_DISTAL ||
it == TrackerPosition.LEFT_RING_PROXIMAL ||
it == TrackerPosition.LEFT_RING_INTERMEDIATE ||
it == TrackerPosition.LEFT_RING_DISTAL ||
it == TrackerPosition.LEFT_LITTLE_PROXIMAL ||
it == TrackerPosition.LEFT_LITTLE_INTERMEDIATE ||
it == TrackerPosition.LEFT_LITTLE_DISTAL
}
return false
}

fun isRightFinger(trackerPosition: TrackerPosition?): Boolean {
trackerPosition?.let {
return it == TrackerPosition.RIGHT_THUMB_METACARPAL ||
it == TrackerPosition.RIGHT_THUMB_PROXIMAL ||
it == TrackerPosition.RIGHT_THUMB_DISTAL ||
it == TrackerPosition.RIGHT_INDEX_PROXIMAL ||
it == TrackerPosition.RIGHT_INDEX_INTERMEDIATE ||
it == TrackerPosition.RIGHT_INDEX_DISTAL ||
it == TrackerPosition.RIGHT_MIDDLE_PROXIMAL ||
it == TrackerPosition.RIGHT_MIDDLE_INTERMEDIATE ||
it == TrackerPosition.RIGHT_MIDDLE_DISTAL ||
it == TrackerPosition.RIGHT_RING_PROXIMAL ||
it == TrackerPosition.RIGHT_RING_INTERMEDIATE ||
it == TrackerPosition.RIGHT_RING_DISTAL ||
it == TrackerPosition.RIGHT_LITTLE_PROXIMAL ||
it == TrackerPosition.RIGHT_LITTLE_INTERMEDIATE ||
it == TrackerPosition.RIGHT_LITTLE_DISTAL
}
return false
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this should be a member function on the enum?
ofc it wont be usable with null object but it will be much easier to read

TrackerPosition.isLeftArm(tracker.trackerPosition)
// or
tracker.trackerPosition != null && 
(tracker.trackerPosition.isLeftArm() || tracker.trackerPosition.isLeftFinger()) 

or if you dont want to check for null, just make it an extension function

fun TrackerPosition?.isLeftArm(): boolean {
  this?.let {
    return true
  }
  return false
}

tracker.trackerPosition.isLeftArm()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done with extension functions in 2a6870e

@Erimelowo Erimelowo requested a review from ImUrX June 9, 2025 21:26
@ImUrX ImUrX added the Type: Enhancement Adds or improves a feature label Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Application Protocol Related to communication with apps like the GUI, overlay, games Area: GUI Related to the GUI Area: Server Related to the server Area: Skeletal Model Deals with the model of the skeleton and its pose Area: Translation Improvements or additions to translations Type: Enhancement Adds or improves a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants