diff --git a/src-python/config.py b/src-python/config.py index da663168..36cbfbd5 100644 --- a/src-python/config.py +++ b/src-python/config.py @@ -791,6 +791,10 @@ class Config: if isinstance(value, dict) and set(value.keys()) == set(self.OVERLAY_LARGE_LOG_SETTINGS.keys()): for key, value in value.items(): match (key): + case "tracker": + if isinstance(value, str): + # "HMD", "LeftHand", "RightHand" + self._OVERLAY_LARGE_LOG_SETTINGS[key] = value case "x_pos" | "y_pos" | "z_pos" | "x_rotation" | "y_rotation" | "z_rotation": if isinstance(value, (int, float)): self._OVERLAY_LARGE_LOG_SETTINGS[key] = float(value) @@ -1086,6 +1090,7 @@ class Config: "fadeout_duration": 2, "opacity": 1.0, "ui_scaling": 1.0, + "tracker": "HMD", } self._OVERLAY_LARGE_LOG = False self._OVERLAY_LARGE_LOG_SETTINGS = { @@ -1099,6 +1104,7 @@ class Config: "fadeout_duration": 2, "opacity": 1.0, "ui_scaling": 1.0, + "tracker": "LeftHand", } self._SEND_MESSAGE_TO_VRC = True self._SEND_RECEIVED_MESSAGE_TO_VRC = False diff --git a/src-python/model.py b/src-python/model.py index 98a6588a..161ab64a 100644 --- a/src-python/model.py +++ b/src-python/model.py @@ -94,6 +94,7 @@ class Model: config.OVERLAY_SMALL_LOG_SETTINGS["opacity"], config.OVERLAY_SMALL_LOG_SETTINGS["ui_scaling"], ) + self.overlay_small_log_pre_settings = config.OVERLAY_SMALL_LOG_SETTINGS self.overlay_large_log = Overlay( "VRCT_LARGE_LOG", "VRCT_LARGE_LOG", @@ -108,6 +109,7 @@ class Model: config.OVERLAY_LARGE_LOG_SETTINGS["opacity"], config.OVERLAY_LARGE_LOG_SETTINGS["ui_scaling"], ) + self.overlay_large_log_pre_settings = config.OVERLAY_LARGE_LOG_SETTINGS self.overlay_image = OverlayImage() self.mic_audio_queue = None self.mic_mute_status = None @@ -726,18 +728,31 @@ class Model: self.overlay_small_log.startOverlay() def updateOverlaySmallLogSettings(self): - self.overlay_small_log.updatePosition( - config.OVERLAY_SMALL_LOG_SETTINGS["x_pos"], - config.OVERLAY_SMALL_LOG_SETTINGS["y_pos"], - config.OVERLAY_SMALL_LOG_SETTINGS["z_pos"], - config.OVERLAY_SMALL_LOG_SETTINGS["x_rotation"], - config.OVERLAY_SMALL_LOG_SETTINGS["y_rotation"], - config.OVERLAY_SMALL_LOG_SETTINGS["z_rotation"], - ) - self.overlay_small_log.updateDisplayDuration(config.OVERLAY_SMALL_LOG_SETTINGS["display_duration"]) - self.overlay_small_log.updateFadeoutDuration(config.OVERLAY_SMALL_LOG_SETTINGS["fadeout_duration"]) - self.overlay_small_log.updateOpacity(config.OVERLAY_SMALL_LOG_SETTINGS["opacity"], with_fade=True) - self.overlay_small_log.updateUiScaling(config.OVERLAY_SMALL_LOG_SETTINGS["ui_scaling"]) + for key in self.overlay_small_log_pre_settings.keys(): + if self.overlay_small_log_pre_settings[key] != config.OVERLAY_SMALL_LOG_SETTINGS[key]: + match (key): + case "x_pos" | "y_pos" | "z_pos" | "x_rotation" | "y_rotation" | "z_rotation" | "tracker": + self.overlay_small_log.updatePosition( + config.OVERLAY_SMALL_LOG_SETTINGS["x_pos"], + config.OVERLAY_SMALL_LOG_SETTINGS["y_pos"], + config.OVERLAY_SMALL_LOG_SETTINGS["z_pos"], + config.OVERLAY_SMALL_LOG_SETTINGS["x_rotation"], + config.OVERLAY_SMALL_LOG_SETTINGS["y_rotation"], + config.OVERLAY_SMALL_LOG_SETTINGS["z_rotation"], + config.OVERLAY_SMALL_LOG_SETTINGS["tracker"], + ) + case "display_duration": + self.overlay_small_log.updateDisplayDuration(config.OVERLAY_SMALL_LOG_SETTINGS["display_duration"]) + case "fadeout_duration": + self.overlay_small_log.updateFadeoutDuration(config.OVERLAY_SMALL_LOG_SETTINGS["fadeout_duration"]) + case "opacity": + self.overlay_small_log.updateOpacity(config.OVERLAY_SMALL_LOG_SETTINGS["opacity"], with_fade=True) + case "ui_scaling": + self.overlay_small_log.updateUiScaling(config.OVERLAY_SMALL_LOG_SETTINGS["ui_scaling"]) + case _: + pass + break + self.overlay_small_log_pre_settings = config.OVERLAY_SMALL_LOG_SETTINGS def shutdownOverlaySmall(self): self.overlay_small_log.shutdownOverlay() @@ -757,18 +772,31 @@ class Model: self.overlay_large_log.startOverlay() def updateOverlayLargeLogSettings(self): - self.overlay_large_log.updatePosition( - config.OVERLAY_LARGE_LOG_SETTINGS["x_pos"], - config.OVERLAY_LARGE_LOG_SETTINGS["y_pos"], - config.OVERLAY_LARGE_LOG_SETTINGS["z_pos"], - config.OVERLAY_LARGE_LOG_SETTINGS["x_rotation"], - config.OVERLAY_LARGE_LOG_SETTINGS["y_rotation"], - config.OVERLAY_LARGE_LOG_SETTINGS["z_rotation"], - ) - self.overlay_large_log.updateDisplayDuration(config.OVERLAY_LARGE_LOG_SETTINGS["display_duration"]) - self.overlay_large_log.updateFadeoutDuration(config.OVERLAY_LARGE_LOG_SETTINGS["fadeout_duration"]) - self.overlay_large_log.updateOpacity(config.OVERLAY_LARGE_LOG_SETTINGS["opacity"], with_fade=True) - self.overlay_large_log.updateUiScaling(config.OVERLAY_LARGE_LOG_SETTINGS["ui_scaling"]) + for key in self.overlay_large_log_pre_settings.keys(): + if self.overlay_large_log_pre_settings[key] != config.OVERLAY_LARGE_LOG_SETTINGS[key]: + match (key): + case "x_pos" | "y_pos" | "z_pos" | "x_rotation" | "y_rotation" | "z_rotation" | "tracker": + self.overlay_large_log.updatePosition( + config.OVERLAY_LARGE_LOG_SETTINGS["x_pos"], + config.OVERLAY_LARGE_LOG_SETTINGS["y_pos"], + config.OVERLAY_LARGE_LOG_SETTINGS["z_pos"], + config.OVERLAY_LARGE_LOG_SETTINGS["x_rotation"], + config.OVERLAY_LARGE_LOG_SETTINGS["y_rotation"], + config.OVERLAY_LARGE_LOG_SETTINGS["z_rotation"], + config.OVERLAY_LARGE_LOG_SETTINGS["tracker"], + ) + case "display_duration": + self.overlay_large_log.updateDisplayDuration(config.OVERLAY_LARGE_LOG_SETTINGS["display_duration"]) + case "fadeout_duration": + self.overlay_large_log.updateFadeoutDuration(config.OVERLAY_LARGE_LOG_SETTINGS["fadeout_duration"]) + case "opacity": + self.overlay_large_log.updateOpacity(config.OVERLAY_LARGE_LOG_SETTINGS["opacity"], with_fade=True) + case "ui_scaling": + self.overlay_large_log.updateUiScaling(config.OVERLAY_LARGE_LOG_SETTINGS["ui_scaling"]) + case _: + pass + break + self.overlay_large_log_pre_settings = config.OVERLAY_LARGE_LOG_SETTINGS def shutdownOverlayLarge(self): self.overlay_large_log.shutdownOverlay() diff --git a/src-python/models/overlay/overlay.py b/src-python/models/overlay/overlay.py index c2c9d1a1..f26f8fc4 100644 --- a/src-python/models/overlay/overlay.py +++ b/src-python/models/overlay/overlay.py @@ -109,6 +109,7 @@ class Overlay: self.settings["x_rotation"], self.settings["y_rotation"], self.settings["z_rotation"], + self.settings["tracker"] ) except Exception as e: