Skip to content
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

Expand skeleton height config #1156

Merged
merged 46 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
d769fa3
Base proportion limits off defaults directly
ButterscotchV Apr 4, 2024
b803eb3
Change height config
ButterscotchV Apr 4, 2024
5317db0
Reset proportions based on hmd height config
ButterscotchV Apr 4, 2024
67e2941
Fix AutoBone HMD height
ButterscotchV Apr 4, 2024
125f27e
Add floor height config
ButterscotchV Apr 13, 2024
cf8f6c6
Merge remote-tracking branch 'upstream/main' into height-config
ButterscotchV Apr 13, 2024
48d330a
Merge branch 'main' into height-config
ImUrX May 12, 2024
f5bf2e2
Merge remote-tracking branch 'upstream/main' into height-config
ButterscotchV Jul 24, 2024
abc534e
Update solarxr-protocol
ButterscotchV Jul 24, 2024
aded461
continue later, need to think
ImUrX Jul 24, 2024
07f2f63
finish the steps
ImUrX Aug 1, 2024
587cb97
Merge branch 'main' into height-config
ImUrX Aug 6, 2024
1b91d7f
solarxr
ImUrX Aug 7, 2024
bd2cfd1
Merge branch 'main' into height-config
ImUrX Aug 15, 2024
95de93d
continuing with height pages
ImUrX Aug 16, 2024
49fd367
add scaled proportions step
ImUrX Aug 19, 2024
a1a428e
Don't select internal trackers for height
ButterscotchV Sep 8, 2024
85c0199
Fix floor height & crashing with no trackers
ButterscotchV Sep 8, 2024
71d383d
Change defaults & fix minimum height
ButterscotchV Sep 8, 2024
fa2d634
Remove steps & remove timer on reset proportions
ButterscotchV Sep 8, 2024
f3430d5
Merge branch 'main' into height-config
ImUrX Sep 25, 2024
6b6c64a
add manual input and warning for too smol
ImUrX Sep 26, 2024
8694ab0
Merge remote-tracking branch 'upstream/main' into height-config
ButterscotchV Nov 10, 2024
92b7449
Update solarxr-protocol
ButterscotchV Nov 10, 2024
714ba74
Use MIN_HEIGHT where applicable
ButterscotchV Nov 10, 2024
62c5960
Remove useless reset proportions button
ButterscotchV Nov 10, 2024
b35d094
Check for HMD instead of beneath floor
ImUrX Nov 14, 2024
30870bb
get previous config and check if its valid
ImUrX Nov 14, 2024
10b02d4
add warning of using default proportions
ImUrX Nov 14, 2024
e8b3825
Make height measurement buttons more descriptive
ButterscotchV Nov 25, 2024
c7fc21c
Clarify height measurement wording
ButterscotchV Nov 25, 2024
16d2c6b
Clarify height minimum wording
ButterscotchV Nov 25, 2024
9277e66
fix reviews
ImUrX Nov 29, 2024
7527467
Add missing translations & re-order AutoBone steps
ButterscotchV Nov 30, 2024
8610109
Allow using loaded height config to continue
ButterscotchV Nov 30, 2024
6bc4676
Treat "null" height config as 0 because Flatbuffer
ButterscotchV Nov 30, 2024
1b3ae81
fix reset proportions triggering the export button
ImUrX Dec 2, 2024
a041370
Allow non-HMD trackers to be used for height
ButterscotchV Dec 3, 2024
fb3ac98
Merge remote-tracking branch 'upstream/main' into height-config
ButterscotchV Dec 19, 2024
f274bad
Merge branch 'main' into height-config
ImUrX Dec 20, 2024
84b0bc9
Merge remote-tracking branch 'upstream/main' into height-config
ButterscotchV Dec 21, 2024
bb02160
Update solarxr-protocol
ButterscotchV Dec 21, 2024
3afc977
Fix height button logic & simplify validation
ButterscotchV Dec 25, 2024
4f4b2c6
Merge remote-tracking branch 'upstream/main' into height-config
ButterscotchV Jan 7, 2025
7707017
Merge branch 'main' into height-config
ImUrX Jan 23, 2025
acc38b9
Merge branch 'main' into height-config
ImUrX Jan 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 59 additions & 7 deletions gui/public/i18n/en/translation.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ reset-reset_all_warning =
Are you sure you want to do this?
reset-reset_all_warning-reset = Reset proportions
reset-reset_all_warning-cancel = Cancel
reset-reset_all_warning_default =
<b>Warning:</b> You currently don't have your height defined, which
will make the proportions be based on a default height.
Are you sure you want to do this?

reset-full = Full Reset
reset-mounting = Reset Mounting
Expand Down Expand Up @@ -914,6 +918,15 @@ onboarding-choose_proportions-manual_proportions = Manual proportions
# Italicized text
onboarding-choose_proportions-manual_proportions-subtitle = For small touches
onboarding-choose_proportions-manual_proportions-description = This will let you adjust your proportions manually by modifying them directly
onboarding-choose_proportions-scaled_proportions = Scaled proportions
# Italized text
onboarding-choose_proportions-scaled_proportions-subtitle = Recommended for new users
# Multiline string
onboarding-choose_proportions-scaled_proportions-description =
This will scale the proportions of an average human body based on your height, this will help for basic full-body tracking.

<b>This requires having your headset (HMD) connected to SlimeVR and on your head!</b>
onboarding-choose_proportions-scaled_proportions-button = Scaled proportions
onboarding-choose_proportions-export = Export proportions
onboarding-choose_proportions-import = Import proportions
onboarding-choose_proportions-import-success = Imported
Expand All @@ -933,9 +946,11 @@ onboarding-automatic_proportions-title = Measure your body
onboarding-automatic_proportions-description = For SlimeVR trackers to work, we need to know the length of your bones. This short calibration will measure it for you.
onboarding-automatic_proportions-manual = Manual proportions
onboarding-automatic_proportions-prev_step = Previous step

onboarding-automatic_proportions-put_trackers_on-title = Put on your trackers
onboarding-automatic_proportions-put_trackers_on-description = To calibrate your proportions, we're gonna use the trackers you just assigned. Put on all your trackers, you can see which are which in the figure to the right.
onboarding-automatic_proportions-put_trackers_on-next = I have all my trackers on

onboarding-automatic_proportions-requirements-title = Requirements
# Each line of text is a different list item
onboarding-automatic_proportions-requirements-descriptionv2 =
Expand All @@ -945,23 +960,38 @@ onboarding-automatic_proportions-requirements-descriptionv2 =
Your headset is reporting positional data to the SlimeVR server (this generally means having SteamVR running and connected to SlimeVR using SlimeVR's SteamVR driver).
Your tracking is working and is accurately representing your movements (ex. you have performed a full reset and they move the right direction when kicking, bending over, sitting, etc).
onboarding-automatic_proportions-requirements-next = I have read the requirements
onboarding-automatic_proportions-check_height-title = Check your height
onboarding-automatic_proportions-check_height-description = We use your height as a basis of our measurements by using the headset's (HMD) height as an approximation of your actual height, but it's better to check if they are right yourself!

onboarding-automatic_proportions-check_height-title-v2 = Measure your height
onboarding-automatic_proportions-check_height-description-v2 = Your headset (HMD) height should be slightly less than your full height, as headsets measure your eye height. This measurement will be used as a baseline for your body proportions.
# All the text is in bold!
onboarding-automatic_proportions-check_height-calculation_warning = Please press the button while standing <u>upright</u> to calculate your height. You have 3 seconds after you press the button!
onboarding-automatic_proportions-check_height-calculation_warning-v2 = Start measuring while standing <u>upright</u> to calculate your height. Be careful to not raise your hands higher than your headset, as they may affect the measurement!
onboarding-automatic_proportions-check_height-guardian_tip = If you are using a standalone VR headset, make sure to have your guardian /
boundary turned on so that your height is correct!
onboarding-automatic_proportions-check_height-fetch_height = I'm standing!
# Context is that the height is unknown
onboarding-automatic_proportions-check_height-unknown = Unknown
# Shows an element below it
onboarding-automatic_proportions-check_height-hmd_height1 = Your HMD height is
onboarding-automatic_proportions-check_height-hmd_height2 = Your headset height is:
onboarding-automatic_proportions-check_height-measure-start = Start measuring
onboarding-automatic_proportions-check_height-measure-stop = Stop measuring
onboarding-automatic_proportions-check_height-measure-reset = Retry measuring
onboarding-automatic_proportions-check_height-next_step = Use headset height

onboarding-automatic_proportions-check_floor_height-title = Measure your floor height (optional)
onboarding-automatic_proportions-check_floor_height-description = In some cases, your floor height may not be set correctly by your headset, causing the headset height to be measured as higher than it should be. You can measure the "height" of your floor to correct your headset height.
# All the text is in bold!
onboarding-automatic_proportions-check_floor_height-calculation_warning = If you are sure that your floor height is correct, you can skip this step.
# Shows an element below it
onboarding-automatic_proportions-check_height-height1 = so your actual height is
onboarding-automatic_proportions-check_height-next_step = They are fine
onboarding-automatic_proportions-check_floor_height-floor_height = Your floor height is:
onboarding-automatic_proportions-check_floor_height-measure-start = Start measuring
onboarding-automatic_proportions-check_floor_height-measure-stop = Stop measuring
onboarding-automatic_proportions-check_floor_height-measure-reset = Retry measuring
onboarding-automatic_proportions-check_floor_height-skip_step = Skip step and save
onboarding-automatic_proportions-check_floor_height-next_step = Use floor height and save

onboarding-automatic_proportions-start_recording-title = Get ready to move
onboarding-automatic_proportions-start_recording-description = We're now going to record some specific poses and moves. These will be prompted in the next screen. Be ready to start when the button is pressed!
onboarding-automatic_proportions-start_recording-next = Start Recording

onboarding-automatic_proportions-recording-title = REC
onboarding-automatic_proportions-recording-description-p0 = Recording in progress...
onboarding-automatic_proportions-recording-description-p1 = Make the moves shown below:
Expand All @@ -979,12 +1009,14 @@ onboarding-automatic_proportions-recording-timer = { $time ->
[one] 1 second left
*[other] { $time } seconds left
}

onboarding-automatic_proportions-verify_results-title = Verify results
onboarding-automatic_proportions-verify_results-description = Check the results below, do they look correct?
onboarding-automatic_proportions-verify_results-results = Recording results
onboarding-automatic_proportions-verify_results-processing = Processing the result
onboarding-automatic_proportions-verify_results-redo = Redo recording
onboarding-automatic_proportions-verify_results-confirm = They're correct

onboarding-automatic_proportions-done-title = Body measured and saved.
onboarding-automatic_proportions-done-description = Your body proportions' calibration is complete!
onboarding-automatic_proportions-error_modal-v2 =
Expand All @@ -993,6 +1025,26 @@ onboarding-automatic_proportions-error_modal-v2 =
Please <docs>check the docs</docs> or join our <discord>Discord</discord> for help ^_^
onboarding-automatic_proportions-error_modal-confirm = Understood!

onboarding-automatic_proportions-smol_warning =
Your configured height of { $height } is smaller than the minimum accepted height of { $minHeight }.
<b>Please redo the measurements and ensure they are correct.</b>
onboarding-automatic_proportions-smol_warning-cancel = Go back

## Tracker scaled proportions setup
onboarding-scaled_proportions-title = Scaled proportions
onboarding-scaled_proportions-description = For SlimeVR trackers to work, we need to know the length of your bones. This will use an average proportion and scale it based on your height.
onboarding-scaled_proportions-manual_height-title = Configure your height
onboarding-scaled_proportions-manual_height-description = Your headset (HMD) height should be slightly less than your full height, as headsets measure your eye height. This height will be used as a baseline for your body proportions.
onboarding-scaled_proportions-manual_height-missing_steamvr = SteamVR is not currently connected to SlimeVR, so measurements can't be based on your headset. <b>Proceed at your own risk or check the docs!</b>
onboarding-scaled_proportions-manual_height-height = Your headset height is
onboarding-scaled_proportions-manual_height-next_step = Continue and save

## Tracker scaled proportions reset
onboarding-scaled_proportions-reset_proportion-title = Reset your body proportions
onboarding-scaled_proportions-reset_proportion-description = To set your body proportions based on your height, you need to now reset all of your proportions. This will clear any proportions you have configured and provide a baseline configuration.
onboarding-scaled_proportions-done-title = Body proportions set
onboarding-scaled_proportions-done-description = Your body proportions should now be configured based on your height.

## Home
home-no_trackers = No trackers detected or assigned

Expand Down
5 changes: 5 additions & 0 deletions gui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import { AppLayout } from './AppLayout';
import { Preload } from './components/Preload';
import { UnknownDeviceModal } from './components/UnknownDeviceModal';
import { useDiscordPresence } from './hooks/discord-presence';
import { ScaledProportionsPage } from './components/onboarding/pages/body-proportions/ScaledProportions';
import { AdvancedSettings } from './components/settings/pages/AdvancedSettings';

export const GH_REPO = 'SlimeVR/SlimeVR-Server';
Expand Down Expand Up @@ -150,6 +151,10 @@ function Layout() {
path="body-proportions/manual"
element={<ManualProportionsPage />}
/>
<Route
path="body-proportions/scaled"
element={<ScaledProportionsPage />}
/>
<Route path="done" element={<DonePage />} />
</Route>
<Route path="*" element={<TopBar></TopBar>}></Route>
Expand Down
54 changes: 52 additions & 2 deletions gui/src/components/commons/NumberSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Control, Controller } from 'react-hook-form';
import { Button } from './Button';
import { Typography } from './Typography';
import { useCallback, useMemo } from 'react';
import { useLocaleConfig } from '@/i18n/config';

export function NumberSelector({
label,
Expand All @@ -10,7 +12,9 @@ export function NumberSelector({
min,
max,
step,
doubleStep,
disabled = false,
showButtonWithNumber = false,
}: {
label?: string;
valueLabelFormat?: (value: number) => string;
Expand All @@ -19,14 +23,36 @@ export function NumberSelector({
min: number;
max: number;
step: number | ((value: number, add: boolean) => number);
doubleStep?: number;
disabled?: boolean;
showButtonWithNumber?: boolean;
}) {
const { currentLocales } = useLocaleConfig();

const stepFn =
typeof step === 'function'
? step
: (value: number, add: boolean) =>
+(add ? value + step : value - step).toFixed(2);

const doubleStepFn = useCallback(
(value: number, add: boolean) =>
doubleStep === undefined
? 0
: +(add ? value + doubleStep : value - doubleStep).toFixed(2),
[doubleStep]
);

const decimalFormat = useMemo(
() =>
new Intl.NumberFormat(currentLocales, {
style: 'decimal',
maximumFractionDigits: 2,
signDisplay: 'exceptZero',
}),
[currentLocales]
);

return (
<Controller
control={control}
Expand All @@ -35,7 +61,19 @@ export function NumberSelector({
<div className="flex flex-col gap-1 w-full">
Copy link
Member

Choose a reason for hiding this comment

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

Standard gap is usually 2

Copy link
Member

Choose a reason for hiding this comment

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

didnt edit this

<Typography bold>{label}</Typography>
<div className="flex gap-5 bg-background-60 p-2 rounded-lg">
<div className="flex">
<div className="flex gap-1">
Copy link
Member

Choose a reason for hiding this comment

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

Standard gap is usually 2

Copy link
Member

Choose a reason for hiding this comment

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

yeah but gap-1 is used usually for input commons

{doubleStep !== undefined && (
<Button
variant="tertiary"
rounded
onClick={() => onChange(doubleStepFn(value, false))}
disabled={doubleStepFn(value, false) < min || disabled}
>
{showButtonWithNumber
? decimalFormat.format(-doubleStep)
: '--'}
</Button>
)}
<Button
variant="tertiary"
rounded
Expand All @@ -48,7 +86,7 @@ export function NumberSelector({
<div className="flex flex-grow justify-center items-center w-10 text-standard">
{valueLabelFormat ? valueLabelFormat(value) : value}
</div>
<div className="flex">
<div className="flex gap-1">
Copy link
Member

Choose a reason for hiding this comment

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

Standard gap is usually 2

<Button
variant="tertiary"
rounded
Expand All @@ -57,6 +95,18 @@ export function NumberSelector({
>
+
</Button>
{doubleStep !== undefined && (
<Button
variant="tertiary"
rounded
onClick={() => onChange(doubleStepFn(value, true))}
disabled={doubleStepFn(value, true) > max || disabled}
>
{showButtonWithNumber
? decimalFormat.format(doubleStep)
: '++'}
</Button>
)}
</div>
</div>
</div>
Expand Down
30 changes: 21 additions & 9 deletions gui/src/components/onboarding/StepperSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,30 +94,42 @@ export function StepDot({
export function StepperSlider({
variant,
steps,
back,
forward,
}: {
variant: 'alone' | 'onboarding';
steps: Step[];
/**
* Ran when step is 0 and `prevStep` is executed
*/
back?: () => void;
/**
* Ran when step is `steps.length - 1` and nextStep is executed
*/
forward?: () => void;
}) {
const ref = useRef<HTMLDivElement | null>(null);
const { width } = useElemSize(ref);
const [stepsContainers, setSteps] = useState(0);
const [shouldAnimate, setShouldAnimate] = useState(true);
const [step, setStep] = useState(0);

useEffect(() => {
if (!ref.current) return;
const stepsContainers =
ref.current.getElementsByClassName('step-container');
setSteps(stepsContainers.length);
}, [ref]);
setStep((x) => Math.min(x, steps.length - 1));
}, [steps.length]);

const nextStep = () => {
if (step + 1 === stepsContainers) return;
if (step + 1 === steps.length) {
forward?.();
return;
}
setStep(step + 1);
};

const prevStep = () => {
if (step - 1 < 0) return;
if (step - 1 < 0) {
back?.();
return;
}
setStep(step - 1);
};

Expand Down Expand Up @@ -168,7 +180,7 @@ export function StepperSlider({
</div>
</div>
<div className="flex justify-center items-center gap-2">
{Array.from({ length: stepsContainers }).map((_, index) => (
{Array.from({ length: steps.length }).map((_, index) => (
<div key={index} className="flex items-center gap-2">
{index !== 0 && (
<div className="w-5 h-1 bg-background-50 rounded-full"></div>
Expand Down
Loading