mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-12-06 00:32:35 -08:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4782aeff68 | ||
|
|
d96f93a7db |
No files matched your search
@@ -79,11 +79,6 @@ jobs:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'pnpm'
|
||||
|
||||
# Tauri has a broken cache issue in windows, let's clean it for now
|
||||
- name: Clean cache in Windows (Fixes tauri-apps/tauri#9045)
|
||||
if: matrix.os == 'windows-latest'
|
||||
run: cargo clean
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
pnpm i
|
||||
|
||||
@@ -320,9 +320,6 @@ jobs:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Clean cache in Windows (Fixes tauri-apps/tauri#9045)
|
||||
run: cargo clean
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
pnpm i
|
||||
|
||||
Generated
+1023
-1502
File diff suppressed because it is too large.
Load diff
+2
-1
@@ -9,8 +9,9 @@ members = ["gui/src-tauri"]
|
||||
[workspace.package]
|
||||
edition = "2021"
|
||||
license = "MIT OR Apache-2.0"
|
||||
rust-version = "1.75" # This version stabilized GATs and let-else
|
||||
rust-version = "1.65" # This version stabilized GATs and let-else
|
||||
repository = "https://github.com/SlimeVR/SlimeVR-Server"
|
||||
|
||||
[profile.release]
|
||||
lto = "thin"
|
||||
strip = "debuginfo" # Only affects Unix binaries with DWARF
|
||||
@@ -96,7 +96,6 @@
|
||||
expat
|
||||
libayatana-appindicator
|
||||
libusb1
|
||||
libudev-zero
|
||||
])
|
||||
++ lib.optionals pkgs.stdenv.isDarwin [
|
||||
pkgs.darwin.apple_sdk.frameworks.Security
|
||||
@@ -118,7 +117,7 @@
|
||||
enable = true;
|
||||
toolchain = fenixpkgs.fromToolchainName {
|
||||
name = rust_toolchain.toolchain.channel;
|
||||
sha256 = "sha256-3St/9/UKo/6lz2Kfq2VmlzHyufduALpiIKaaKX4Pq0g=";
|
||||
sha256 = "sha256-rLP8+fTxnPHoR96ZJiCa/5Ans1OojI7MLsmSqR2ip8o=";
|
||||
};
|
||||
components = rust_toolchain.toolchain.components;
|
||||
};
|
||||
|
||||
+59
-57
@@ -3,51 +3,53 @@
|
||||
"version": "0.5.1",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@fluent/bundle": "^0.18.0",
|
||||
"@fluent/react": "^0.15.2",
|
||||
"@fontsource/poppins": "^5.0.12",
|
||||
"@fluent/bundle": "^0.17.1",
|
||||
"@fluent/react": "^0.14.1",
|
||||
"@fontsource/poppins": "^4.5.8",
|
||||
"@formatjs/intl-localematcher": "^0.2.32",
|
||||
"@react-three/drei": "^9.105.1",
|
||||
"@react-three/fiber": "^8.16.1",
|
||||
"@tauri-apps/api": "=2.0.0-beta.7",
|
||||
"@tauri-apps/plugin-dialog": "=2.0.0-beta.2",
|
||||
"@tauri-apps/plugin-fs": "=2.0.0-beta.2",
|
||||
"@tauri-apps/plugin-os": "=2.0.0-beta.2",
|
||||
"@tauri-apps/plugin-shell": "=2.0.0-beta.2",
|
||||
"@tauri-apps/plugin-store": "=2.0.0-beta.2",
|
||||
"@vitejs/plugin-react": "^4.2.1",
|
||||
"browser-fs-access": "^0.35.0",
|
||||
"browserslist": "^4.23.0",
|
||||
"classnames": "^2.5.1",
|
||||
"eslint-config-react-app": "^7.0.1",
|
||||
"@react-three/drei": "^9.80.3",
|
||||
"@react-three/fiber": "^8.13.6",
|
||||
"@tauri-apps/api": "=2.0.0-alpha.8",
|
||||
"@tauri-apps/plugin-app": "=2.0.0-alpha.1",
|
||||
"@tauri-apps/plugin-dialog": "=2.0.0-alpha.1",
|
||||
"@tauri-apps/plugin-fs": "=2.0.0-alpha.1",
|
||||
"@tauri-apps/plugin-os": "=2.0.0-alpha.2",
|
||||
"@tauri-apps/plugin-shell": "=2.0.0-alpha.1",
|
||||
"@tauri-apps/plugin-store": "=2.0.0-alpha.1",
|
||||
"@tauri-apps/plugin-window": "=2.0.0-alpha.1",
|
||||
"@vitejs/plugin-react": "^3.0.0",
|
||||
"browser-fs-access": "^0.34.1",
|
||||
"browserslist": "^4.18.1",
|
||||
"classnames": "^2.3.1",
|
||||
"eslint-config-react-app": "^7.0.0",
|
||||
"flatbuffers": "^22.10.26",
|
||||
"identity-obj-proxy": "^3.0.0",
|
||||
"intl-pluralrules": "^2.0.1",
|
||||
"ip-num": "^1.5.1",
|
||||
"intl-pluralrules": "^1.3.1",
|
||||
"ip-num": "^1.4.1",
|
||||
"postcss-flexbugs-fixes": "^5.0.2",
|
||||
"postcss-normalize": "^10.0.1",
|
||||
"postcss-preset-env": "^9.5.2",
|
||||
"postcss-preset-env": "^7.0.1",
|
||||
"prompts": "^2.4.2",
|
||||
"react": "^18.2.0",
|
||||
"react-dev-utils": "^12.0.1",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-error-boundary": "^4.0.13",
|
||||
"react": "^18.0.0",
|
||||
"react-dev-utils": "^12.0.0",
|
||||
"react-dom": "^18.0.0",
|
||||
"react-error-boundary": "^4.0.12",
|
||||
"react-helmet": "^6.1.0",
|
||||
"react-hook-form": "^7.51.0",
|
||||
"react-modal": "^3.16.1",
|
||||
"react-responsive": "^10.0.0",
|
||||
"react-router-dom": "^6.22.3",
|
||||
"semver": "^7.6.0",
|
||||
"react-hook-form": "^7.29.0",
|
||||
"react-modal": "^3.15.1",
|
||||
"react-responsive": "^9.0.2",
|
||||
"react-router-dom": "^6.2.2",
|
||||
"semver": "^7.5.3",
|
||||
"solarxr-protocol": "file:../solarxr-protocol",
|
||||
"three": "^0.163.0",
|
||||
"ts-pattern": "^5.0.8",
|
||||
"typescript": "^5.4.3"
|
||||
"three": "^0.155.0",
|
||||
"ts-pattern": "^5.0.1",
|
||||
"typescript": "^5.1.6"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "vite --force",
|
||||
"build": "vite build",
|
||||
"dev": "tauri dev",
|
||||
"skipbundler": "tauri build --no-bundle",
|
||||
"skipbundler": "tauri build -b none",
|
||||
"tauri": "tauri",
|
||||
"lint": "tsc --noEmit && eslint --max-warnings=0 \"src/**/*.{js,jsx,ts,tsx,json}\" && prettier --check \"src/**/*.{js,jsx,ts,tsx,css,md,json}\"",
|
||||
"lint:fix": "tsc --noEmit && eslint --fix --max-warnings=0 \"src/**/*.{js,jsx,ts,tsx,json}\" && pnpm run format",
|
||||
@@ -73,33 +75,33 @@
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@dword-design/eslint-plugin-import-alias": "^4.0.9",
|
||||
"@tailwindcss/forms": "^0.5.7",
|
||||
"@tauri-apps/cli": "=2.0.0-beta.12",
|
||||
"@types/file-saver": "^2.0.7",
|
||||
"@types/react": "^18.2.73",
|
||||
"@types/react-dom": "^18.2.23",
|
||||
"@types/react-helmet": "^6.1.11",
|
||||
"@types/react-modal": "3.16.3",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@types/three": "^0.163.0",
|
||||
"@typescript-eslint/eslint-plugin": "^7.4.0",
|
||||
"@typescript-eslint/parser": "^7.4.0",
|
||||
"autoprefixer": "^10.4.19",
|
||||
"@dword-design/eslint-plugin-import-alias": "^4.0.8",
|
||||
"@tailwindcss/forms": "^0.5.3",
|
||||
"@tauri-apps/cli": "=2.0.0-alpha.17",
|
||||
"@types/file-saver": "^2.0.5",
|
||||
"@types/react": "^18.0.25",
|
||||
"@types/react-dom": "^18.0.5",
|
||||
"@types/react-helmet": "^6.1.6",
|
||||
"@types/react-modal": "3.13.1",
|
||||
"@types/semver": "^7.5.4",
|
||||
"@types/three": "^0.155.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.60.1",
|
||||
"@typescript-eslint/parser": "^5.60.1",
|
||||
"autoprefixer": "^10.4.4",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint": "^8.44.0",
|
||||
"eslint-config-airbnb": "^19.0.4",
|
||||
"eslint-import-resolver-typescript": "^3.6.1",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"eslint-plugin-jsx-a11y": "^6.8.0",
|
||||
"eslint-plugin-react": "^7.34.1",
|
||||
"eslint-import-resolver-typescript": "^3.5.5",
|
||||
"eslint-plugin-import": "^2.27.5",
|
||||
"eslint-plugin-jsx-a11y": "^6.7.1",
|
||||
"eslint-plugin-react": "^7.32.2",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"postcss": "^8.4.38",
|
||||
"prettier": "^3.2.5",
|
||||
"pretty-quick": "^4.0.0",
|
||||
"rollup-plugin-visualizer": "^5.12.0",
|
||||
"tailwind-gradient-mask-image": "^1.2.0",
|
||||
"tailwindcss": "^3.4.3",
|
||||
"vite": "^5.2.7"
|
||||
"postcss": "^8.4.31",
|
||||
"prettier": "^2.8.8",
|
||||
"pretty-quick": "^3.1.3",
|
||||
"rollup-plugin-visualizer": "^5.9.2",
|
||||
"tailwind-gradient-mask-image": "^1.0.0",
|
||||
"tailwindcss": "^3.3.2",
|
||||
"vite": "^4.3.9"
|
||||
}
|
||||
}
|
||||
@@ -177,7 +177,6 @@ tracker-infos-hardware_rev = Hardware Revision
|
||||
tracker-infos-hardware_identifier = Hardware ID
|
||||
tracker-infos-imu = IMU Sensor
|
||||
tracker-infos-board_type = Main board
|
||||
tracker-infos-network_version = Protocol Version
|
||||
|
||||
## Tracker settings
|
||||
tracker-settings-back = Go back to trackers list
|
||||
@@ -284,18 +283,14 @@ settings-general-steamvr-description =
|
||||
Useful for games or apps that only support certain trackers.
|
||||
settings-general-steamvr-trackers-waist = Waist
|
||||
settings-general-steamvr-trackers-chest = Chest
|
||||
settings-general-steamvr-trackers-left_foot = Left foot
|
||||
settings-general-steamvr-trackers-right_foot = Right foot
|
||||
settings-general-steamvr-trackers-left_knee = Left knee
|
||||
settings-general-steamvr-trackers-right_knee = Right knee
|
||||
settings-general-steamvr-trackers-left_elbow = Left elbow
|
||||
settings-general-steamvr-trackers-right_elbow = Right elbow
|
||||
settings-general-steamvr-trackers-left_hand = Left hand
|
||||
settings-general-steamvr-trackers-right_hand = Right hand
|
||||
settings-general-steamvr-trackers-feet = Feet
|
||||
settings-general-steamvr-trackers-knees = Knees
|
||||
settings-general-steamvr-trackers-elbows = Elbows
|
||||
settings-general-steamvr-trackers-hands = Hands
|
||||
settings-general-steamvr-trackers-tracker_toggling = Automatic tracker assignment
|
||||
settings-general-steamvr-trackers-tracker_toggling-description = Automatically handles toggling SteamVR trackers on or off depending on your current tracker assignments
|
||||
settings-general-steamvr-trackers-tracker_toggling-label = Automatic tracker assignment
|
||||
settings-general-steamvr-trackers-hands-warning = <b>Warning:</b> hand trackers will override your controllers.
|
||||
settings-general-steamvr-trackers-hands-warning = <b>Warning:</b> hand trackers will override your controllers.
|
||||
Are you sure?
|
||||
settings-general-steamvr-trackers-hands-warning-cancel = Cancel
|
||||
settings-general-steamvr-trackers-hands-warning-done = Yes
|
||||
@@ -315,7 +310,6 @@ settings-general-tracker_mechanics-filtering-type-smoothing-description = Smooth
|
||||
settings-general-tracker_mechanics-filtering-type-prediction = Prediction
|
||||
settings-general-tracker_mechanics-filtering-type-prediction-description = Reduces latency and makes movements more snappy, but may increase jitter.
|
||||
settings-general-tracker_mechanics-filtering-amount = Amount
|
||||
settings-general-tracker_mechanics-yaw-reset-smooth-time = Yaw reset smooth time (0s disables smoothing)
|
||||
settings-general-tracker_mechanics-drift_compensation = Drift compensation
|
||||
# This cares about multilines
|
||||
settings-general-tracker_mechanics-drift_compensation-description =
|
||||
@@ -324,11 +318,6 @@ settings-general-tracker_mechanics-drift_compensation-description =
|
||||
settings-general-tracker_mechanics-drift_compensation-enabled-label = Drift compensation
|
||||
settings-general-tracker_mechanics-drift_compensation-amount-label = Compensation amount
|
||||
settings-general-tracker_mechanics-drift_compensation-max_resets-label = Use up to x last resets
|
||||
settings-general-tracker_mechanics-save_mounting_reset = Save automatic mounting reset calibration
|
||||
settings-general-tracker_mechanics-save_mounting_reset-description =
|
||||
Saves the automatic mounting reset calibrations for the trackers between restarts. Useful
|
||||
when wearing a suit where trackers don't move between sessions. <b>Not recommended for normal users!</b>
|
||||
settings-general-tracker_mechanics-save_mounting_reset-enabled-label = Save mounting reset
|
||||
|
||||
## FK/Tracking settings
|
||||
settings-general-fk_settings = Tracking settings
|
||||
@@ -835,7 +824,7 @@ 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!
|
||||
# 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-guardian_tip = If you are using a standalone VR headset, make sure to have your guardian /
|
||||
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
|
||||
|
||||
@@ -3,4 +3,3 @@
|
||||
/target/
|
||||
WixTools
|
||||
src/JavaVersion.class
|
||||
/gen/schemas
|
||||
+16
-15
@@ -21,37 +21,38 @@ default = ["custom-protocol"]
|
||||
custom-protocol = ["tauri/custom-protocol"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "=2.0.0-beta.11", features = [] }
|
||||
cfg_aliases = "0.2"
|
||||
shadow-rs = "0.27"
|
||||
tauri-build = { version = "2.0.0-alpha", features = [] }
|
||||
cfg_aliases = "0.1"
|
||||
shadow-rs = "0.23"
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
tauri = { version = "=2.0.0-beta.14", features = ["devtools", "tray-icon", "image-png"] }
|
||||
tauri-runtime = "=2.0.0-beta.11"
|
||||
tauri-plugin-dialog = "=2.0.0-beta.4"
|
||||
tauri-plugin-fs = "=2.0.0-beta.4"
|
||||
tauri-plugin-os = "=2.0.0-beta.3"
|
||||
tauri-plugin-shell = "=2.0.0-beta.3"
|
||||
tauri-plugin-store = "=2.0.0-beta.4"
|
||||
flexi_logger = "0.28"
|
||||
tauri = { version = "2.0.0-alpha", features = ["tray-icon", "devtools", "icon-png"] }
|
||||
tauri-runtime = "1.0.0-alpha"
|
||||
tauri-plugin-dialog = "2.0.0-alpha"
|
||||
tauri-plugin-fs = "2.0.0-alpha"
|
||||
tauri-plugin-os = "2.0.0-alpha"
|
||||
tauri-plugin-shell = "2.0.0-alpha"
|
||||
tauri-plugin-store = "=2.0.0-alpha.1"
|
||||
tauri-plugin-window = { version = "2.0.0-alpha", features = ["devtools"] }
|
||||
flexi_logger = "0.25"
|
||||
log-panics = { version = "2", features = ["with-backtrace"] }
|
||||
log = "0.4"
|
||||
clap = { version = "4.0.29", features = ["derive"] }
|
||||
clap-verbosity-flag = "2"
|
||||
rand = "0.8.5"
|
||||
tempfile = "3"
|
||||
which = "6.0"
|
||||
which = "4.3"
|
||||
glob = "0.3"
|
||||
open = "5"
|
||||
shadow-rs = { version = "0.27", default-features = false }
|
||||
shadow-rs = { version = "0.23", default-features = false }
|
||||
const_format = "0.2.30"
|
||||
cfg-if = "1"
|
||||
color-eyre = "0.6"
|
||||
rfd = { version = "0.14", features = ["gtk3"], default-features = false }
|
||||
rfd = "0.11.4"
|
||||
dirs-next = "2.0.0"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
win32job = "1"
|
||||
winreg = "0.52"
|
||||
winreg = "0.50"
|
||||
@@ -1,33 +0,0 @@
|
||||
{
|
||||
"identifier": "migrated",
|
||||
"description": "permissions that were migrated from v1",
|
||||
"local": true,
|
||||
"windows": [
|
||||
"main"
|
||||
],
|
||||
"permissions": [
|
||||
"path:default",
|
||||
"event:default",
|
||||
"window:default",
|
||||
"app:default",
|
||||
"resources:default",
|
||||
"menu:default",
|
||||
"tray:default",
|
||||
"store:default",
|
||||
"os:allow-os-type",
|
||||
"webview:default",
|
||||
"dialog:allow-save",
|
||||
"window:allow-close",
|
||||
"window:allow-toggle-maximize",
|
||||
"window:allow-minimize",
|
||||
"window:allow-start-dragging",
|
||||
"window:allow-hide",
|
||||
"window:allow-show",
|
||||
"window:allow-set-focus",
|
||||
"shell:allow-open",
|
||||
"store:allow-get",
|
||||
"store:allow-set",
|
||||
"store:allow-save",
|
||||
"fs:allow-write-text-file"
|
||||
]
|
||||
}
|
||||
+21
-22
@@ -70,19 +70,20 @@ fn main() -> Result<()> {
|
||||
use flexi_logger::{
|
||||
Age, Cleanup, Criterion, Duplicate, FileSpec, Logger, Naming, WriteMode,
|
||||
};
|
||||
use tauri::Error;
|
||||
use tauri::path::Error;
|
||||
|
||||
// Based on https://docs.rs/tauri/2.0.0-alpha.10/src/tauri/path/desktop.rs.html#238-256
|
||||
#[cfg(target_os = "macos")]
|
||||
let path = dirs_next::home_dir().ok_or(Error::UnknownPath).map(|dir| {
|
||||
dir.join("Library/Logs")
|
||||
.join(&tauri_context.config().identifier)
|
||||
.join(&tauri_context.config().tauri.bundle.identifier)
|
||||
});
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
let path = dirs_next::data_dir()
|
||||
.ok_or(Error::UnknownPath)
|
||||
.map(|dir| dir.join(&tauri_context.config().identifier).join("logs"));
|
||||
let path = dirs_next::data_dir().ok_or(Error::UnknownPath).map(|dir| {
|
||||
dir.join(&tauri_context.config().tauri.bundle.identifier)
|
||||
.join("logs")
|
||||
});
|
||||
|
||||
Logger::try_with_env_or_str("info")?
|
||||
.log_to_file(
|
||||
@@ -120,9 +121,7 @@ fn main() -> Result<()> {
|
||||
if !webview2_exists() {
|
||||
// This makes a dialog appear which let's you press Ok or Cancel
|
||||
// If you press Ok it will open the SlimeVR installer documentation
|
||||
use rfd::{
|
||||
MessageButtons, MessageDialog, MessageDialogResult, MessageLevel,
|
||||
};
|
||||
use rfd::{MessageButtons, MessageDialog, MessageLevel};
|
||||
|
||||
let confirm = MessageDialog::new()
|
||||
.set_title("SlimeVR")
|
||||
@@ -130,7 +129,7 @@ fn main() -> Result<()> {
|
||||
.set_buttons(MessageButtons::OkCancel)
|
||||
.set_level(MessageLevel::Error)
|
||||
.show();
|
||||
if confirm == MessageDialogResult::Ok {
|
||||
if confirm {
|
||||
open::that("https://docs.slimevr.dev/server-setup/installing-and-connecting.html#install-the-latest-slimevr-installer").unwrap();
|
||||
}
|
||||
return Ok(());
|
||||
@@ -171,6 +170,7 @@ fn main() -> Result<()> {
|
||||
.plugin(tauri_plugin_os::init())
|
||||
.plugin(tauri_plugin_shell::init())
|
||||
.plugin(tauri_plugin_store::Builder::default().build())
|
||||
.plugin(tauri_plugin_window::init())
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
update_window_state,
|
||||
logging,
|
||||
@@ -184,21 +184,22 @@ fn main() -> Result<()> {
|
||||
WindowState::open_state(app.path().app_config_dir().unwrap())
|
||||
.unwrap_or_default();
|
||||
|
||||
let window = tauri::WebviewWindowBuilder::new(
|
||||
let window = tauri::WindowBuilder::new(
|
||||
app,
|
||||
"main",
|
||||
tauri::WebviewUrl::App("index.html".into()),
|
||||
tauri::WindowUrl::App("index.html".into()),
|
||||
)
|
||||
.title("SlimeVR")
|
||||
.inner_size(1289.0, 709.0)
|
||||
.min_inner_size(util::MIN_WINDOW_SIZE_WIDTH, util::MIN_WINDOW_SIZE_HEIGHT)
|
||||
.min_inner_size(393.0, 667.0)
|
||||
.resizable(true)
|
||||
.visible(true)
|
||||
.decorations(false)
|
||||
.fullscreen(false)
|
||||
.disable_file_drop_handler()
|
||||
.build()?;
|
||||
if window_state.is_old() {
|
||||
window_state.update_window(&window.as_ref().window(), false)?;
|
||||
window_state.update_window(&window, false)?;
|
||||
}
|
||||
|
||||
#[cfg(desktop)]
|
||||
@@ -243,21 +244,21 @@ fn main() -> Result<()> {
|
||||
_ => ("other", "".to_string()),
|
||||
};
|
||||
app_handle
|
||||
.emit("server-status", emit_me)
|
||||
.emit_all("server-status", emit_me)
|
||||
.expect("Check server log files. \nFailed to emit");
|
||||
}
|
||||
log::error!("Java server receiver died");
|
||||
app_handle
|
||||
.emit("server-status", ("other", "receiver cancelled"))
|
||||
.emit_all("server-status", ("other", "receiver cancelled"))
|
||||
.expect("Failed to emit");
|
||||
});
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
.on_window_event(|w, e| match e {
|
||||
.on_window_event(|e| match e.event() {
|
||||
WindowEvent::CloseRequested { .. } => {
|
||||
let window_state = w.state::<Mutex<WindowState>>();
|
||||
if let Err(e) = update_window_state(w.clone(), window_state) {
|
||||
let window_state = e.window().state::<Mutex<WindowState>>();
|
||||
if let Err(e) = update_window_state(e.window().clone(), window_state) {
|
||||
log::error!("failed to update window state {}", e)
|
||||
}
|
||||
}
|
||||
@@ -305,9 +306,7 @@ fn main() -> Result<()> {
|
||||
// I should log this anyways, don't want to dig a grave by not logging the error.
|
||||
log::error!("CreateWebview error {}", error);
|
||||
|
||||
use rfd::{
|
||||
MessageButtons, MessageDialog, MessageDialogResult, MessageLevel,
|
||||
};
|
||||
use rfd::{MessageButtons, MessageDialog, MessageLevel};
|
||||
|
||||
let confirm = MessageDialog::new()
|
||||
.set_title("SlimeVR")
|
||||
@@ -315,7 +314,7 @@ fn main() -> Result<()> {
|
||||
.set_buttons(MessageButtons::OkCancel)
|
||||
.set_level(MessageLevel::Error)
|
||||
.show();
|
||||
if confirm == MessageDialogResult::Ok {
|
||||
if confirm {
|
||||
open::that("https://docs.slimevr.dev/common-issues.html#webview2-is-missing--slimevr-gui-crashes-immediately--panicked-at--webview2error").unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@ use color_eyre::Result;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tauri::{LogicalSize, Monitor, PhysicalPosition, PhysicalSize, Window};
|
||||
|
||||
use crate::util;
|
||||
|
||||
static STATE_FILENAME: &str = ".window-state.json";
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Default)]
|
||||
@@ -75,11 +73,7 @@ impl WindowState {
|
||||
window.unmaximize()?;
|
||||
}
|
||||
|
||||
if self.width > util::MIN_WINDOW_SIZE_WIDTH
|
||||
&& self.height > util::MIN_WINDOW_SIZE_HEIGHT
|
||||
{
|
||||
window.set_size(LogicalSize::new(self.width, self.height))?;
|
||||
}
|
||||
window.set_size(LogicalSize::new(self.width, self.height))?;
|
||||
|
||||
let pos = PhysicalPosition::new(self.x, self.y);
|
||||
for monitor in window.available_monitors()? {
|
||||
|
||||
+13
-14
@@ -1,10 +1,9 @@
|
||||
use std::{collections::HashMap, sync::Mutex};
|
||||
|
||||
use tauri::{
|
||||
image::Image,
|
||||
menu::{Menu, MenuBuilder, MenuItemBuilder, MenuItemKind},
|
||||
menu::{Menu, MenuItem, MenuItemKind},
|
||||
tray::{ClickType, TrayIconBuilder},
|
||||
AppHandle, Manager, Runtime, State,
|
||||
AppHandle, Icon, Manager, Runtime, State,
|
||||
};
|
||||
|
||||
pub struct TrayMenu<R: Runtime>(Menu<R>);
|
||||
@@ -47,7 +46,7 @@ pub fn update_tray_text<R: Runtime>(
|
||||
menu: State<TrayMenu<R>>,
|
||||
) -> color_eyre::Result<(), String> {
|
||||
if let Some((window, MenuItemKind::MenuItem(toggle_i))) =
|
||||
app.get_webview_window("main").zip(menu.0.get("toggle"))
|
||||
app.get_window("main").zip(menu.0.get("toggle"))
|
||||
{
|
||||
let new_title = if window.is_visible().unwrap_or_default() {
|
||||
i18n.get("tray_menu-hide")
|
||||
@@ -67,9 +66,9 @@ pub fn update_tray_text<R: Runtime>(
|
||||
}
|
||||
|
||||
pub fn create_tray<R: Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<()> {
|
||||
let toggle_i = MenuItemBuilder::with_id("toggle", "Hide").build(app)?;
|
||||
let quit_i = MenuItemBuilder::with_id("quit", "Quit").build(app)?;
|
||||
let menu1 = MenuBuilder::new(app).items(&[&toggle_i, &quit_i]).build()?;
|
||||
let toggle_i = MenuItem::with_id(app, "toggle", "Hide", true, None);
|
||||
let quit_i = MenuItem::with_id(app, "quit", "Quit", true, None);
|
||||
let menu1 = Menu::with_items(app, &[&toggle_i, &quit_i])?;
|
||||
|
||||
let _ = TrayIconBuilder::with_id("tray-1")
|
||||
.menu(&menu1)
|
||||
@@ -78,15 +77,15 @@ pub fn create_tray<R: Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<()> {
|
||||
.icon_as_template(true)
|
||||
.menu_on_left_click(false)
|
||||
.icon(if cfg!(target_os = "macos") {
|
||||
Image::from_bytes(include_bytes!("../icons/appleTrayIcon.png"))
|
||||
Icon::Raw(include_bytes!("../icons/appleTrayIcon.png").to_vec())
|
||||
} else {
|
||||
Image::from_bytes(include_bytes!("../icons/128x128.png"))
|
||||
}?)
|
||||
Icon::Raw(include_bytes!("../icons/128x128.png").to_vec())
|
||||
})
|
||||
.on_menu_event(move |app, event| match event.id.as_ref() {
|
||||
"quit" => app.emit("try-close", "tray").unwrap(),
|
||||
"quit" => app.emit_all("try-close", "tray").unwrap(),
|
||||
"toggle" => {
|
||||
let i18n = app.state::<TrayTranslations>();
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
if let Some(window) = app.get_window("main") {
|
||||
let new_title = if window.is_visible().unwrap_or_default() {
|
||||
let _ = window.hide();
|
||||
i18n.get("tray_menu-show")
|
||||
@@ -100,10 +99,10 @@ pub fn create_tray<R: Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<()> {
|
||||
}
|
||||
_ => {}
|
||||
})
|
||||
.on_tray_icon_event(|tray, event| {
|
||||
.on_tray_event(|tray, event| {
|
||||
if event.click_type == ClickType::Left {
|
||||
let app = tray.app_handle();
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
if let Some(window) = app.get_window("main") {
|
||||
let _ = window.show();
|
||||
let _ = window.set_focus();
|
||||
}
|
||||
|
||||
@@ -28,8 +28,6 @@ pub static POSSIBLE_TITLES: &[&str] = &[
|
||||
"never gonna let you down",
|
||||
"uwu sowwy",
|
||||
];
|
||||
pub const MIN_WINDOW_SIZE_WIDTH: f64 = 393.0;
|
||||
pub const MIN_WINDOW_SIZE_HEIGHT: f64 = 667.0;
|
||||
|
||||
shadow!(build);
|
||||
// Tauri has a way to return the package.json version, but it's not a constant...
|
||||
@@ -97,17 +95,17 @@ pub fn spawn_java(java: &OsStr, java_version: &OsStr) -> std::io::Result<Child>
|
||||
#[cfg(desktop)]
|
||||
pub fn show_error(text: &str) -> bool {
|
||||
use rand::{seq::SliceRandom, thread_rng};
|
||||
use rfd::{MessageButtons, MessageDialog, MessageDialogResult, MessageLevel};
|
||||
use rfd::{MessageButtons, MessageDialog, MessageLevel};
|
||||
|
||||
MessageDialog::new()
|
||||
.set_title(format!(
|
||||
.set_title(&format!(
|
||||
"SlimeVR GUI crashed - {}",
|
||||
POSSIBLE_TITLES.choose(&mut thread_rng()).unwrap()
|
||||
))
|
||||
.set_description(text)
|
||||
.set_buttons(MessageButtons::Ok)
|
||||
.set_level(MessageLevel::Error)
|
||||
.show() == MessageDialogResult::Ok
|
||||
.show()
|
||||
}
|
||||
|
||||
#[cfg(mobile)]
|
||||
|
||||
@@ -1,85 +1,87 @@
|
||||
{
|
||||
"build": {
|
||||
"beforeBuildCommand": "pnpm run build",
|
||||
"beforeDevCommand": "pnpm run start",
|
||||
"frontendDist": "../dist",
|
||||
"devUrl": "http://localhost:5173"
|
||||
"package": {
|
||||
"productName": "slimevr",
|
||||
"version": "../package.json"
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"linux": {
|
||||
"build": {
|
||||
"distDir": "../dist",
|
||||
"devPath": "http://localhost:5173",
|
||||
"beforeDevCommand": "pnpm run start",
|
||||
"beforeBuildCommand": "pnpm run build"
|
||||
},
|
||||
"plugins": {
|
||||
"shell": {
|
||||
"open": true
|
||||
},
|
||||
"fs": {
|
||||
"scope": ["$APP/*", "$APP"],
|
||||
"all": true
|
||||
},
|
||||
"os": {
|
||||
"all": true
|
||||
},
|
||||
"window": {
|
||||
"setResizable": true,
|
||||
"setTitle": true,
|
||||
"maximize": true,
|
||||
"unmaximize": true,
|
||||
"minimize": true,
|
||||
"unminimize": true,
|
||||
"close": true,
|
||||
"startDragging": true,
|
||||
"setSize": true
|
||||
}
|
||||
},
|
||||
"tauri": {
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"targets": "all",
|
||||
"identifier": "dev.slimevr.SlimeVR",
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
"icons/[email protected]",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
],
|
||||
"resources": [],
|
||||
"externalBin": [],
|
||||
"copyright": "",
|
||||
"category": "DeveloperTool",
|
||||
"shortDescription": "",
|
||||
"longDescription": "",
|
||||
"deb": {
|
||||
"depends": [
|
||||
"openjdk-17-jre-headless"
|
||||
],
|
||||
"depends": ["openjdk-17-jre-headless"],
|
||||
"files": {
|
||||
"/usr/share/slimevr/slimevr.jar": "../../server/desktop/build/libs/slimevr.jar"
|
||||
}
|
||||
},
|
||||
"appimage": {
|
||||
"bundleMediaFramework": true
|
||||
},
|
||||
"macOS": {
|
||||
"frameworks": [],
|
||||
"exceptionDomain": "localhost",
|
||||
"signingIdentity": null,
|
||||
"providerShortName": null,
|
||||
"entitlements": null,
|
||||
"license": "../../LICENSE-MIT"
|
||||
},
|
||||
"windows": {
|
||||
"certificateThumbprint": null,
|
||||
"digestAlgorithm": "sha256",
|
||||
"timestampUrl": ""
|
||||
}
|
||||
},
|
||||
"category": "DeveloperTool",
|
||||
"copyright": "",
|
||||
"targets": "all",
|
||||
"externalBin": [],
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
"icons/[email protected]",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
],
|
||||
"windows": {
|
||||
"certificateThumbprint": null,
|
||||
"digestAlgorithm": "sha256",
|
||||
"timestampUrl": ""
|
||||
},
|
||||
"longDescription": "",
|
||||
"macOS": {
|
||||
"entitlements": null,
|
||||
"exceptionDomain": "localhost",
|
||||
"frameworks": [],
|
||||
"signingIdentity": null,
|
||||
"providerShortName": null
|
||||
},
|
||||
"resources": [],
|
||||
"shortDescription": "",
|
||||
"licenseFile": "../../LICENSE-MIT"
|
||||
},
|
||||
"plugins": {
|
||||
"fs": {
|
||||
"all": true,
|
||||
"scope": [
|
||||
"$APP/*",
|
||||
"$APP"
|
||||
]
|
||||
},
|
||||
"os": {
|
||||
"all": true
|
||||
},
|
||||
"shell": {
|
||||
"open": true
|
||||
},
|
||||
"window": {
|
||||
"close": true,
|
||||
"maximize": true,
|
||||
"minimize": true,
|
||||
"setResizable": true,
|
||||
"setSize": true,
|
||||
"setTitle": true,
|
||||
"startDragging": true,
|
||||
"unmaximize": true,
|
||||
"unminimize": true
|
||||
}
|
||||
},
|
||||
"productName": "slimevr",
|
||||
"version": "../package.json",
|
||||
"identifier": "dev.slimevr.SlimeVR",
|
||||
"app": {
|
||||
"security": {
|
||||
"csp": null
|
||||
"csp": null,
|
||||
"dangerousRemoteDomainIpcAccess": [
|
||||
{
|
||||
"domain": "tauri.localhost",
|
||||
"windows": ["main"],
|
||||
"plugins": ["dialog", "fs", "os", "shell", "window"]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-21
@@ -47,7 +47,7 @@ import { CalibrationTutorialPage } from './components/onboarding/pages/Calibrati
|
||||
import { AssignmentTutorialPage } from './components/onboarding/pages/assignment-preparation/AssignmentTutorial';
|
||||
import { open } from '@tauri-apps/plugin-shell';
|
||||
import semver from 'semver';
|
||||
import { useBreakpoint, useIsTauri } from './hooks/breakpoint';
|
||||
import { useBreakpoint } from './hooks/breakpoint';
|
||||
import { VRModePage } from './components/vr-mode/VRModePage';
|
||||
import { InterfaceSettings } from './components/settings/pages/InterfaceSettings';
|
||||
import { error, log } from './utils/logging';
|
||||
@@ -159,24 +159,6 @@ export default function App() {
|
||||
const websocketAPI = useProvideWebsocketApi();
|
||||
const { l10n } = useLocalization();
|
||||
const [updateFound, setUpdateFound] = useState('');
|
||||
const isTauri = useIsTauri();
|
||||
|
||||
useEffect(() => {
|
||||
const onKeydown: (arg0: KeyboardEvent) => void = function (event) {
|
||||
// prevent search bar keybind
|
||||
if (
|
||||
event.key === 'F3' ||
|
||||
(event.ctrlKey && event.key === 'f') ||
|
||||
(event.metaKey && event.key === 'f')
|
||||
) {
|
||||
event.preventDefault();
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('keydown', onKeydown);
|
||||
return () => window.removeEventListener('keydown', onKeydown);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
async function fetchReleases() {
|
||||
const releases = await fetch(
|
||||
@@ -196,7 +178,7 @@ export default function App() {
|
||||
fetchReleases().catch(() => error('failed to fetch releases'));
|
||||
}, []);
|
||||
|
||||
if (isTauri) {
|
||||
if (window.__TAURI_METADATA__) {
|
||||
useEffect(() => {
|
||||
os.type()
|
||||
.then((type) => document.body.classList.add(type.toLowerCase()))
|
||||
@@ -210,7 +192,7 @@ export default function App() {
|
||||
}, []);
|
||||
}
|
||||
|
||||
if (isTauri) {
|
||||
if (window.__TAURI_METADATA__) {
|
||||
useEffect(() => {
|
||||
const unlisten = listen(
|
||||
'server-status',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getCurrent } from '@tauri-apps/api/webviewWindow';
|
||||
import { getCurrent } from '@tauri-apps/plugin-window';
|
||||
import { ReactNode, useContext, useEffect, useState } from 'react';
|
||||
import { NavLink, useMatch } from 'react-router-dom';
|
||||
import {
|
||||
@@ -21,7 +21,7 @@ import classNames from 'classnames';
|
||||
import { QuestionIcon } from './commons/icon/QuestionIcon';
|
||||
import { useBreakpoint, useIsTauri } from '@/hooks/breakpoint';
|
||||
import { GearIcon } from './commons/icon/GearIcon';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { invoke } from '@tauri-apps/api';
|
||||
import { useTrackers } from '@/hooks/tracker';
|
||||
import { TrackersStillOnModal } from './TrackersStillOnModal';
|
||||
import { useConfig } from '@/hooks/config';
|
||||
|
||||
@@ -78,8 +78,8 @@ export const InputInside = forwardRef<
|
||||
const computedValue = disabled
|
||||
? placeholder
|
||||
: value !== undefined
|
||||
? value
|
||||
: '';
|
||||
? value
|
||||
: '';
|
||||
|
||||
return (
|
||||
<label className="flex flex-col gap-1">
|
||||
|
||||
@@ -8,20 +8,13 @@ export function TipBox({
|
||||
children,
|
||||
hideIcon = false,
|
||||
whitespace = false,
|
||||
className,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
hideIcon?: boolean;
|
||||
whitespace?: boolean;
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<div
|
||||
className={classNames(
|
||||
'flex flex-row gap-4 bg-accent-background-50 p-4 rounded-md',
|
||||
className
|
||||
)}
|
||||
>
|
||||
<div className="flex flex-row gap-4 bg-accent-background-50 p-4 rounded-md">
|
||||
<div
|
||||
className={classNames(
|
||||
'fill-accent-background-20 flex flex-col justify-center',
|
||||
|
||||
@@ -102,8 +102,8 @@ export function CalibrationTutorialPage() {
|
||||
isCounting
|
||||
? (IMU_CALIBRATION_TIME - timer) / IMU_CALIBRATION_TIME
|
||||
: calibrationStatus === CalibrationStatus.SUCCESS
|
||||
? 1
|
||||
: 0
|
||||
? 1
|
||||
: 0
|
||||
}
|
||||
height={14}
|
||||
animated={true}
|
||||
|
||||
@@ -153,10 +153,10 @@ export function ConnectTrackersPage() {
|
||||
{l10n.getString('onboarding-connect_tracker-title')}
|
||||
</Typography>
|
||||
<Typography color="secondary">
|
||||
{l10n.getString('onboarding-connect_tracker-description-p0-v1')}
|
||||
{l10n.getString('onboarding-connect_tracker-description-p0')}
|
||||
</Typography>
|
||||
<Typography color="secondary">
|
||||
{l10n.getString('onboarding-connect_tracker-description-p1-v1')}
|
||||
{l10n.getString('onboarding-connect_tracker-description-p1')}
|
||||
</Typography>
|
||||
<div className="flex flex-col gap-2 py-5">
|
||||
{/* <ArrowLink
|
||||
@@ -234,8 +234,8 @@ export function ConnectTrackersPage() {
|
||||
state.alonePage
|
||||
? '/'
|
||||
: bnoExists
|
||||
? '/onboarding/calibration-tutorial'
|
||||
: '/onboarding/assign-tutorial'
|
||||
? '/onboarding/calibration-tutorial'
|
||||
: '/onboarding/assign-tutorial'
|
||||
}
|
||||
className="ml-auto"
|
||||
>
|
||||
|
||||
@@ -13,7 +13,7 @@ import { Recording } from './autobone-steps/Recording';
|
||||
import { StartRecording } from './autobone-steps/StartRecording';
|
||||
import { VerifyResultsStep } from './autobone-steps/VerifyResults';
|
||||
import { useCountdown } from '@/hooks/countdown';
|
||||
import { CheckHeight } from './autobone-steps/CheckHeight';
|
||||
import { CheckHeight } from './autobone-steps/СheckHeight';
|
||||
import { PreparationStep } from './autobone-steps/Preparation';
|
||||
|
||||
export function AutomaticProportionsPage() {
|
||||
@@ -62,7 +62,7 @@ export function AutomaticProportionsPage() {
|
||||
></StepperSlider>
|
||||
</div>
|
||||
</div>
|
||||
<div className="w-full pb-4 flex flex-row mobile:justify-center">
|
||||
<div className="w-full pb-4 flex flex-grow flex-row mobile:justify-center">
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={startCountdown}
|
||||
|
||||
@@ -53,15 +53,13 @@ export function ManualProportionsPage() {
|
||||
|
||||
const savedValue = useMemo(() => localStorage.getItem('ratioMode'), []);
|
||||
|
||||
const defaultValues = { precise: false, ratio: savedValue !== 'false' };
|
||||
|
||||
const { control, watch } = useForm<{ precise: boolean; ratio: boolean }>({
|
||||
defaultValues,
|
||||
defaultValues: { precise: false, ratio: savedValue !== 'false' },
|
||||
});
|
||||
const { precise, ratio } = watch();
|
||||
|
||||
useEffect(() => {
|
||||
localStorage.setItem('ratioMode', ratio?.toString() ?? 'true');
|
||||
localStorage.setItem('ratioMode', ratio.toString());
|
||||
}, [ratio]);
|
||||
|
||||
return (
|
||||
@@ -96,7 +94,7 @@ export function ManualProportionsPage() {
|
||||
</div>
|
||||
<div className="w-full px-2">
|
||||
<BodyProportions
|
||||
precise={precise ?? defaultValues.precise}
|
||||
precise={precise}
|
||||
type={ratio ? 'ratio' : 'linear'}
|
||||
variant={state.alonePage ? 'alone' : 'onboarding'}
|
||||
></BodyProportions>
|
||||
|
||||
@@ -93,7 +93,7 @@ export function Recording({
|
||||
)}
|
||||
</Typography>
|
||||
</div>
|
||||
<ol className="list-decimal mobile:px-4 nsmol:hidden">
|
||||
<ol className="list-decimal mobile:px-4">
|
||||
<>
|
||||
{l10n
|
||||
.getString('onboarding-automatic_proportions-recording-steps')
|
||||
|
||||
+3
-6
@@ -44,7 +44,7 @@ export function StartRecording({
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="flex flex-col flex-grow gap-3">
|
||||
<div className="flex flex-col flex-grow">
|
||||
<div className="flex flex-row flex-grow">
|
||||
<div className="flex flex-grow flex-col gap-4">
|
||||
<Typography variant="main-title" bold>
|
||||
@@ -59,7 +59,7 @@ export function StartRecording({
|
||||
)}
|
||||
</Typography>
|
||||
</div>
|
||||
<ol className="list-decimal mobile:px-4 nsmol:hidden">
|
||||
<ol className="list-decimal mobile:px-4">
|
||||
<>
|
||||
{l10n
|
||||
.getString('onboarding-automatic_proportions-recording-steps')
|
||||
@@ -71,7 +71,7 @@ export function StartRecording({
|
||||
))}
|
||||
</>
|
||||
</ol>
|
||||
<div className="flex nsmol:hidden">
|
||||
<div className="flex">
|
||||
<TipBox>{l10n.getString('tips-do_not_move_heels')}</TipBox>
|
||||
</div>
|
||||
</div>
|
||||
@@ -100,9 +100,6 @@ export function StartRecording({
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="flex smol:hidden">
|
||||
<TipBox>{l10n.getString('tips-do_not_move_heels')}</TipBox>
|
||||
</div>
|
||||
<div className="flex gap-3 mobile:justify-between">
|
||||
<Button
|
||||
variant={variant === 'onboarding' ? 'secondary' : 'tertiary'}
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@ export function CheckHeight({
|
||||
'onboarding-automatic_proportions-check_height-fetch_height'
|
||||
)}
|
||||
</Button>
|
||||
<TipBox className="break-words">
|
||||
<TipBox whitespace={true}>
|
||||
{l10n.getString(
|
||||
'onboarding-automatic_proportions-check_height-guardian_tip'
|
||||
)}
|
||||
@@ -53,14 +53,16 @@ export function TrackersAssignPage() {
|
||||
const { useAssignedTrackers, trackers } = useTrackers();
|
||||
const { applyProgress, state } = useOnboarding();
|
||||
const { sendRPCPacket, useRPCPacket } = useWebsocketAPI();
|
||||
const defaultValues = {
|
||||
advanced: config?.advancedAssign ?? false,
|
||||
mirrorView: config?.mirrorView ?? true,
|
||||
};
|
||||
|
||||
const { control, watch } = useForm<{
|
||||
advanced: boolean;
|
||||
mirrorView: boolean;
|
||||
}>({ defaultValues });
|
||||
}>({
|
||||
defaultValues: {
|
||||
advanced: config?.advancedAssign ?? false,
|
||||
mirrorView: config?.mirrorView ?? true,
|
||||
},
|
||||
});
|
||||
const { advanced, mirrorView } = watch();
|
||||
const [selectedRole, setSelectRole] = useState<BodyPart>(BodyPart.NONE);
|
||||
const assignedTrackers = useAssignedTrackers();
|
||||
@@ -342,8 +344,8 @@ export function TrackersAssignPage() {
|
||||
onlyAssigned={false}
|
||||
highlightedRoles={firstError?.affectedRoles || []}
|
||||
rolesWithErrors={rolesWithErrors}
|
||||
advanced={advanced ?? defaultValues.advanced}
|
||||
mirror={mirrorView ?? defaultValues.mirrorView}
|
||||
advanced={advanced}
|
||||
mirror={mirrorView}
|
||||
onRoleSelected={tryOpenChokerWarning}
|
||||
></BodyAssignment>
|
||||
</div>
|
||||
|
||||
@@ -48,12 +48,12 @@ export function HandsWarningModal({
|
||||
</Localized>
|
||||
|
||||
<div className="flex flex-row gap-3 pt-5 place-content-center">
|
||||
<Button variant="primary" onClick={onClose}>
|
||||
<Button variant="secondary" onClick={onClose}>
|
||||
{l10n.getString(
|
||||
'settings-general-steamvr-trackers-hands-warning-cancel'
|
||||
)}
|
||||
</Button>
|
||||
<Button variant="tertiary" onClick={accept}>
|
||||
<Button variant="primary" onClick={accept}>
|
||||
{l10n.getString(
|
||||
'settings-general-steamvr-trackers-hands-warning-done'
|
||||
)}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Localized, useLocalization } from '@fluent/react';
|
||||
import { useLocalization } from '@fluent/react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { DefaultValues, useForm } from 'react-hook-form';
|
||||
import {
|
||||
@@ -36,15 +36,11 @@ interface SettingsForm {
|
||||
trackers: {
|
||||
waist: boolean;
|
||||
chest: boolean;
|
||||
feet: boolean;
|
||||
knees: boolean;
|
||||
elbows: boolean;
|
||||
hands: boolean;
|
||||
automaticTrackerToggle: boolean;
|
||||
leftFoot: boolean;
|
||||
rightFoot: boolean;
|
||||
leftKnee: boolean;
|
||||
rightKnee: boolean;
|
||||
leftElbow: boolean;
|
||||
rightElbow: boolean;
|
||||
leftHand: boolean;
|
||||
rightHand: boolean;
|
||||
};
|
||||
filtering: {
|
||||
type: number;
|
||||
@@ -94,24 +90,17 @@ interface SettingsForm {
|
||||
resetsSettings: {
|
||||
resetMountingFeet: boolean;
|
||||
armsMountingResetMode: number;
|
||||
yawResetSmoothTime: number;
|
||||
saveMountingReset: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
const defaultValues: SettingsForm = {
|
||||
const defaultValues = {
|
||||
trackers: {
|
||||
waist: false,
|
||||
chest: false,
|
||||
automaticTrackerToggle: true,
|
||||
leftFoot: false,
|
||||
rightFoot: false,
|
||||
leftElbow: false,
|
||||
rightElbow: false,
|
||||
leftHand: false,
|
||||
rightHand: false,
|
||||
leftKnee: false,
|
||||
rightKnee: false,
|
||||
elbows: false,
|
||||
knees: false,
|
||||
feet: false,
|
||||
hands: false,
|
||||
},
|
||||
toggles: {
|
||||
extendedSpine: true,
|
||||
@@ -156,8 +145,6 @@ const defaultValues: SettingsForm = {
|
||||
resetsSettings: {
|
||||
resetMountingFeet: false,
|
||||
armsMountingResetMode: 0,
|
||||
yawResetSmoothTime: 0.0,
|
||||
saveMountingReset: false,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -172,24 +159,14 @@ export function GeneralSettings() {
|
||||
style: 'percent',
|
||||
maximumFractionDigits: 0,
|
||||
});
|
||||
const secondsFormat = new Intl.NumberFormat(currentLocales, {
|
||||
style: 'unit',
|
||||
unit: 'second',
|
||||
unitDisplay: 'narrow',
|
||||
maximumFractionDigits: 2,
|
||||
});
|
||||
|
||||
const { sendRPCPacket, useRPCPacket } = useWebsocketAPI();
|
||||
const { reset, control, watch, handleSubmit, getValues, setValue } =
|
||||
useForm<SettingsForm>({
|
||||
defaultValues,
|
||||
defaultValues: defaultValues,
|
||||
});
|
||||
const {
|
||||
trackers: {
|
||||
automaticTrackerToggle,
|
||||
leftHand: steamVrLeftHand,
|
||||
rightHand: steamVrRightHand,
|
||||
},
|
||||
trackers: { automaticTrackerToggle, hands: steamVrHands },
|
||||
} = watch();
|
||||
|
||||
const onSubmit = (values: SettingsForm) => {
|
||||
@@ -199,18 +176,10 @@ export function GeneralSettings() {
|
||||
const trackers = new SteamVRTrackersSettingT();
|
||||
trackers.waist = values.trackers.waist;
|
||||
trackers.chest = values.trackers.chest;
|
||||
trackers.leftFoot = values.trackers.leftFoot;
|
||||
trackers.rightFoot = values.trackers.rightFoot;
|
||||
|
||||
trackers.leftKnee = values.trackers.leftKnee;
|
||||
trackers.rightKnee = values.trackers.rightKnee;
|
||||
|
||||
trackers.leftElbow = values.trackers.leftElbow;
|
||||
trackers.rightElbow = values.trackers.rightElbow;
|
||||
|
||||
trackers.leftHand = values.trackers.leftHand;
|
||||
trackers.rightHand = values.trackers.rightHand;
|
||||
|
||||
trackers.feet = values.trackers.feet;
|
||||
trackers.knees = values.trackers.knees;
|
||||
trackers.elbows = values.trackers.elbows;
|
||||
trackers.hands = values.trackers.hands;
|
||||
trackers.automaticTrackerToggle = values.trackers.automaticTrackerToggle;
|
||||
settings.steamVrTrackers = trackers;
|
||||
}
|
||||
@@ -290,10 +259,6 @@ export function GeneralSettings() {
|
||||
values.resetsSettings.resetMountingFeet;
|
||||
resetsSettings.armsMountingResetMode =
|
||||
values.resetsSettings.armsMountingResetMode;
|
||||
resetsSettings.yawResetSmoothTime =
|
||||
values.resetsSettings.yawResetSmoothTime;
|
||||
resetsSettings.saveMountingReset =
|
||||
values.resetsSettings.saveMountingReset;
|
||||
settings.resetsSettings = resetsSettings;
|
||||
}
|
||||
|
||||
@@ -325,10 +290,7 @@ export function GeneralSettings() {
|
||||
|
||||
if (settings.steamVrTrackers) {
|
||||
formData.trackers = settings.steamVrTrackers;
|
||||
if (
|
||||
settings.steamVrTrackers.leftHand &&
|
||||
settings.steamVrTrackers.rightHand
|
||||
) {
|
||||
if (settings.steamVrTrackers.hands) {
|
||||
setHandsWarning(false);
|
||||
}
|
||||
}
|
||||
@@ -410,15 +372,12 @@ export function GeneralSettings() {
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if ((steamVrLeftHand || steamVrRightHand) && handsWarning === null) {
|
||||
if (steamVrHands && handsWarning === null) {
|
||||
setHandsWarning(true);
|
||||
} else if (
|
||||
!(steamVrLeftHand || steamVrRightHand) &&
|
||||
handsWarning === false
|
||||
) {
|
||||
} else if (!steamVrHands && handsWarning === false) {
|
||||
setHandsWarning(null);
|
||||
}
|
||||
}, [steamVrLeftHand, steamVrRightHand, handsWarning]);
|
||||
}, [steamVrHands, handsWarning]);
|
||||
|
||||
// Handle scrolling to selected page
|
||||
// useEffect(() => {
|
||||
@@ -437,13 +396,11 @@ export function GeneralSettings() {
|
||||
<HandsWarningModal
|
||||
isOpen={!!handsWarning}
|
||||
onClose={() => {
|
||||
setValue('trackers.leftHand', false);
|
||||
setValue('trackers.rightHand', false);
|
||||
setValue('trackers.hands', false);
|
||||
setHandsWarning(null);
|
||||
}}
|
||||
accept={() => {
|
||||
setValue('trackers.leftHand', true);
|
||||
setValue('trackers.rightHand', true);
|
||||
setValue('trackers.hands', true);
|
||||
setHandsWarning(false);
|
||||
}}
|
||||
/>
|
||||
@@ -492,9 +449,9 @@ export function GeneralSettings() {
|
||||
outlined
|
||||
disabled={automaticTrackerToggle}
|
||||
control={control}
|
||||
name="trackers.leftKnee"
|
||||
name="trackers.knees"
|
||||
label={l10n.getString(
|
||||
'settings-general-steamvr-trackers-left_knee'
|
||||
'settings-general-steamvr-trackers-knees'
|
||||
)}
|
||||
/>
|
||||
<CheckBox
|
||||
@@ -502,67 +459,26 @@ export function GeneralSettings() {
|
||||
outlined
|
||||
disabled={automaticTrackerToggle}
|
||||
control={control}
|
||||
name="trackers.rightKnee"
|
||||
label={l10n.getString(
|
||||
'settings-general-steamvr-trackers-right_knee'
|
||||
)}
|
||||
name="trackers.feet"
|
||||
label={l10n.getString('settings-general-steamvr-trackers-feet')}
|
||||
/>
|
||||
<CheckBox
|
||||
variant="toggle"
|
||||
outlined
|
||||
disabled={automaticTrackerToggle}
|
||||
control={control}
|
||||
name="trackers.leftFoot"
|
||||
name="trackers.elbows"
|
||||
label={l10n.getString(
|
||||
'settings-general-steamvr-trackers-left_foot'
|
||||
)}
|
||||
/>
|
||||
<CheckBox
|
||||
variant="toggle"
|
||||
outlined
|
||||
disabled={automaticTrackerToggle}
|
||||
control={control}
|
||||
name="trackers.rightFoot"
|
||||
label={l10n.getString(
|
||||
'settings-general-steamvr-trackers-right_foot'
|
||||
)}
|
||||
/>
|
||||
<CheckBox
|
||||
variant="toggle"
|
||||
outlined
|
||||
disabled={automaticTrackerToggle}
|
||||
control={control}
|
||||
name="trackers.leftElbow"
|
||||
label={l10n.getString(
|
||||
'settings-general-steamvr-trackers-left_elbow'
|
||||
)}
|
||||
/>
|
||||
<CheckBox
|
||||
variant="toggle"
|
||||
outlined
|
||||
disabled={automaticTrackerToggle}
|
||||
control={control}
|
||||
name="trackers.rightElbow"
|
||||
label={l10n.getString(
|
||||
'settings-general-steamvr-trackers-right_elbow'
|
||||
'settings-general-steamvr-trackers-elbows'
|
||||
)}
|
||||
/>
|
||||
<CheckBox
|
||||
variant="toggle"
|
||||
outlined
|
||||
control={control}
|
||||
name="trackers.leftHand"
|
||||
name="trackers.hands"
|
||||
label={l10n.getString(
|
||||
'settings-general-steamvr-trackers-left_hand'
|
||||
)}
|
||||
/>
|
||||
<CheckBox
|
||||
variant="toggle"
|
||||
outlined
|
||||
control={control}
|
||||
name="trackers.rightHand"
|
||||
label={l10n.getString(
|
||||
'settings-general-steamvr-trackers-right_hand'
|
||||
'settings-general-steamvr-trackers-hands'
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
@@ -720,41 +636,6 @@ export function GeneralSettings() {
|
||||
step={1}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex gap-5 pt-5 md:flex-row flex-col">
|
||||
<NumberSelector
|
||||
control={control}
|
||||
name="resetsSettings.yawResetSmoothTime"
|
||||
label={l10n.getString(
|
||||
'settings-general-tracker_mechanics-yaw-reset-smooth-time'
|
||||
)}
|
||||
valueLabelFormat={(value) => secondsFormat.format(value)}
|
||||
min={0.0}
|
||||
max={0.5}
|
||||
step={0.05}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-col pt-5 pb-3">
|
||||
<Typography bold>
|
||||
{l10n.getString(
|
||||
'settings-general-tracker_mechanics-save_mounting_reset'
|
||||
)}
|
||||
</Typography>
|
||||
<Localized
|
||||
id="settings-general-tracker_mechanics-save_mounting_reset-description"
|
||||
elems={{ b: <b></b> }}
|
||||
>
|
||||
<Typography color="secondary"></Typography>
|
||||
</Localized>
|
||||
</div>
|
||||
<CheckBox
|
||||
variant="toggle"
|
||||
outlined
|
||||
control={control}
|
||||
name="resetsSettings.saveMountingReset"
|
||||
label={l10n.getString(
|
||||
'settings-general-tracker_mechanics-save_mounting_reset-enabled-label'
|
||||
)}
|
||||
/>
|
||||
</>
|
||||
</SettingsPagePaneLayout>
|
||||
<SettingsPagePaneLayout
|
||||
@@ -1205,7 +1086,7 @@ export function GeneralSettings() {
|
||||
label={l10n.getString(
|
||||
'settings-general-gesture_control-yawResetDelay'
|
||||
)}
|
||||
valueLabelFormat={(value) => secondsFormat.format(value)}
|
||||
valueLabelFormat={(value) => `${Math.round(value * 10) / 10} s`}
|
||||
min={0.2}
|
||||
max={3.0}
|
||||
step={0.2}
|
||||
@@ -1216,7 +1097,7 @@ export function GeneralSettings() {
|
||||
label={l10n.getString(
|
||||
'settings-general-gesture_control-fullResetDelay'
|
||||
)}
|
||||
valueLabelFormat={(value) => secondsFormat.format(value)}
|
||||
valueLabelFormat={(value) => `${Math.round(value * 10) / 10} s`}
|
||||
min={0.2}
|
||||
max={3.0}
|
||||
step={0.2}
|
||||
@@ -1227,7 +1108,7 @@ export function GeneralSettings() {
|
||||
label={l10n.getString(
|
||||
'settings-general-gesture_control-mountingResetDelay'
|
||||
)}
|
||||
valueLabelFormat={(value) => secondsFormat.format(value)}
|
||||
valueLabelFormat={(value) => `${Math.round(value * 10) / 10} s`}
|
||||
min={0.2}
|
||||
max={3.0}
|
||||
step={0.2}
|
||||
|
||||
@@ -52,9 +52,8 @@ export function Serial() {
|
||||
|
||||
const [tryFactoryReset, setTryFactoryReset] = useState(false);
|
||||
|
||||
const defaultValues = { port: 'Auto' };
|
||||
const { control, watch, handleSubmit, reset } = useForm<SerialForm>({
|
||||
defaultValues,
|
||||
defaultValues: { port: 'Auto' },
|
||||
});
|
||||
|
||||
const { port } = watch();
|
||||
@@ -129,7 +128,7 @@ export function Serial() {
|
||||
useEffect(() => {
|
||||
const id = setInterval(() => {
|
||||
if (!isSerialOpen) {
|
||||
openSerial(port ?? defaultValues.port);
|
||||
openSerial(port);
|
||||
} else {
|
||||
clearInterval(id);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ export function VMCSettings() {
|
||||
};
|
||||
|
||||
const { reset, control, watch, handleSubmit } = useForm<VMCSettingsForm>({
|
||||
defaultValues,
|
||||
defaultValues: defaultValues,
|
||||
});
|
||||
|
||||
const onSubmit = async (values: VMCSettingsForm) => {
|
||||
|
||||
@@ -65,7 +65,7 @@ export function VRCOSCSettings() {
|
||||
const { sendRPCPacket, useRPCPacket } = useWebsocketAPI();
|
||||
|
||||
const { reset, control, watch, handleSubmit } = useForm<VRCOSCSettingsForm>({
|
||||
defaultValues,
|
||||
defaultValues: defaultValues,
|
||||
});
|
||||
|
||||
const onSubmit = (values: VRCOSCSettingsForm) => {
|
||||
|
||||
@@ -24,8 +24,9 @@ export function SingleTrackerBodyAssignmentMenu({
|
||||
const { isMobile } = useBreakpoint('mobile');
|
||||
const { l10n } = useLocalization();
|
||||
const { config } = useConfig();
|
||||
const defaultValues = { advanced: false };
|
||||
const { control, watch } = useForm<{ advanced: boolean }>({ defaultValues });
|
||||
const { control, watch } = useForm<{ advanced: boolean }>({
|
||||
defaultValues: { advanced: false },
|
||||
});
|
||||
const { advanced } = watch();
|
||||
|
||||
const { closeChokerWarning, tryOpenChokerWarning, shouldShowChokerWarn } =
|
||||
@@ -79,7 +80,7 @@ export function SingleTrackerBodyAssignmentMenu({
|
||||
mirror={config?.mirrorView ?? defaultConfig.mirrorView}
|
||||
width={isMobile ? 160 : undefined}
|
||||
onlyAssigned={false}
|
||||
advanced={advanced ?? defaultValues.advanced}
|
||||
advanced={advanced}
|
||||
onRoleSelected={tryOpenChokerWarning}
|
||||
></BodyAssignment>
|
||||
<div className="flex justify-center">
|
||||
|
||||
@@ -117,7 +117,7 @@ export function TrackerSettingsPage() {
|
||||
? MountingOrientationDegreesToQuatT(currRotation)
|
||||
: null;
|
||||
|
||||
assignreq.displayName = trackerName ?? null;
|
||||
assignreq.displayName = trackerName;
|
||||
assignreq.trackerId = tracker?.tracker.trackerId;
|
||||
assignreq.allowDriftCompensation = allowDriftCompensation;
|
||||
sendRPCPacket(RpcMessage.AssignTrackerRequest, assignreq);
|
||||
@@ -275,14 +275,6 @@ export function TrackerSettingsPage() {
|
||||
{tracker?.device?.hardwareInfo?.boardType || '--'}
|
||||
</Typography>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<Typography color="secondary">
|
||||
{l10n.getString('tracker-infos-network_version')}
|
||||
</Typography>
|
||||
<Typography>
|
||||
{tracker?.device?.hardwareInfo?.networkProtocolVersion || '--'}
|
||||
</Typography>
|
||||
</div>
|
||||
</div>
|
||||
{tracker?.tracker && (
|
||||
<IMUVisualizerWidget
|
||||
|
||||
@@ -24,9 +24,5 @@ export function useBreakpoint<K extends BreakpointKey>(breakpointKey: K) {
|
||||
}
|
||||
|
||||
export function useIsTauri() {
|
||||
if ('__TAURI_INTERNALS__' in window) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return !!window.__TAURI_METADATA__;
|
||||
}
|
||||
+12
-32
@@ -36,7 +36,6 @@ export interface ConfigContext {
|
||||
loading: boolean;
|
||||
setConfig: (config: Partial<Config>) => Promise<void>;
|
||||
loadConfig: () => Promise<Config | null>;
|
||||
saveConfig: () => Promise<void>;
|
||||
}
|
||||
|
||||
export const defaultConfig: Omit<Config, 'devSettings'> = {
|
||||
@@ -97,33 +96,18 @@ export function useConfigProvider(): ConfigContext {
|
||||
} as Config)
|
||||
: null
|
||||
);
|
||||
if (tauri) {
|
||||
await waitUntil(
|
||||
async () => {
|
||||
const newConfig: Partial<Config> = JSON.parse(
|
||||
(await store.get('config.json')) ?? '{}'
|
||||
);
|
||||
return Object.entries(config).every(
|
||||
([key, value]) => newConfig[key as keyof Config] === value
|
||||
);
|
||||
},
|
||||
100,
|
||||
10
|
||||
);
|
||||
} else {
|
||||
await waitUntil(
|
||||
() => {
|
||||
const newConfig: Partial<Config> = JSON.parse(
|
||||
localStorage.getItem('config.json') ?? '{}'
|
||||
);
|
||||
return Object.entries(config).every(
|
||||
([key, value]) => newConfig[key as keyof Config] === value
|
||||
);
|
||||
},
|
||||
100,
|
||||
10
|
||||
);
|
||||
}
|
||||
await waitUntil(
|
||||
() => {
|
||||
const newConfig: Partial<Config> = JSON.parse(
|
||||
localStorage.getItem('config.json') ?? '{}'
|
||||
);
|
||||
return Object.entries(config).every(
|
||||
([key, value]) => newConfig[key as keyof Config] === value
|
||||
);
|
||||
},
|
||||
100,
|
||||
10
|
||||
);
|
||||
};
|
||||
|
||||
return {
|
||||
@@ -158,10 +142,6 @@ export function useConfigProvider(): ConfigContext {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
saveConfig: async () => {
|
||||
if (!tauri) return;
|
||||
await (store as Store).save();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ export function useLayout<T extends HTMLElement>() {
|
||||
window.removeEventListener('focus', onWindowResize);
|
||||
window.removeEventListener('resize', onWindowResize);
|
||||
};
|
||||
}, []);
|
||||
});
|
||||
|
||||
return {
|
||||
layoutHeight,
|
||||
|
||||
@@ -148,8 +148,8 @@ export function parseStatusToLocale(
|
||||
const name = tracker.tracker.info?.customName
|
||||
? tracker.tracker.info?.customName
|
||||
: tracker.tracker.info?.bodyPart
|
||||
? l10n.getString('body_part-' + BodyPart[tracker.tracker.info?.bodyPart])
|
||||
: tracker.tracker.info?.displayName || 'unknown';
|
||||
? l10n.getString('body_part-' + BodyPart[tracker.tracker.info?.bodyPart])
|
||||
: tracker.tracker.info?.displayName || 'unknown';
|
||||
if (typeof name !== 'string') {
|
||||
return {
|
||||
trackerName: new TextDecoder().decode(name),
|
||||
@@ -157,8 +157,6 @@ export function parseStatusToLocale(
|
||||
}
|
||||
return { trackerName: name };
|
||||
}
|
||||
case StatusData.StatusUnassignedHMD:
|
||||
return { trackerName: 'Not implemented.' }; // TODO
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
} from 'react';
|
||||
import { exists, readTextFile, BaseDirectory } from '@tauri-apps/plugin-fs';
|
||||
import { error } from '@/utils/logging';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { invoke } from '@tauri-apps/api';
|
||||
|
||||
export const defaultNS = 'translation';
|
||||
export const DEFAULT_LOCALE = 'en';
|
||||
@@ -172,7 +172,7 @@ export function AppLocalizationProvider(props: AppLocalizationProviderProps) {
|
||||
? [
|
||||
currentLocale,
|
||||
await readTextFile(OVERRIDE_FILENAME, {
|
||||
baseDir: BaseDirectory.AppConfig,
|
||||
dir: BaseDirectory.AppConfig,
|
||||
}),
|
||||
]
|
||||
: await fetchMessages(currentLocale);
|
||||
|
||||
+4
-18
@@ -1,5 +1,3 @@
|
||||
import { error } from './logging';
|
||||
|
||||
export function a11yClick(event: React.KeyboardEvent | React.MouseEvent) {
|
||||
if (event.type === 'click') {
|
||||
return true;
|
||||
@@ -10,30 +8,18 @@ export function a11yClick(event: React.KeyboardEvent | React.MouseEvent) {
|
||||
}
|
||||
|
||||
export function waitUntil(
|
||||
condition: (() => boolean) | (() => Promise<boolean>),
|
||||
condition: () => boolean,
|
||||
time: number,
|
||||
tries?: number
|
||||
): Promise<void> {
|
||||
return new Promise((resolve, rej) => {
|
||||
const isPromise = typeof condition() === 'boolean';
|
||||
return new Promise((resolve) => {
|
||||
const interval = setInterval(() => {
|
||||
if (tries && --tries === 0) {
|
||||
error(new Error('waitUntil ran out of tries'));
|
||||
clearInterval(interval);
|
||||
resolve();
|
||||
}
|
||||
const boolPromise = condition();
|
||||
if (!isPromise && boolPromise) {
|
||||
clearInterval(interval);
|
||||
if (condition()) {
|
||||
resolve();
|
||||
} else if (isPromise) {
|
||||
(boolPromise as Promise<boolean>)
|
||||
.then((bool) => {
|
||||
if (!bool) return;
|
||||
clearInterval(interval);
|
||||
resolve();
|
||||
})
|
||||
.catch(rej);
|
||||
clearInterval(interval);
|
||||
}
|
||||
}, time);
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { invoke } from '@tauri-apps/api';
|
||||
|
||||
export function log(...msgs: any[]) {
|
||||
console.log(...msgs);
|
||||
|
||||
+12
-13
@@ -1,7 +1,7 @@
|
||||
import plugin from 'tailwindcss/plugin';
|
||||
import forms from '@tailwindcss/forms';
|
||||
import gradient from 'tailwind-gradient-mask-image';
|
||||
import type { Config } from 'tailwindcss';
|
||||
import plugin from 'tailwindcss/plugin'
|
||||
import forms from '@tailwindcss/forms'
|
||||
import gradient from 'tailwind-gradient-mask-image'
|
||||
import type { Config } from 'tailwindcss'
|
||||
|
||||
const colors = {
|
||||
'blue-gray': {
|
||||
@@ -156,8 +156,6 @@ const config = {
|
||||
content: ['./src/**/*.{js,jsx,ts,tsx}'],
|
||||
theme: {
|
||||
screens: {
|
||||
nsmol: { raw: 'not (min-width: 525px)' },
|
||||
smol: '525px',
|
||||
mobile: { raw: 'not (min-width: 800px)' },
|
||||
xs: '800px',
|
||||
sm: '900px',
|
||||
@@ -165,7 +163,7 @@ const config = {
|
||||
'md-max': { raw: 'not (min-width: 1100px)' },
|
||||
lg: '1300px',
|
||||
xl: '1600px',
|
||||
tall: { raw: '(min-height: 800px)' },
|
||||
tall: { raw: '(min-height: 800px)'}
|
||||
},
|
||||
extend: {
|
||||
colors: {
|
||||
@@ -231,13 +229,14 @@ const config = {
|
||||
},
|
||||
},
|
||||
data: {
|
||||
checked: 'checked=true',
|
||||
},
|
||||
checked: 'checked=true'
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
forms,
|
||||
gradient,
|
||||
plugin(function ({ addUtilities }) {
|
||||
|
||||
const textConfig = (fontSize: any, fontWeight: any) => ({
|
||||
fontSize,
|
||||
fontWeight,
|
||||
@@ -252,10 +251,10 @@ const config = {
|
||||
'.text-standard-bold': textConfig('calc(var(--font-size-standard) / 16)', 700),
|
||||
});
|
||||
}),
|
||||
plugin(function ({ addVariant }) {
|
||||
addVariant('checked-hover', ['&:hover', '&[data-checked=true]']);
|
||||
}),
|
||||
plugin(function({ addVariant }) {
|
||||
addVariant('checked-hover', ['&:hover', '&[data-checked=true]'])
|
||||
})
|
||||
],
|
||||
} satisfies Config;
|
||||
} satisfies Config
|
||||
|
||||
export default config;
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
"name": "slimevr-ui",
|
||||
"version": "0.5.1",
|
||||
"private": true,
|
||||
"packageManager": "[email protected]5.5",
|
||||
"packageManager": "[email protected]0.5",
|
||||
"workspaces": [
|
||||
"solarxr-protocol",
|
||||
"gui"
|
||||
@@ -18,6 +18,6 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"husky": "^8.0.3",
|
||||
"lint-staged": "^13.3.0"
|
||||
"lint-staged": "^13.2.3"
|
||||
}
|
||||
}
|
||||
Generated
+1306
-2767
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -1,4 +1,4 @@
|
||||
[toolchain]
|
||||
channel = "1.77.1"
|
||||
channel = "1.73"
|
||||
profile = "default"
|
||||
components = ["rust-analyzer", "rust-src"]
|
||||
@@ -74,20 +74,9 @@ class AutoBone(server: VRServer) {
|
||||
// Remove all previous values
|
||||
offsets.clear()
|
||||
|
||||
// Get current or default skeleton configs
|
||||
val skeleton = server.humanPoseManager
|
||||
// Still compensate for a null skeleton, as it may not be initialized yet
|
||||
val getOffset: Function<SkeletonConfigOffsets, Float> =
|
||||
if (skeleton != null) {
|
||||
Function { key: SkeletonConfigOffsets -> skeleton.getOffset(key) }
|
||||
} else {
|
||||
val defaultConfig = SkeletonConfigManager(false)
|
||||
Function { config: SkeletonConfigOffsets ->
|
||||
defaultConfig.getOffset(config)
|
||||
}
|
||||
}
|
||||
// Get current skeleton configs
|
||||
for (bone in adjustOffsets) {
|
||||
val offset = getOffset.apply(bone)
|
||||
val offset = server.humanPoseManager.getOffset(bone)
|
||||
if (offset > 0f) {
|
||||
offsets[bone] = offset
|
||||
}
|
||||
@@ -154,18 +143,15 @@ class AutoBone(server: VRServer) {
|
||||
val targetHeight: Float
|
||||
// Get the current skeleton from the server
|
||||
val humanPoseManager = server.humanPoseManager
|
||||
// Still compensate for a null skeleton, as it may not be initialized yet
|
||||
if (config.useSkeletonHeight && humanPoseManager != null) {
|
||||
// If there is a skeleton available, calculate the target height
|
||||
// from its configs
|
||||
if (config.useSkeletonHeight) {
|
||||
// calculate the target height from the skeleton configs
|
||||
targetHeight = humanPoseManager.userHeightFromConfig
|
||||
LogManager
|
||||
.warning(
|
||||
"[AutoBone] Target height loaded from skeleton (Make sure you reset before running!): $targetHeight",
|
||||
)
|
||||
} else {
|
||||
// Otherwise if there is no skeleton available, attempt to get the
|
||||
// max HMD height from the recording
|
||||
// Otherwise, attempt to get the max HMD height from the recording
|
||||
val hmdHeight = frames.maxHmdHeight
|
||||
if (hmdHeight <= 0.4f) {
|
||||
LogManager
|
||||
|
||||
@@ -39,7 +39,7 @@ class PositionError : IAutoBoneError {
|
||||
val position = trackerFrame.tryGetPosition() ?: continue
|
||||
val trackerRole = trackerFrame.tryGetTrackerPosition()?.trackerRole ?: continue
|
||||
|
||||
val computedTracker = skeleton.getComputedTracker(trackerRole) ?: continue
|
||||
val computedTracker = skeleton.getComputedTracker(trackerRole)
|
||||
|
||||
offset += (position - computedTracker.position).len()
|
||||
offsetCount++
|
||||
|
||||
@@ -37,8 +37,8 @@ class PositionOffsetError : IAutoBoneError {
|
||||
val position2 = trackerFrame2.tryGetPosition() ?: continue
|
||||
val trackerRole2 = trackerFrame2.tryGetTrackerPosition()?.trackerRole ?: continue
|
||||
|
||||
val computedTracker1 = skeleton1.getComputedTracker(trackerRole1) ?: continue
|
||||
val computedTracker2 = skeleton2.getComputedTracker(trackerRole2) ?: continue
|
||||
val computedTracker1 = skeleton1.getComputedTracker(trackerRole1)
|
||||
val computedTracker2 = skeleton2.getComputedTracker(trackerRole2)
|
||||
|
||||
val dist1 = (position1 - computedTracker1.position).len()
|
||||
val dist2 = (position2 - computedTracker2.position).len()
|
||||
|
||||
@@ -37,16 +37,10 @@ class ResetsConfig {
|
||||
// Reset mode used for the arms
|
||||
var mode = ArmsResetModes.BACK
|
||||
|
||||
// Yaw reset smoothing time in seconds
|
||||
var yawResetSmoothTime = 0.0f
|
||||
|
||||
// Save automatic mounting reset calibration
|
||||
var saveMountingReset = false
|
||||
|
||||
fun updateTrackersResetsSettings() {
|
||||
for (t in VRServer.instance.allTrackers) {
|
||||
if (t.needsReset) {
|
||||
t.resetsHandler.readResetConfig(this)
|
||||
t.resetsHandler.readArmsResetModeConfig(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ class TrackerConfig {
|
||||
var hide: Boolean = false
|
||||
var adjustment: ObjectQuaternion? = null
|
||||
var mountingOrientation: ObjectQuaternion? = null
|
||||
var mountingResetOrientation: ObjectQuaternion? = null
|
||||
var allowDriftCompensation: Boolean? = null
|
||||
|
||||
constructor()
|
||||
|
||||
@@ -101,10 +101,7 @@ class VRConfig {
|
||||
val config = getTracker(tracker)
|
||||
tracker.readConfig(config)
|
||||
if (tracker.isImu()) tracker.resetsHandler.readDriftCompensationConfig(driftCompensation)
|
||||
if (tracker.needsReset) {
|
||||
tracker.resetsHandler.readResetConfig(resetsConfig)
|
||||
tracker.saveMountingResetOrientation(config)
|
||||
}
|
||||
if (tracker.needsReset) tracker.resetsHandler.readArmsResetModeConfig(resetsConfig)
|
||||
if (tracker.allowFiltering) {
|
||||
tracker
|
||||
.filteringHandler
|
||||
|
||||
@@ -187,9 +187,6 @@ class BVHFileStream : PoseDataStream {
|
||||
val positionScale = bvhSettings.positionScale
|
||||
writer
|
||||
.write("${rootPos.x * positionScale} ${rootPos.y * positionScale} ${rootPos.z * positionScale}")
|
||||
|
||||
// Add spacing
|
||||
writer.write(" ")
|
||||
writeBoneHierarchyRotation(rootBone, null)
|
||||
|
||||
writer.newLine()
|
||||
|
||||
@@ -58,8 +58,6 @@ public class DataFeedBuilder {
|
||||
ByteBuffer.wrap(address).getInt()
|
||||
)
|
||||
);
|
||||
|
||||
HardwareInfo.addNetworkProtocolVersion(fbb, udpDevice.firmwareBuild);
|
||||
}
|
||||
|
||||
// BRUH MOMENT
|
||||
|
||||
@@ -144,7 +144,7 @@ class RPCAutoBoneHandler(
|
||||
|
||||
private fun onAutoBoneApplyRequest(
|
||||
conn: GenericConnection,
|
||||
messageHeader: RpcMessageHeader,
|
||||
@Suppress("UNUSED_PARAMETER")messageHeader: RpcMessageHeader,
|
||||
) {
|
||||
api.server.autoBoneHandler.applyValues()
|
||||
|
||||
@@ -160,15 +160,15 @@ class RPCAutoBoneHandler(
|
||||
}
|
||||
|
||||
private fun onAutoBoneStopRecordingRequest(
|
||||
conn: GenericConnection,
|
||||
messageHeader: RpcMessageHeader,
|
||||
@Suppress("UNUSED_PARAMETER")conn: GenericConnection,
|
||||
@Suppress("UNUSED_PARAMETER")messageHeader: RpcMessageHeader,
|
||||
) {
|
||||
api.server.autoBoneHandler.stopRecording()
|
||||
}
|
||||
|
||||
private fun onAutoBoneCancelRecordingRequest(
|
||||
conn: GenericConnection,
|
||||
messageHeader: RpcMessageHeader,
|
||||
@Suppress("UNUSED_PARAMETER") conn: GenericConnection,
|
||||
@Suppress("UNUSED_PARAMETER") messageHeader: RpcMessageHeader,
|
||||
) {
|
||||
api.server.autoBoneHandler.cancelRecording()
|
||||
}
|
||||
|
||||
+10
-13
@@ -156,16 +156,15 @@ public class RPCSettingsBuilder {
|
||||
fbb,
|
||||
bridge.getShareSetting(TrackerRole.WAIST),
|
||||
bridge.getShareSetting(TrackerRole.CHEST),
|
||||
bridge.getAutomaticSharedTrackers(),
|
||||
|
||||
bridge.getShareSetting(TrackerRole.LEFT_FOOT),
|
||||
bridge.getShareSetting(TrackerRole.RIGHT_FOOT),
|
||||
bridge.getShareSetting(TrackerRole.LEFT_KNEE),
|
||||
bridge.getShareSetting(TrackerRole.RIGHT_KNEE),
|
||||
bridge.getShareSetting(TrackerRole.LEFT_ELBOW),
|
||||
bridge.getShareSetting(TrackerRole.RIGHT_ELBOW),
|
||||
bridge.getShareSetting(TrackerRole.LEFT_HAND),
|
||||
bridge.getShareSetting(TrackerRole.RIGHT_HAND)
|
||||
bridge.getShareSetting(TrackerRole.LEFT_FOOT)
|
||||
&& bridge.getShareSetting(TrackerRole.RIGHT_FOOT),
|
||||
bridge.getShareSetting(TrackerRole.LEFT_KNEE)
|
||||
&& bridge.getShareSetting(TrackerRole.RIGHT_KNEE),
|
||||
bridge.getShareSetting(TrackerRole.LEFT_ELBOW)
|
||||
&& bridge.getShareSetting(TrackerRole.RIGHT_ELBOW),
|
||||
bridge.getShareSetting(TrackerRole.LEFT_HAND)
|
||||
&& bridge.getShareSetting(TrackerRole.RIGHT_HAND),
|
||||
bridge.getAutomaticSharedTrackers()
|
||||
);
|
||||
}
|
||||
return steamvrTrackerSettings;
|
||||
@@ -339,9 +338,7 @@ public class RPCSettingsBuilder {
|
||||
.createResetsSettings(
|
||||
fbb,
|
||||
resetsConfig.getResetMountingFeet(),
|
||||
resetsConfig.getMode().getId(),
|
||||
resetsConfig.getYawResetSmoothTime(),
|
||||
resetsConfig.getSaveMountingReset()
|
||||
resetsConfig.getMode().getId()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,14 +55,14 @@ class RPCSettingsHandler(var rpcHandler: RPCHandler, var api: ProtocolAPI) {
|
||||
if (bridge != null) {
|
||||
bridge.changeShareSettings(TrackerRole.WAIST, req.steamVrTrackers().waist())
|
||||
bridge.changeShareSettings(TrackerRole.CHEST, req.steamVrTrackers().chest())
|
||||
bridge.changeShareSettings(TrackerRole.LEFT_FOOT, req.steamVrTrackers().leftFoot())
|
||||
bridge.changeShareSettings(TrackerRole.RIGHT_FOOT, req.steamVrTrackers().rightFoot())
|
||||
bridge.changeShareSettings(TrackerRole.LEFT_KNEE, req.steamVrTrackers().leftKnee())
|
||||
bridge.changeShareSettings(TrackerRole.RIGHT_KNEE, req.steamVrTrackers().rightKnee())
|
||||
bridge.changeShareSettings(TrackerRole.LEFT_ELBOW, req.steamVrTrackers().leftElbow())
|
||||
bridge.changeShareSettings(TrackerRole.RIGHT_ELBOW, req.steamVrTrackers().rightElbow())
|
||||
bridge.changeShareSettings(TrackerRole.LEFT_HAND, req.steamVrTrackers().leftHand())
|
||||
bridge.changeShareSettings(TrackerRole.RIGHT_HAND, req.steamVrTrackers().rightHand())
|
||||
bridge.changeShareSettings(TrackerRole.LEFT_FOOT, req.steamVrTrackers().feet())
|
||||
bridge.changeShareSettings(TrackerRole.RIGHT_FOOT, req.steamVrTrackers().feet())
|
||||
bridge.changeShareSettings(TrackerRole.LEFT_KNEE, req.steamVrTrackers().knees())
|
||||
bridge.changeShareSettings(TrackerRole.RIGHT_KNEE, req.steamVrTrackers().knees())
|
||||
bridge.changeShareSettings(TrackerRole.LEFT_ELBOW, req.steamVrTrackers().elbows())
|
||||
bridge.changeShareSettings(TrackerRole.RIGHT_ELBOW, req.steamVrTrackers().elbows())
|
||||
bridge.changeShareSettings(TrackerRole.LEFT_HAND, req.steamVrTrackers().hands())
|
||||
bridge.changeShareSettings(TrackerRole.RIGHT_HAND, req.steamVrTrackers().hands())
|
||||
bridge.setAutomaticSharedTrackers(req.steamVrTrackers().automaticTrackerToggle())
|
||||
}
|
||||
}
|
||||
@@ -334,8 +334,6 @@ class RPCSettingsHandler(var rpcHandler: RPCHandler, var api: ProtocolAPI) {
|
||||
resetsConfig.mode = mode
|
||||
}
|
||||
resetsConfig.resetMountingFeet = req.resetsSettings().resetMountingFeet()
|
||||
resetsConfig.saveMountingReset = req.resetsSettings().saveMountingReset()
|
||||
resetsConfig.yawResetSmoothTime = req.resetsSettings().yawResetSmoothTime()
|
||||
resetsConfig.updateTrackersResetsSettings()
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ class RPCTrackingPause(private val rpcHandler: RPCHandler, private val api: Prot
|
||||
return fbb.dataBuffer()
|
||||
}
|
||||
|
||||
private fun onTrackingPauseStateRequest(conn: GenericConnection, messageHeader: RpcMessageHeader) {
|
||||
private fun onTrackingPauseStateRequest(conn: GenericConnection, @Suppress("UNUSED_PARAMETER") messageHeader: RpcMessageHeader) {
|
||||
conn.send(getPauseStateResponse(currentPauseState))
|
||||
}
|
||||
|
||||
|
||||
@@ -21,9 +21,6 @@ open class Device {
|
||||
|
||||
open val hardwareIdentifier: String = "Unknown"
|
||||
|
||||
val isOpenVrDevice: Boolean
|
||||
get() = manufacturer == "OpenVR"
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
protected val nextLocalDeviceId = AtomicInteger()
|
||||
|
||||
@@ -215,7 +215,6 @@ class Tracker @JvmOverloads constructor(
|
||||
getByDesignation(designation)?.let { trackerPosition = it }
|
||||
} ?: run { trackerPosition = null }
|
||||
if (needsMounting) {
|
||||
// Load manual mounting
|
||||
config.mountingOrientation?.let { resetsHandler.mountingOrientation = it.toValue() }
|
||||
}
|
||||
if (this.isImu() && config.allowDriftCompensation == null) {
|
||||
@@ -242,7 +241,6 @@ class Tracker @JvmOverloads constructor(
|
||||
trackerPosition?.let { config.designation = it.designation } ?: run { config.designation = null }
|
||||
customName?.let { config.customName = it }
|
||||
if (needsMounting) {
|
||||
// Save manual mounting
|
||||
config.mountingOrientation = resetsHandler.mountingOrientation.toObject()
|
||||
}
|
||||
if (this.isImu()) {
|
||||
@@ -250,25 +248,6 @@ class Tracker @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the mounting reset quaternion from disk
|
||||
*/
|
||||
fun saveMountingResetOrientation(config: TrackerConfig) {
|
||||
// Load automatic mounting
|
||||
config.mountingResetOrientation?.let {
|
||||
resetsHandler.trySetMountingReset(it.toValue())
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the mounting reset quaternion to disk
|
||||
*/
|
||||
fun saveMountingResetOrientation(quat: Quaternion?) {
|
||||
val configManager = VRServer.instance.configManager
|
||||
configManager.vrConfig.getTracker(this).mountingResetOrientation = quat?.toObject()
|
||||
configManager.saveConfig()
|
||||
}
|
||||
|
||||
/**
|
||||
* Synchronized with the VRServer's 1000hz while loop
|
||||
*/
|
||||
@@ -281,7 +260,6 @@ class Tracker @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
filteringHandler.update()
|
||||
resetsHandler.update()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,8 +14,6 @@ enum class TrackerPosition(
|
||||
val trackerRole: TrackerRole?,
|
||||
val bodyPart: Int,
|
||||
) {
|
||||
// If updating BodyPart of a TrackerRole,
|
||||
// please also update SteamVRBridge#updateShareSettingsAutomatically()
|
||||
HEAD("body:head", TrackerRole.HMD, BodyPart.HEAD),
|
||||
NECK("body:neck", TrackerRole.NECK, BodyPart.NECK),
|
||||
UPPER_CHEST("body:upper_chest", TrackerRole.CHEST, BodyPart.UPPER_CHEST),
|
||||
@@ -52,12 +50,12 @@ enum class TrackerPosition(
|
||||
companion object {
|
||||
/** Indexed by `BodyPart` int value. EFFICIENCY FTW */
|
||||
private val byBodyPart: Array<out TrackerPosition?> = arrayOfNulls<TrackerPosition>(BodyPart.names.size).apply {
|
||||
for (position in entries) {
|
||||
for (position in values()) {
|
||||
this[position.bodyPart] = position
|
||||
}
|
||||
}
|
||||
private val byDesignation = entries.associateBy { it.designation.lowercase() }
|
||||
private val byTrackerRole = entries.filter { it.trackerRole != null }.associateBy { it.trackerRole!! }
|
||||
private val byDesignation = values().associateBy { it.designation.lowercase() }
|
||||
private val byTrackerRole = values().filter { it.trackerRole != null }.associateBy { it.trackerRole!! }
|
||||
|
||||
/**
|
||||
* Gets the `TrackerPosition` by its string designation.
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package dev.slimevr.tracking.trackers
|
||||
|
||||
import com.jme3.math.FastMath
|
||||
import com.jme3.system.NanoTimer
|
||||
import dev.slimevr.VRServer
|
||||
import dev.slimevr.config.ArmsResetModes
|
||||
import dev.slimevr.config.DriftCompensationConfig
|
||||
import dev.slimevr.config.ResetsConfig
|
||||
import dev.slimevr.filtering.CircularArrayList
|
||||
import io.eiren.math.FloatMath.animateEase
|
||||
import io.github.axisangles.ktmath.EulerAngles
|
||||
import io.github.axisangles.ktmath.EulerOrder
|
||||
import io.github.axisangles.ktmath.Quaternion
|
||||
@@ -40,9 +38,6 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
private var driftCompensationEnabled = false
|
||||
private var resetMountingFeet = false
|
||||
private var armsResetMode = ArmsResetModes.BACK
|
||||
private var yawResetSmoothTime = 0.0f
|
||||
private lateinit var fpsTimer: NanoTimer
|
||||
var saveMountingReset = false
|
||||
var allowDriftCompensation = false
|
||||
var lastResetQuaternion: Quaternion? = null
|
||||
|
||||
@@ -61,11 +56,6 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
private set
|
||||
private var yawFix = Quaternion.IDENTITY
|
||||
|
||||
// Yaw reset smoothing vars
|
||||
private var yawFixOld = Quaternion.IDENTITY
|
||||
private var yawFixSmoothIncremental = Quaternion.IDENTITY
|
||||
private var yawResetSmoothTimeRemain = 0.0f
|
||||
|
||||
// Zero-reference/identity adjustment quats for IMU debugging
|
||||
private var gyroFixNoMounting = Quaternion.IDENTITY
|
||||
private var attachmentFixNoMounting = Quaternion.IDENTITY
|
||||
@@ -113,29 +103,18 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads/loads reset settings from the given config
|
||||
* Reads/loads arms reset mode settings from given config
|
||||
*/
|
||||
fun readResetConfig(config: ResetsConfig) {
|
||||
fun readArmsResetModeConfig(config: ResetsConfig) {
|
||||
resetMountingFeet = config.resetMountingFeet
|
||||
armsResetMode = config.mode
|
||||
yawResetSmoothTime = config.yawResetSmoothTime
|
||||
if (!::fpsTimer.isInitialized) {
|
||||
fpsTimer = VRServer.instance.fpsTimer
|
||||
}
|
||||
saveMountingReset = config.saveMountingReset
|
||||
}
|
||||
|
||||
fun trySetMountingReset(quat: Quaternion) {
|
||||
if (saveMountingReset) {
|
||||
mountRotFix = quat
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes a rotation and adjusts it to resets, mounting,
|
||||
* and drift compensation, with the HMD as the reference.
|
||||
*/
|
||||
fun getReferenceAdjustedDriftRotationFrom(rotation: Quaternion): Quaternion = adjustToDrift(adjustToYawResetSmoothing(adjustToReference(rotation)))
|
||||
fun getReferenceAdjustedDriftRotationFrom(rotation: Quaternion): Quaternion = adjustToDrift(adjustToReference(rotation))
|
||||
|
||||
/**
|
||||
* Takes a rotation and adjusts it to resets and mounting,
|
||||
@@ -191,17 +170,6 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
return rotation
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply yaw reset smoothing to quaternion rotated to new yaw
|
||||
* fix and returns smoothed quaternion
|
||||
*/
|
||||
private fun adjustToYawResetSmoothing(rotation: Quaternion): Quaternion {
|
||||
if (yawResetSmoothTimeRemain > 0.0f) {
|
||||
return yawFixSmoothIncremental * rotation
|
||||
}
|
||||
return rotation
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the tracker so that its current rotation is counted as (0, HMD Yaw,
|
||||
* 0). This allows the tracker to be strapped to body at any pitch and roll.
|
||||
@@ -238,7 +206,6 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
makeIdentityAdjustmentQuatsFull()
|
||||
|
||||
yawFix = fixYaw(mountingAdjustedRotation, reference)
|
||||
yawResetSmoothTimeRemain = 0.0f
|
||||
|
||||
calculateDrift(oldRot)
|
||||
|
||||
@@ -258,20 +225,12 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
val oldRot = adjustToReference(tracker.getRawRotation())
|
||||
lastResetQuaternion = oldRot
|
||||
|
||||
yawFixOld = yawFix
|
||||
yawFix = fixYaw(tracker.getRawRotation() * mountingOrientation, reference)
|
||||
yawResetSmoothTimeRemain = 0.0f
|
||||
|
||||
makeIdentityAdjustmentQuatsYaw()
|
||||
|
||||
calculateDrift(oldRot)
|
||||
|
||||
// Start at yaw before reset if smoothing enabled
|
||||
if (yawResetSmoothTime > 0.0f) {
|
||||
yawResetSmoothTimeRemain = yawResetSmoothTime
|
||||
yawFixSmoothIncremental = yawFixOld / yawFix
|
||||
}
|
||||
|
||||
// Remove the status if yaw reset was performed after the tracker
|
||||
// was disconnected and connected.
|
||||
if (this.tracker.lastResetStatus != 0u && this.tracker.statusResetRecently) {
|
||||
@@ -331,9 +290,6 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
|
||||
// Make an adjustment quaternion from the angle
|
||||
mountRotFix = EulerAngles(EulerOrder.YZX, 0f, yawAngle, 0f).toQuaternion()
|
||||
|
||||
// save mounting reset
|
||||
if (saveMountingReset) tracker.saveMountingResetOrientation(mountRotFix)
|
||||
}
|
||||
|
||||
fun clearMounting() {
|
||||
@@ -469,28 +425,6 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
return totalMatrix.toQuaternion()
|
||||
}
|
||||
|
||||
/**
|
||||
* Update yaw reset smoothing time
|
||||
*/
|
||||
@Synchronized
|
||||
fun update() {
|
||||
if (yawResetSmoothTimeRemain > 0.0f) {
|
||||
var deltaTime = 0.001f
|
||||
if (::fpsTimer.isInitialized) {
|
||||
deltaTime = fpsTimer.timePerFrame
|
||||
}
|
||||
yawResetSmoothTimeRemain = yawResetSmoothTimeRemain - deltaTime
|
||||
if (yawResetSmoothTimeRemain > 0.0f) {
|
||||
// Remaining time decreases to 0, so the interpolation is reversed
|
||||
yawFixSmoothIncremental = yawFix.inv() * yawFix
|
||||
.interpR(
|
||||
yawFixOld,
|
||||
animateEase(yawResetSmoothTimeRemain / yawResetSmoothTime),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun isThighTracker(): Boolean {
|
||||
tracker.trackerPosition?.let {
|
||||
return it == TrackerPosition.LEFT_UPPER_LEG ||
|
||||
|
||||
@@ -46,9 +46,7 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
|
||||
emptyList()
|
||||
}
|
||||
private val parser = UDPProtocolParser()
|
||||
|
||||
// 1500 is a common network MTU. 1472 is the maximum size of a UDP packet (1500 - 20 for IPv4 header - 8 for UDP header)
|
||||
private val rcvBuffer = ByteArray(1500 - 20 - 8)
|
||||
private val rcvBuffer = ByteArray(512)
|
||||
private val bb = ByteBuffer.wrap(rcvBuffer).order(ByteOrder.BIG_ENDIAN)
|
||||
|
||||
// Gets initialized in this.run()
|
||||
@@ -81,7 +79,6 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
|
||||
name = handshake.macString?.let { "udp://$it" }
|
||||
descriptiveName = "udp:/$addr"
|
||||
firmwareBuild = handshake.firmwareBuild
|
||||
firmwareVersion = handshake.firmware
|
||||
connectionsByAddress[address] = this
|
||||
|
||||
val i = connections.indexOf(this)
|
||||
@@ -105,7 +102,6 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
|
||||
?: "udp:/$addr"
|
||||
descriptiveName = "udp:/$addr"
|
||||
firmwareBuild = handshake.firmwareBuild
|
||||
firmwareVersion = handshake.firmware
|
||||
val i = connections.indexOf(this)
|
||||
LogManager
|
||||
.info(
|
||||
@@ -144,7 +140,6 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
|
||||
// string it just looks like "/address" lol.
|
||||
// Fixing this would break config!
|
||||
connection.descriptiveName = "udp:/$addr"
|
||||
connection.firmwareVersion = handshake.firmware
|
||||
synchronized(connections) {
|
||||
// Register the new connection
|
||||
val i = connections.size
|
||||
@@ -321,9 +316,6 @@ class TrackersUDPServer(private val port: Int, name: String, private val tracker
|
||||
tracker = connection?.getTracker(packet.sensorId)
|
||||
if (tracker == null) return
|
||||
tracker.setRotation(rot)
|
||||
if (packet is UDPPacket23RotationAndAcceleration) {
|
||||
tracker.setAcceleration(packet.acceleration)
|
||||
}
|
||||
tracker.dataTick()
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,11 @@ class UDPDevice(
|
||||
set(manufacturer) {
|
||||
super.manufacturer = manufacturer
|
||||
}
|
||||
override var firmwareVersion: String?
|
||||
get() = "v$firmwareBuild"
|
||||
set(firmwareVersion) {
|
||||
super.firmwareVersion = firmwareVersion
|
||||
}
|
||||
|
||||
fun getTracker(id: Int): Tracker? = trackers[id]
|
||||
}
|
||||
@@ -329,27 +329,6 @@ class UDPPacket22FeatureFlags(
|
||||
}
|
||||
}
|
||||
|
||||
data class UDPPacket23RotationAndAcceleration(
|
||||
override var rotation: Quaternion = Quaternion.IDENTITY,
|
||||
var acceleration: Vector3 = Vector3.NULL,
|
||||
) : UDPPacket(23),
|
||||
RotationPacket {
|
||||
override var sensorId: Int = 0
|
||||
override fun readData(buf: ByteBuffer) {
|
||||
// s16 s16 s16 s16 s16 s16 s16
|
||||
// qX qY qZ qW aX aY aZ
|
||||
sensorId = buf.get().toInt() and 0xFF
|
||||
val scaleR = 1 / (1 shl 15).toFloat() // Q15: 1 is represented as 0x7FFF and -1 as 0x8000
|
||||
val x = buf.short * scaleR
|
||||
val y = buf.short * scaleR
|
||||
val z = buf.short * scaleR
|
||||
val w = buf.short * scaleR
|
||||
rotation = Quaternion(w, x, y, z).unit()
|
||||
val scaleA = 1 / (1 shl 7).toFloat() // The same as the HID scale
|
||||
acceleration = Vector3(buf.short * scaleA, buf.short * scaleA, buf.short * scaleA)
|
||||
}
|
||||
}
|
||||
|
||||
data class UDPPacket200ProtocolChange(
|
||||
var targetProtocol: Int = 0,
|
||||
var targetProtocolVersion: Int = 0,
|
||||
|
||||
@@ -127,7 +127,6 @@ class UDPProtocolParser {
|
||||
const val PACKET_TEMPERATURE = 20
|
||||
const val PACKET_USER_ACTION = 21
|
||||
const val PACKET_FEATURE_FLAGS = 22
|
||||
const val PACKET_ROTATION_AND_ACCELERATION = 23
|
||||
const val PACKET_BUNDLE = 100
|
||||
const val PACKET_PROTOCOL_CHANGE = 200
|
||||
private val HANDSHAKE_BUFFER = ByteArray(64)
|
||||
|
||||
@@ -59,7 +59,7 @@ dependencies {
|
||||
implementation("net.java.dev.jna:jna:5.+")
|
||||
implementation("net.java.dev.jna:jna-platform:5.+")
|
||||
implementation("com.fazecast:jSerialComm:2.10.2")
|
||||
implementation("org.hid4java:hid4java:0.8.0")
|
||||
implementation("org.hid4java:hid4java:0.7.0")
|
||||
}
|
||||
|
||||
tasks.shadowJar {
|
||||
|
||||
@@ -55,59 +55,30 @@ abstract class SteamVRBridge(
|
||||
override fun updateShareSettingsAutomatically(): Boolean {
|
||||
if (!config.automaticSharedTrackersToggling) return false
|
||||
val skeleton = instance.humanPoseManager.skeleton
|
||||
val isWaistSteamVr = skeleton.hipTracker?.device?.isOpenVrDevice == true ||
|
||||
skeleton.waistTracker?.device?.isOpenVrDevice == true
|
||||
// Enable waist if skeleton has an spine tracker
|
||||
changeShareSettings(TrackerRole.WAIST, skeleton.hasSpineTracker && !isWaistSteamVr)
|
||||
changeShareSettings(TrackerRole.WAIST, skeleton.hasSpineTracker)
|
||||
|
||||
// hasChest if waist and/or hip is on, and chest and/or upper chest is also on
|
||||
val hasChest = (skeleton.hipTracker != null || skeleton.waistTracker != null) &&
|
||||
(skeleton.upperChestTracker != null || skeleton.chestTracker != null)
|
||||
val isChestSteamVr = skeleton.upperChestTracker?.device?.isOpenVrDevice == true ||
|
||||
skeleton.chestTracker?.device?.isOpenVrDevice == true
|
||||
changeShareSettings(
|
||||
TrackerRole.CHEST,
|
||||
hasChest && !isChestSteamVr,
|
||||
)
|
||||
changeShareSettings(TrackerRole.CHEST, hasChest)
|
||||
|
||||
// hasFeet if lower and/or upper leg tracker is on
|
||||
val hasLeftFoot =
|
||||
(skeleton.leftUpperLegTracker != null || skeleton.leftLowerLegTracker != null)
|
||||
val isLeftFootSteamVr =
|
||||
skeleton.leftLowerLegTracker?.device?.isOpenVrDevice == true ||
|
||||
skeleton.leftFootTracker?.device?.isOpenVrDevice == true
|
||||
val hasFeet =
|
||||
(skeleton.leftUpperLegTracker != null || skeleton.leftLowerLegTracker != null) &&
|
||||
(skeleton.rightUpperLegTracker != null || skeleton.rightLowerLegTracker != null)
|
||||
changeShareSettings(TrackerRole.LEFT_FOOT, hasFeet)
|
||||
changeShareSettings(TrackerRole.RIGHT_FOOT, hasFeet)
|
||||
|
||||
val hasRightFoot =
|
||||
(skeleton.rightUpperLegTracker != null || skeleton.rightLowerLegTracker != null)
|
||||
val isRightFootSteamVr =
|
||||
skeleton.rightLowerLegTracker?.device?.isOpenVrDevice == true ||
|
||||
skeleton.rightFootTracker?.device?.isOpenVrDevice == true
|
||||
changeShareSettings(
|
||||
TrackerRole.LEFT_FOOT,
|
||||
hasLeftFoot && !isLeftFootSteamVr,
|
||||
)
|
||||
changeShareSettings(
|
||||
TrackerRole.RIGHT_FOOT,
|
||||
hasRightFoot && !isRightFootSteamVr,
|
||||
)
|
||||
|
||||
// hasKnees is just hasFeet
|
||||
val isLeftKneeSteamVr = skeleton.leftUpperLegTracker?.device?.isOpenVrDevice == true
|
||||
|
||||
val isRightKneeSteamVr = skeleton.rightUpperLegTracker?.device?.isOpenVrDevice == true
|
||||
changeShareSettings(TrackerRole.LEFT_KNEE, hasLeftFoot && !isLeftKneeSteamVr)
|
||||
changeShareSettings(TrackerRole.RIGHT_KNEE, hasRightFoot && !isRightKneeSteamVr)
|
||||
// hasKnees if foot tracker and lower and/or upper leg tracker is on
|
||||
val hasKnees = hasFeet && skeleton.hasLeftFootTracker && skeleton.hasRightFootTracker
|
||||
changeShareSettings(TrackerRole.LEFT_KNEE, hasKnees)
|
||||
changeShareSettings(TrackerRole.RIGHT_KNEE, hasKnees)
|
||||
|
||||
// hasElbows if an upper arm or a lower arm tracker is on
|
||||
val hasLeftElbow = skeleton.hasLeftArmTracker
|
||||
val isLeftElbowSteamVr = skeleton.leftUpperArmTracker?.device?.isOpenVrDevice == true ||
|
||||
skeleton.leftLowerArmTracker?.device?.isOpenVrDevice == true
|
||||
|
||||
val hasRightElbow = skeleton.hasRightArmTracker
|
||||
val isRightElbowSteamVr = skeleton.rightUpperArmTracker?.device?.isOpenVrDevice == true ||
|
||||
skeleton.rightLowerArmTracker?.device?.isOpenVrDevice == true
|
||||
changeShareSettings(TrackerRole.LEFT_ELBOW, hasLeftElbow && !isLeftElbowSteamVr)
|
||||
changeShareSettings(TrackerRole.RIGHT_ELBOW, hasRightElbow && !isRightElbowSteamVr)
|
||||
val hasElbows = skeleton.hasLeftArmTracker && skeleton.hasRightArmTracker
|
||||
changeShareSettings(TrackerRole.LEFT_ELBOW, hasElbows)
|
||||
changeShareSettings(TrackerRole.RIGHT_ELBOW, hasElbows)
|
||||
|
||||
// Hands aren't touched as they will override the controller's tracking
|
||||
return true
|
||||
|
||||
+3
-8
@@ -32,7 +32,7 @@ class TrackersHID(name: String, private val trackersConsumer: Consumer<Tracker>)
|
||||
private val hidServices: HidServices
|
||||
|
||||
init {
|
||||
hidServicesSpecification.setAutoStart(false)
|
||||
hidServicesSpecification.isAutoStart = false
|
||||
hidServices = HidManager.getHidServices(hidServicesSpecification)
|
||||
hidServices.addHidServicesListener(this)
|
||||
val dataReadThread = Thread(dataReadRunnable)
|
||||
@@ -43,7 +43,7 @@ class TrackersHID(name: String, private val trackersConsumer: Consumer<Tracker>)
|
||||
|
||||
private fun checkConfigureDevice(hidDevice: HidDevice) {
|
||||
if (hidDevice.vendorId == 0x2FE3 && hidDevice.productId == 0x5652) { // TODO: Use correct ids
|
||||
if (hidDevice.isClosed) {
|
||||
if (!hidDevice.isOpen) {
|
||||
check(hidDevice.open()) { "Unable to open device" }
|
||||
}
|
||||
// TODO: Configure the device here
|
||||
@@ -164,7 +164,7 @@ class TrackersHID(name: String, private val trackersConsumer: Consumer<Tracker>)
|
||||
var devicesPresent = false
|
||||
for ((hidDevice, deviceList) in devicesByHID) {
|
||||
val dataReceived: Array<Byte> = try {
|
||||
hidDevice.read(80, 0) // Read up to 80 bytes
|
||||
hidDevice.read(80, 1) // Read up to 80 bytes, timeout 1ms
|
||||
} catch (e: NegativeArraySizeException) {
|
||||
continue // Skip devices with read error (Maybe disconnected)
|
||||
}
|
||||
@@ -174,7 +174,6 @@ class TrackersHID(name: String, private val trackersConsumer: Consumer<Tracker>)
|
||||
// TODO: make this less bad
|
||||
if (dataReceived.size % 20 != 0) {
|
||||
LogManager.info("[TrackerServer] Malformed HID packet, ignoring")
|
||||
continue // Don't continue with this data
|
||||
}
|
||||
val packetCount = dataReceived.size / 20
|
||||
var i = 0
|
||||
@@ -244,10 +243,6 @@ class TrackersHID(name: String, private val trackersConsumer: Consumer<Tracker>)
|
||||
// TODO:
|
||||
}
|
||||
|
||||
override fun hidDataReceived(p0: HidServicesEvent?) {
|
||||
// Seems to have issues with the size of data returned
|
||||
}
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* Change between IMU axes and OpenGL/SteamVR axes
|
||||
|
||||
+1
-1
Submodule solarxr-protocol updated: b1ae56c26a...a5fd6aed43.
Reference in new issue
Block a user