mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-26 20:06:28 -08:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb073bc095 | ||
|
|
436ce4e679 | ||
|
|
b016ecfb4f |
No files matched your search
@@ -12,7 +12,11 @@ import { parseStatusToLocale, useStatusContext } from '@/hooks/status-system';
|
|||||||
import { ClearMountingButton } from './ClearMountingButton';
|
import { ClearMountingButton } from './ClearMountingButton';
|
||||||
import { ToggleableSkeletonVisualizerWidget } from './widgets/SkeletonVisualizerWidget';
|
import { ToggleableSkeletonVisualizerWidget } from './widgets/SkeletonVisualizerWidget';
|
||||||
import { useAtomValue } from 'jotai';
|
import { useAtomValue } from 'jotai';
|
||||||
import { flatTrackersAtom } from '@/store/app-store';
|
import {
|
||||||
|
feetAssignedTrackers,
|
||||||
|
fingerAssignedTrackers,
|
||||||
|
flatTrackersAtom,
|
||||||
|
} from '@/store/app-store';
|
||||||
import { A } from './commons/A';
|
import { A } from './commons/A';
|
||||||
|
|
||||||
function UnprioritizedStatuses() {
|
function UnprioritizedStatuses() {
|
||||||
@@ -48,6 +52,8 @@ function UnprioritizedStatuses() {
|
|||||||
|
|
||||||
export function WidgetsComponent() {
|
export function WidgetsComponent() {
|
||||||
const { config } = useConfig();
|
const { config } = useConfig();
|
||||||
|
const hasFeetTrackers = useAtomValue(feetAssignedTrackers);
|
||||||
|
const hasFingerTrackers = useAtomValue(fingerAssignedTrackers);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -55,16 +61,20 @@ export function WidgetsComponent() {
|
|||||||
<ResetButton type={ResetType.Yaw} size="big"></ResetButton>
|
<ResetButton type={ResetType.Yaw} size="big"></ResetButton>
|
||||||
<ResetButton type={ResetType.Full} size="big"></ResetButton>
|
<ResetButton type={ResetType.Full} size="big"></ResetButton>
|
||||||
<ResetButton type={ResetType.Mounting} size="big"></ResetButton>
|
<ResetButton type={ResetType.Mounting} size="big"></ResetButton>
|
||||||
<ResetButton
|
{hasFeetTrackers && (
|
||||||
type={ResetType.Mounting}
|
<ResetButton
|
||||||
size="big"
|
type={ResetType.Mounting}
|
||||||
bodyPartsToReset="feet"
|
size="big"
|
||||||
></ResetButton>
|
bodyPartsToReset="feet"
|
||||||
<ResetButton
|
></ResetButton>
|
||||||
type={ResetType.Mounting}
|
)}
|
||||||
size="big"
|
{hasFingerTrackers && (
|
||||||
bodyPartsToReset="fingers"
|
<ResetButton
|
||||||
></ResetButton>
|
type={ResetType.Mounting}
|
||||||
|
size="big"
|
||||||
|
bodyPartsToReset="fingers"
|
||||||
|
></ResetButton>
|
||||||
|
)}
|
||||||
<ClearMountingButton></ClearMountingButton>
|
<ClearMountingButton></ClearMountingButton>
|
||||||
{(typeof __ANDROID__ === 'undefined' || !__ANDROID__?.isThere()) && (
|
{(typeof __ANDROID__ === 'undefined' || !__ANDROID__?.isThere()) && (
|
||||||
<BVHButton></BVHButton>
|
<BVHButton></BVHButton>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { useLocalization } from '@fluent/react';
|
import { useLocalization } from '@fluent/react';
|
||||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import {
|
import {
|
||||||
BodyPart,
|
|
||||||
ResetRequestT,
|
ResetRequestT,
|
||||||
ResetType,
|
ResetType,
|
||||||
RpcMessage,
|
RpcMessage,
|
||||||
@@ -25,6 +24,7 @@ import { useStatusContext } from '@/hooks/status-system';
|
|||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { FootIcon } from '@/components/commons/icon/FootIcon';
|
import { FootIcon } from '@/components/commons/icon/FootIcon';
|
||||||
import { FingersIcon } from '@/components/commons/icon/FingersIcon';
|
import { FingersIcon } from '@/components/commons/icon/FingersIcon';
|
||||||
|
import { FEET_BODY_PARTS, FINGER_BODY_PARTS } from '@/store/app-store';
|
||||||
|
|
||||||
export function ResetButton({
|
export function ResetButton({
|
||||||
type,
|
type,
|
||||||
@@ -55,40 +55,6 @@ export function ResetButton({
|
|||||||
[statuses]
|
[statuses]
|
||||||
);
|
);
|
||||||
|
|
||||||
const feetBodyParts = [BodyPart.LEFT_FOOT, BodyPart.RIGHT_FOOT];
|
|
||||||
const fingerBodyParts = [
|
|
||||||
BodyPart.LEFT_THUMB_METACARPAL,
|
|
||||||
BodyPart.LEFT_THUMB_PROXIMAL,
|
|
||||||
BodyPart.LEFT_THUMB_DISTAL,
|
|
||||||
BodyPart.LEFT_INDEX_PROXIMAL,
|
|
||||||
BodyPart.LEFT_INDEX_INTERMEDIATE,
|
|
||||||
BodyPart.LEFT_INDEX_DISTAL,
|
|
||||||
BodyPart.LEFT_MIDDLE_PROXIMAL,
|
|
||||||
BodyPart.LEFT_MIDDLE_INTERMEDIATE,
|
|
||||||
BodyPart.LEFT_MIDDLE_DISTAL,
|
|
||||||
BodyPart.LEFT_RING_PROXIMAL,
|
|
||||||
BodyPart.LEFT_RING_INTERMEDIATE,
|
|
||||||
BodyPart.LEFT_RING_DISTAL,
|
|
||||||
BodyPart.LEFT_LITTLE_PROXIMAL,
|
|
||||||
BodyPart.LEFT_LITTLE_INTERMEDIATE,
|
|
||||||
BodyPart.LEFT_LITTLE_DISTAL,
|
|
||||||
BodyPart.RIGHT_THUMB_METACARPAL,
|
|
||||||
BodyPart.RIGHT_THUMB_PROXIMAL,
|
|
||||||
BodyPart.RIGHT_THUMB_DISTAL,
|
|
||||||
BodyPart.RIGHT_INDEX_PROXIMAL,
|
|
||||||
BodyPart.RIGHT_INDEX_INTERMEDIATE,
|
|
||||||
BodyPart.RIGHT_INDEX_DISTAL,
|
|
||||||
BodyPart.RIGHT_MIDDLE_PROXIMAL,
|
|
||||||
BodyPart.RIGHT_MIDDLE_INTERMEDIATE,
|
|
||||||
BodyPart.RIGHT_MIDDLE_DISTAL,
|
|
||||||
BodyPart.RIGHT_RING_PROXIMAL,
|
|
||||||
BodyPart.RIGHT_RING_INTERMEDIATE,
|
|
||||||
BodyPart.RIGHT_RING_DISTAL,
|
|
||||||
BodyPart.RIGHT_LITTLE_PROXIMAL,
|
|
||||||
BodyPart.RIGHT_LITTLE_INTERMEDIATE,
|
|
||||||
BodyPart.RIGHT_LITTLE_DISTAL,
|
|
||||||
];
|
|
||||||
|
|
||||||
const reset = () => {
|
const reset = () => {
|
||||||
const req = new ResetRequestT();
|
const req = new ResetRequestT();
|
||||||
req.resetType = type;
|
req.resetType = type;
|
||||||
@@ -98,10 +64,10 @@ export function ResetButton({
|
|||||||
req.bodyParts = [];
|
req.bodyParts = [];
|
||||||
break;
|
break;
|
||||||
case 'feet':
|
case 'feet':
|
||||||
req.bodyParts = feetBodyParts;
|
req.bodyParts = FEET_BODY_PARTS;
|
||||||
break;
|
break;
|
||||||
case 'fingers':
|
case 'fingers':
|
||||||
req.bodyParts = fingerBodyParts;
|
req.bodyParts = [...FINGER_BODY_PARTS.values()];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sendRPCPacket(RpcMessage.ResetRequest, req);
|
sendRPCPacket(RpcMessage.ResetRequest, req);
|
||||||
|
|||||||
@@ -95,3 +95,49 @@ export const trackerFromIdAtom = ({
|
|||||||
(a) => a,
|
(a) => a,
|
||||||
isEqual
|
isEqual
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const FEET_BODY_PARTS = [BodyPart.LEFT_FOOT, BodyPart.RIGHT_FOOT];
|
||||||
|
export const FINGER_BODY_PARTS = new Set([
|
||||||
|
BodyPart.LEFT_THUMB_METACARPAL,
|
||||||
|
BodyPart.LEFT_THUMB_PROXIMAL,
|
||||||
|
BodyPart.LEFT_THUMB_DISTAL,
|
||||||
|
BodyPart.LEFT_INDEX_PROXIMAL,
|
||||||
|
BodyPart.LEFT_INDEX_INTERMEDIATE,
|
||||||
|
BodyPart.LEFT_INDEX_DISTAL,
|
||||||
|
BodyPart.LEFT_MIDDLE_PROXIMAL,
|
||||||
|
BodyPart.LEFT_MIDDLE_INTERMEDIATE,
|
||||||
|
BodyPart.LEFT_MIDDLE_DISTAL,
|
||||||
|
BodyPart.LEFT_RING_PROXIMAL,
|
||||||
|
BodyPart.LEFT_RING_INTERMEDIATE,
|
||||||
|
BodyPart.LEFT_RING_DISTAL,
|
||||||
|
BodyPart.LEFT_LITTLE_PROXIMAL,
|
||||||
|
BodyPart.LEFT_LITTLE_INTERMEDIATE,
|
||||||
|
BodyPart.LEFT_LITTLE_DISTAL,
|
||||||
|
BodyPart.RIGHT_THUMB_METACARPAL,
|
||||||
|
BodyPart.RIGHT_THUMB_PROXIMAL,
|
||||||
|
BodyPart.RIGHT_THUMB_DISTAL,
|
||||||
|
BodyPart.RIGHT_INDEX_PROXIMAL,
|
||||||
|
BodyPart.RIGHT_INDEX_INTERMEDIATE,
|
||||||
|
BodyPart.RIGHT_INDEX_DISTAL,
|
||||||
|
BodyPart.RIGHT_MIDDLE_PROXIMAL,
|
||||||
|
BodyPart.RIGHT_MIDDLE_INTERMEDIATE,
|
||||||
|
BodyPart.RIGHT_MIDDLE_DISTAL,
|
||||||
|
BodyPart.RIGHT_RING_PROXIMAL,
|
||||||
|
BodyPart.RIGHT_RING_INTERMEDIATE,
|
||||||
|
BodyPart.RIGHT_RING_DISTAL,
|
||||||
|
BodyPart.RIGHT_LITTLE_PROXIMAL,
|
||||||
|
BodyPart.RIGHT_LITTLE_INTERMEDIATE,
|
||||||
|
BodyPart.RIGHT_LITTLE_DISTAL,
|
||||||
|
]);
|
||||||
|
|
||||||
|
export const fingerAssignedTrackers = atom((get) =>
|
||||||
|
get(assignedTrackersAtom).some(
|
||||||
|
(t) => t.tracker.info?.bodyPart && FINGER_BODY_PARTS.has(t.tracker.info.bodyPart)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
export const feetAssignedTrackers = atom((get) =>
|
||||||
|
get(assignedTrackersAtom).some(
|
||||||
|
(t) => t.tracker.info?.bodyPart && FEET_BODY_PARTS.includes(t.tracker.info.bodyPart)
|
||||||
|
)
|
||||||
|
);
|
||||||
Reference in new issue
Block a user