mirror of
https://github.com/EyeTrackVR/EyeTrackVR.git
synced 2025-11-04 14:39:42 +08:00
Initial commit
This commit is contained in:
parent
59f2aa14ec
commit
9f2cac900f
@ -217,6 +217,11 @@ class EyeTrackSettingsConfig(BaseModel):
|
||||
gui_OutputMultiplier: float = 1
|
||||
gui_use_module: bool = False
|
||||
|
||||
#EyeTune
|
||||
gui_eyetune_maxin: float = 1
|
||||
gui_eyetune_maxout: float = 1
|
||||
gui_eyetune_maxup: float = 1
|
||||
gui_eyetune_maxdown: float = 1
|
||||
|
||||
class EyeTrackConfig(BaseModel):
|
||||
version: int = 1
|
||||
|
||||
@ -38,6 +38,7 @@ import math
|
||||
from utils.calibration_3d import receive_calibration_data, converge_3d
|
||||
from utils.misc_utils import resource_path
|
||||
from pathlib import Path
|
||||
from utils.misc_utils import clamp
|
||||
|
||||
tool = Path("Tools")
|
||||
class TimeoutError(RuntimeError):
|
||||
@ -335,6 +336,17 @@ class cal:
|
||||
var.past_x = out_x_mult
|
||||
var.past_y = out_y_mult
|
||||
|
||||
#Clamps the right eye's X values
|
||||
if self.eye_id == EyeID.Left:
|
||||
out_x = clamp(out_x, -self.settings.gui_eyetune_maxout, self.settings.gui_eyetune_maxin)
|
||||
#Clamps the left eye's x values
|
||||
elif self.eye_id == EyeID.Right:
|
||||
out_x = clamp(out_x, -self.settings.gui_eyetune_maxin, self.settings.gui_eyetune_maxout)
|
||||
#Clamps both eye's Y values
|
||||
out_y = clamp(out_y, -self.settings.gui_eyetune_maxdown, self.settings.gui_eyetune_maxup)
|
||||
|
||||
|
||||
|
||||
out_x, out_y = velocity_falloff(self, var, out_x, out_y)
|
||||
|
||||
try:
|
||||
|
||||
77
EyeTrackApp/settings/modules/EyeTuneSettingsModule
Normal file
77
EyeTrackApp/settings/modules/EyeTuneSettingsModule
Normal file
@ -0,0 +1,77 @@
|
||||
from pydantic import AfterValidator
|
||||
from typing_extensions import Annotated
|
||||
|
||||
from settings.modules.BaseModule import BaseSettingsModule, BaseValidationModel
|
||||
from settings.constants import BACKGROUND_COLOR
|
||||
import PySimpleGUI as sg
|
||||
|
||||
from settings.modules.CommonFieldValidators import try_convert_to_float
|
||||
from settings.modules.CommonFieldValidators import try_convert_to_int
|
||||
|
||||
class EyeTuneValidationModule(BaseValidationModel):
|
||||
gui_eyetune_maxin: Annotated[float, AfterValidator(try_convert_to_float)]
|
||||
gui_eyetune_maxout: Annotated[float, AfterValidator(try_convert_to_float)]
|
||||
gui_eyetune_maxup: Annotated[float, AfterValidator(try_convert_to_float)]
|
||||
gui_eyetune_maxdown: Annotated[float, AfterValidator(try_convert_to_float)]
|
||||
|
||||
class EyeTuneSettingsModule(BaseSettingsModule):
|
||||
def __init__(self, config, widget_id, **kwargs):
|
||||
super().__init__(config=config, widget_id=widget_id, **kwargs)
|
||||
self.validation_model = EyeTuneValidationModule
|
||||
self.gui_eyetune_maxin = f"-gui_eyetune_maxin{widget_id}-"
|
||||
self.gui_eyetune_maxout = f"-gui_eyetune_maxout{widget_id}-"
|
||||
self.gui_eyetune_maxup =f"-gui_eyetune_maxup{widget_id}-"
|
||||
self.gui_eyetune_maxdown =f"-gui_eyetune_maxdown{widget_id}"
|
||||
|
||||
|
||||
|
||||
def get_layout(self):
|
||||
return [
|
||||
[
|
||||
sg.Text("Eye Tuning (Max Rotation):", background_color='#242224'),
|
||||
],
|
||||
[
|
||||
sg.Text("Max. Inwards", background_color=BACKGROUND_COLOR),
|
||||
sg.InputText(
|
||||
self.config.gui_eyetune_maxin,
|
||||
key=self.gui_eyetune_maxin,
|
||||
size=(0, 10),
|
||||
tooltip=(
|
||||
"Sets the maximum allowed inwards rotation"
|
||||
"\nSet between 0 and 1"
|
||||
)
|
||||
),
|
||||
sg.Text("Max. Outwards", background_color=BACKGROUND_COLOR),
|
||||
sg.InputText(
|
||||
self.config.gui_eyetune_maxout,
|
||||
key=self.gui_eyetune_maxout,
|
||||
size=(0, 10),
|
||||
tooltip=(
|
||||
"Sets the maximum allowed outwards rotation"
|
||||
"\nSet between 0 and 1"
|
||||
)
|
||||
),
|
||||
],
|
||||
[
|
||||
sg.Text("Max. Upwards", background_color=BACKGROUND_COLOR),
|
||||
sg.InputText(
|
||||
self.config.gui_eyetune_maxup,
|
||||
key=self.gui_eyetune_maxup,
|
||||
size=(0, 10),
|
||||
tooltip=(
|
||||
"Sets the maximum allowed upwards rotation"
|
||||
"\nSet between 0 and 1"
|
||||
)
|
||||
),
|
||||
sg.Text("Max. Down", background_color=BACKGROUND_COLOR),
|
||||
sg.InputText(
|
||||
self.config.gui_eyetune_maxdown,
|
||||
key=self.gui_eyetune_maxdown,
|
||||
size=(0, 10),
|
||||
tooltip=(
|
||||
"Sets the maximum allowed downwards rotation"
|
||||
"\nSet between 0 and 1"
|
||||
)
|
||||
),
|
||||
],
|
||||
]
|
||||
2
EyeTrackApp/zBuild.bat
Normal file
2
EyeTrackApp/zBuild.bat
Normal file
@ -0,0 +1,2 @@
|
||||
poetry run pyinstaller eyetrackapp.spec
|
||||
cmd /k
|
||||
@ -74,6 +74,12 @@ def eyetrack_settings_config():
|
||||
gui_osc_vrcft_v2=False,
|
||||
gui_vrc_native=False,
|
||||
gui_pupil_dilation=True,
|
||||
|
||||
#EyeTune
|
||||
gui_eyetune_maxin=1,
|
||||
gui_eyetune_maxout=1,
|
||||
gui_eyetune_maxup=1,
|
||||
gui_eyetune_maxdown=1,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user