MVP for step mounting in gui

This commit is contained in:
loucass003 committed 2026-10-02 04:05:25 +02:00
1 parent 470e8c37c7
commit 0ef2a782a6
55 files changed
+1537 -839

No files matched your search

@@ -102,8 +102,8 @@ data class ResetsConfig(
val saveMountingReset: Boolean = false,
/** Reset a reliable reference's (HMD) attitude on full reset */
val resetReliableReferenceAttitude: Boolean = false,
/** How a mounting reset calibrates the trackers */
val mountingMethod: MountingMethod = MountingMethod.POSE,
/** How a mounting reset calibrates the trackers, UNKNOWN until the user has picked one */
val mountingMethod: MountingMethod = MountingMethod.UNKNOWN,
)
@Serializable
@@ -104,8 +104,8 @@ class ResetsManager(
*/
suspend fun scheduleReset(resetSourceName: String, resetType: ResetType, delay: Float = 0f, bodyParts: List<BodyPart>? = null) {
val method = settings.context.state.value.data.resetsConfig.mountingMethod.takeIf { resetType == ResetType.MOUNTING }
if (method == MountingMethod.MANUAL) {
AppLogger.resets.info("Ignoring mounting reset from $resetSourceName: the mounting method is manual")
if (method == MountingMethod.UNKNOWN || method == MountingMethod.MANUAL) {
AppLogger.resets.info("Ignoring mounting reset from $resetSourceName: the mounting method is $method")
return
}
val availability = availability(resetType)
@@ -23,6 +23,7 @@ private val CHECKLIST_STEP_ORDER: List<TrackingChecklistStepId> = listOf(
TrackingChecklistStepId.TRACKER_ERROR,
TrackingChecklistStepId.TRACKERS_REST_CALIBRATION,
TrackingChecklistStepId.FULL_RESET,
TrackingChecklistStepId.MOUNTING_METHOD,
TrackingChecklistStepId.MOUNTING_CALIBRATION,
TrackingChecklistStepId.FEET_MOUNTING_CALIBRATION,
TrackingChecklistStepId.UNASSIGNED_RELIABLE_REFERENCE,
@@ -356,7 +356,7 @@ class MountingCalibrationCheckBehaviour(
bodyPart !in ResetBodyParts.FINGERS &&
bodyPart !in ResetBodyParts.TOES
MountingMethod.MANUAL -> false
MountingMethod.MANUAL, MountingMethod.UNKNOWN -> false
}
override fun observe(receiver: TrackingChecklist) {
@@ -378,6 +378,29 @@ class MountingCalibrationCheckBehaviour(
}
}
class MountingMethodCheckBehaviour(
private val settings: Settings,
) : TrackingChecklistBehaviourType {
override fun observe(receiver: TrackingChecklist) {
settings.context.state.map { it.data.resetsConfig.mountingMethod != MountingMethod.UNKNOWN }
.distinctUntilChanged()
.onEach { picked ->
receiver.context.dispatch(
TrackingChecklistActions.UpdateStep(
TrackingChecklistStepId.MOUNTING_METHOD,
TrackingChecklistStep(
valid = picked,
enabled = !picked,
ignorable = false,
visibility = TrackingChecklistStepVisibility.WHEN_INVALID,
),
),
)
}
.launchIn(receiver.context.scope)
}
}
// The feet need their own pose mounting reset, unless the step mounting calibrates them or the
// pose mounting reset is forced to include them
class FeetMountingCalibrationCheckBehaviour(
@@ -32,6 +32,7 @@ class TrackingChecklist(
add(ReliableReferenceCheckBehaviour(trackerStates))
add(TrackerRestCheckBehaviour(trackerStates))
add(FullResetCheckBehaviour(trackerStates))
add(MountingMethodCheckBehaviour(appContext.config.settings))
add(MountingCalibrationCheckBehaviour(trackerStates, appContext.config.settings))
add(TrackerErrorCheckBehaviour(trackerStates))
add(SteamVRHandsCheckBehaviour(trackerStates, appContext.server, appContext.boneRouting))