Merge branch 'overlay_rotation' into develop
This commit is contained in:
@@ -770,7 +770,7 @@ class Config:
|
||||
if isinstance(value, dict) and set(value.keys()) == set(self.OVERLAY_SMALL_LOG_SETTINGS.keys()):
|
||||
for key, value in value.items():
|
||||
match (key):
|
||||
case "x_pos" | "y_pos" | "depth":
|
||||
case "x_pos" | "y_pos" | "depth" | "x_rotation" | "y_rotation" | "z_rotation":
|
||||
if isinstance(value, float):
|
||||
self._OVERLAY_SMALL_LOG_SETTINGS[key] = value
|
||||
case "display_duration" | "fadeout_duration":
|
||||
@@ -1072,8 +1072,11 @@ class Config:
|
||||
self._ENABLE_OVERLAY_SMALL_LOG = False
|
||||
self._OVERLAY_SMALL_LOG_SETTINGS = {
|
||||
"x_pos": 0.0,
|
||||
"y_pos": -0.41,
|
||||
"depth": 1.0,
|
||||
"y_pos": 0.0,
|
||||
"depth": 0.0,
|
||||
"x_rotation": 0.0,
|
||||
"y_rotation": 0.0,
|
||||
"z_rotation": 0.0,
|
||||
"display_duration": 5,
|
||||
"fadeout_duration": 2,
|
||||
}
|
||||
|
||||
@@ -897,15 +897,9 @@ def callbackSetOverlaySmallLogSettings(value, set_type:str):
|
||||
pre_settings[set_type] = value
|
||||
config.OVERLAY_SMALL_LOG_SETTINGS = pre_settings
|
||||
match (set_type):
|
||||
case "x_pos":
|
||||
case "x_pos" | "y_pos" | "depth" | "x_rotation" | "y_rotation" | "z_rotation":
|
||||
model.updateOverlayPosition()
|
||||
case "y_pos":
|
||||
model.updateOverlayPosition()
|
||||
case "depth":
|
||||
model.updateOverlayPosition()
|
||||
case "display_duration":
|
||||
model.updateOverlayTimes()
|
||||
case "fadeout_duration":
|
||||
case "display_duration" | "fadeout_duration":
|
||||
model.updateOverlayTimes()
|
||||
|
||||
# Others Tab
|
||||
|
||||
@@ -75,6 +75,9 @@ overlay_settings:
|
||||
x_position: X-axis (left-right)
|
||||
y_position: Y-axis (up-down)
|
||||
depth: Z-axis (front-back)
|
||||
x_rotation: X-axis rotation
|
||||
y_rotation: Y-axis rotation
|
||||
z_rotation: Z-axis rotation
|
||||
display_duration: Display duration
|
||||
fadeout_duration: Fadeout duration
|
||||
|
||||
|
||||
@@ -74,6 +74,9 @@ overlay_settings:
|
||||
x_position: X軸(左右)
|
||||
y_position: Y軸(上下)
|
||||
depth: Z軸(前後)
|
||||
x_rotation: X軸の回転
|
||||
y_rotation: Y軸の回転
|
||||
z_rotation: Z軸の回転
|
||||
display_duration: 表示時間
|
||||
fadeout_duration: フェードアウト時間
|
||||
|
||||
|
||||
8
model.py
8
model.py
@@ -85,6 +85,9 @@ class Model:
|
||||
config.OVERLAY_SMALL_LOG_SETTINGS["x_pos"],
|
||||
config.OVERLAY_SMALL_LOG_SETTINGS["y_pos"],
|
||||
config.OVERLAY_SMALL_LOG_SETTINGS["depth"],
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
config.OVERLAY_SMALL_LOG_SETTINGS["display_duration"],
|
||||
config.OVERLAY_SMALL_LOG_SETTINGS["fadeout_duration"],
|
||||
config.OVERLAY_SETTINGS["opacity"],
|
||||
@@ -684,7 +687,10 @@ class Model:
|
||||
def updateOverlayPosition(self):
|
||||
pos = (config.OVERLAY_SMALL_LOG_SETTINGS["x_pos"], config.OVERLAY_SMALL_LOG_SETTINGS["y_pos"])
|
||||
depth = config.OVERLAY_SMALL_LOG_SETTINGS["depth"]
|
||||
self.overlay.updatePosition(pos, depth)
|
||||
x_rotation = config.OVERLAY_SMALL_LOG_SETTINGS["x_rotation"]
|
||||
y_rotation = config.OVERLAY_SMALL_LOG_SETTINGS["y_rotation"]
|
||||
z_rotation = config.OVERLAY_SMALL_LOG_SETTINGS["z_rotation"]
|
||||
self.overlay.updatePosition(pos, depth, x_rotation, y_rotation, z_rotation)
|
||||
|
||||
def updateOverlayTimes(self):
|
||||
display_duration = config.OVERLAY_SMALL_LOG_SETTINGS["display_duration"]
|
||||
|
||||
@@ -1,20 +1,68 @@
|
||||
import os
|
||||
import ctypes
|
||||
from psutil import process_iter
|
||||
import time
|
||||
import openvr
|
||||
from PIL import Image
|
||||
from psutil import process_iter
|
||||
from threading import Thread
|
||||
import openvr
|
||||
import numpy as np
|
||||
from PIL import Image
|
||||
try:
|
||||
from . import overlay_utils as utils
|
||||
except ImportError:
|
||||
import overlay_utils as utils
|
||||
|
||||
def mat34Id():
|
||||
def mat34Id(array):
|
||||
arr = openvr.HmdMatrix34_t()
|
||||
arr[0][0] = 1
|
||||
arr[1][1] = 1
|
||||
arr[2][2] = 1
|
||||
for i in range(3):
|
||||
for j in range(4):
|
||||
arr[i][j] = array[i][j]
|
||||
return arr
|
||||
|
||||
def getBaseMatrix(x_pos, y_pos, depth, x_rotation, y_rotation, z_rotation):
|
||||
arr = np.zeros((3, 4))
|
||||
rot = utils.euler_to_rotation_matrix((x_rotation, y_rotation, z_rotation))
|
||||
|
||||
for i in range(3):
|
||||
for j in range(3):
|
||||
arr[i][j] = rot[i][j]
|
||||
|
||||
arr[0][3] = x_pos * depth
|
||||
arr[1][3] = y_pos * depth
|
||||
arr[2][3] = - depth
|
||||
return arr
|
||||
|
||||
def getHMDBaseMatrix():
|
||||
x_pos = 0.0
|
||||
y_pos = -0.4
|
||||
depth = 1.0
|
||||
x_rotation = 0.0
|
||||
y_rotation = 0.0
|
||||
z_rotation = 0.0
|
||||
arr = getBaseMatrix(x_pos, y_pos, depth, x_rotation, y_rotation, z_rotation)
|
||||
return arr
|
||||
|
||||
def getLeftHandBaseMatrix():
|
||||
x_pos = 0.0
|
||||
y_pos = -0.06
|
||||
depth = -0.14
|
||||
x_rotation = -62.0
|
||||
y_rotation = 154.0
|
||||
z_rotation = 71.0
|
||||
arr = getBaseMatrix(x_pos, y_pos, depth, x_rotation, y_rotation, z_rotation)
|
||||
return arr
|
||||
|
||||
def getRightHandBaseMatrix():
|
||||
x_pos = 0.0
|
||||
y_pos = -0.06
|
||||
depth = -0.14
|
||||
x_rotation = -62.0
|
||||
y_rotation = -154.0
|
||||
z_rotation = -71.0
|
||||
arr = getBaseMatrix(x_pos, y_pos, depth, x_rotation, y_rotation, z_rotation)
|
||||
return arr
|
||||
|
||||
class Overlay:
|
||||
def __init__(self, x, y , depth, display_duration, fadeout_duration, opacity, ui_scaling):
|
||||
def __init__(self, x, y , depth, x_rotation, y_rotation, z_rotation, display_duration, fadeout_duration, opacity, ui_scaling):
|
||||
self.initialized = False
|
||||
settings = {
|
||||
"color": [1, 1, 1],
|
||||
@@ -22,6 +70,9 @@ class Overlay:
|
||||
"x_pos": x,
|
||||
"y_pos": y,
|
||||
"depth": depth,
|
||||
"x_rotation": x_rotation,
|
||||
"y_rotation": y_rotation,
|
||||
"z_rotation": z_rotation,
|
||||
"display_duration": display_duration,
|
||||
"fadeout_duration": fadeout_duration,
|
||||
"ui_scaling": ui_scaling,
|
||||
@@ -39,6 +90,7 @@ class Overlay:
|
||||
try:
|
||||
self.system = openvr.init(openvr.VRApplication_Background)
|
||||
self.overlay = openvr.IVROverlay()
|
||||
self.overlay_system = openvr.IVRSystem()
|
||||
self.handle = self.overlay.createOverlay("Overlay_Speaker2log", "SOverlay_Speaker2log_UI")
|
||||
self.overlay.showOverlay(self.handle)
|
||||
self.initialized = True
|
||||
@@ -49,7 +101,10 @@ class Overlay:
|
||||
self.updateUiScaling(self.settings["ui_scaling"])
|
||||
self.updatePosition(
|
||||
(self.settings["x_pos"], self.settings["y_pos"]),
|
||||
self.settings["depth"]
|
||||
self.settings["depth"],
|
||||
self.settings["x_rotation"],
|
||||
self.settings["y_rotation"],
|
||||
self.settings["z_rotation"],
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
@@ -92,26 +147,43 @@ class Overlay:
|
||||
if self.initialized is True:
|
||||
self.overlay.setOverlayWidthInMeters(self.handle, self.settings['ui_scaling'])
|
||||
|
||||
def updatePosition(self, pos, depth):
|
||||
def updatePosition(self, pos, depth, x_rotation, y_rotation, z_rotation, tracker="HMD"):
|
||||
"""
|
||||
pos is a 2-tuple representing normalized (x, y)
|
||||
depth is a float representing the depth of the icon plane
|
||||
x_rotation, y_rotation, z_rotation are floats representing the rotation of the icon plane
|
||||
"""
|
||||
|
||||
self.settings["x_pos"] = pos[0]
|
||||
self.settings["y_pos"] = pos[1]
|
||||
self.settings["depth"] = depth
|
||||
self.settings["x_rotation"] = x_rotation
|
||||
self.settings["y_rotation"] = y_rotation
|
||||
self.settings["z_rotation"] = z_rotation
|
||||
|
||||
self.transform = mat34Id() # no rotation required for HMD attachment
|
||||
match tracker:
|
||||
case "HMD":
|
||||
base_matrix = getHMDBaseMatrix()
|
||||
trackerIndex = openvr.k_unTrackedDeviceIndex_Hmd
|
||||
case "LeftHand":
|
||||
base_matrix = getLeftHandBaseMatrix()
|
||||
trackerIndex = self.overlay_system.getTrackedDeviceIndexForControllerRole(openvr.TrackedControllerRole_LeftHand)
|
||||
case "RightHand":
|
||||
base_matrix = getRightHandBaseMatrix()
|
||||
trackerIndex = self.overlay_system.getTrackedDeviceIndexForControllerRole(openvr.TrackedControllerRole_RightHand)
|
||||
case _:
|
||||
base_matrix = getHMDBaseMatrix()
|
||||
trackerIndex = openvr.k_unTrackedDeviceIndex_Hmd
|
||||
|
||||
# assign position
|
||||
self.transform[0][3] = self.settings["x_pos"] * self.settings['depth']
|
||||
self.transform[1][3] = self.settings["y_pos"] * self.settings['depth']
|
||||
self.transform[2][3] = - self.settings['depth']
|
||||
translation = (self.settings["x_pos"], self.settings["y_pos"], - self.settings['depth'])
|
||||
rotation = (self.settings["x_rotation"], self.settings["y_rotation"], self.settings["z_rotation"])
|
||||
transform = utils.transform_matrix(base_matrix, translation, rotation)
|
||||
self.transform = mat34Id(transform)
|
||||
|
||||
if self.initialized is True:
|
||||
self.overlay.setOverlayTransformTrackedDeviceRelative(
|
||||
self.handle,
|
||||
openvr.k_unTrackedDeviceIndex_Hmd,
|
||||
trackerIndex,
|
||||
self.transform
|
||||
)
|
||||
|
||||
@@ -187,22 +259,45 @@ class Overlay:
|
||||
return _proc_name in (p.name() for p in process_iter())
|
||||
|
||||
if __name__ == '__main__':
|
||||
from overlay_image import OverlayImage
|
||||
overlay_image = OverlayImage()
|
||||
# from overlay_image import OverlayImage
|
||||
# overlay_image = OverlayImage()
|
||||
|
||||
for i in range(100):
|
||||
print(i)
|
||||
overlay = Overlay(0, 0, 1, 1, 1, 1, 1)
|
||||
overlay.startOverlay()
|
||||
time.sleep(1)
|
||||
# overlay = Overlay(0, 0, 1, 1, 0, 1, 1)
|
||||
# overlay.startOverlay()
|
||||
# time.sleep(1)
|
||||
|
||||
# Example usage
|
||||
img = overlay_image.createOverlayImageShort("こんにちは、世界!さようなら", "Japanese", "Hello,World!Goodbye", "Japanese", ui_type="sakura")
|
||||
overlay.updateImage(img)
|
||||
time.sleep(0.5)
|
||||
# # Example usage
|
||||
# img = overlay_image.createOverlayImageShort("こんにちは、世界!さようなら", "Japanese", "Hello,World!Goodbye", "Japanese")
|
||||
# overlay.updateImage(img)
|
||||
# time.sleep(100000)
|
||||
|
||||
# for i in range(100):
|
||||
# print(i)
|
||||
# overlay = Overlay(0, 0, 1, 1, 1, 1, 1)
|
||||
# overlay.startOverlay()
|
||||
# time.sleep(1)
|
||||
|
||||
img = overlay_image.createOverlayImageShort("こんにちは、世界!さようなら", "Japanese", "Hello,World!Goodbye", "Japanese")
|
||||
overlay.updateImage(img)
|
||||
time.sleep(0.5)
|
||||
# # Example usage
|
||||
# img = overlay_image.createOverlayImageShort("こんにちは、世界!さようなら", "Japanese", "Hello,World!Goodbye", "Japanese", ui_type="sakura")
|
||||
# overlay.updateImage(img)
|
||||
# time.sleep(0.5)
|
||||
|
||||
overlay.shutdownOverlay()
|
||||
# img = overlay_image.createOverlayImageShort("こんにちは、世界!さようなら", "Japanese", "Hello,World!Goodbye", "Japanese")
|
||||
# overlay.updateImage(img)
|
||||
# time.sleep(0.5)
|
||||
|
||||
# overlay.shutdownOverlay()
|
||||
|
||||
x_pos = 0
|
||||
y_pos = 0
|
||||
depth = 0
|
||||
x_rotation = 0
|
||||
y_rotation = 0
|
||||
z_rotation = 0
|
||||
|
||||
base_matrix = getLeftHandBaseMatrix()
|
||||
translation = (x_pos * depth, y_pos * depth, depth)
|
||||
rotation = (x_rotation, y_rotation, z_rotation)
|
||||
transform = utils.transform_matrix(base_matrix, translation, rotation)
|
||||
transform = mat34Id(transform)
|
||||
print(transform)
|
||||
87
models/overlay/overlay_utils.py
Normal file
87
models/overlay/overlay_utils.py
Normal file
@@ -0,0 +1,87 @@
|
||||
import numpy as np
|
||||
|
||||
def toHomogeneous(matrix):
|
||||
homogeneous_matrix = np.vstack([matrix, [0, 0, 0, 1]])
|
||||
return homogeneous_matrix
|
||||
|
||||
# 移動行列を生成する関数
|
||||
def calcTranslationMatrix(translation):
|
||||
tx, ty, tz = translation
|
||||
return np.array([
|
||||
[1, 0, 0, tx],
|
||||
[0, 1, 0, ty],
|
||||
[0, 0, 1, tz],
|
||||
[0, 0, 0, 1]
|
||||
])
|
||||
|
||||
# X軸周りの回転行列を生成する関数
|
||||
def calcRotationMatrixX(angle):
|
||||
c = np.cos(np.pi/180*angle)
|
||||
s = np.sin(np.pi/180*angle)
|
||||
return np.array([
|
||||
[1, 0, 0, 0],
|
||||
[0, c, -s, 0],
|
||||
[0, s, c, 0],
|
||||
[0, 0, 0, 1]
|
||||
])
|
||||
|
||||
# Y軸周りの回転行列を生成する関数
|
||||
def calcRotationMatrixY(angle):
|
||||
c = np.cos(np.pi/180*angle)
|
||||
s = np.sin(np.pi/180*angle)
|
||||
return np.array([
|
||||
[c, 0, s, 0],
|
||||
[0, 1, 0, 0],
|
||||
[-s, 0, c, 0],
|
||||
[0, 0, 0, 1]
|
||||
])
|
||||
|
||||
# Z軸周りの回転行列を生成する関数
|
||||
def calcRotationMatrixZ(angle):
|
||||
c = np.cos(np.pi/180*angle)
|
||||
s = np.sin(np.pi/180*angle)
|
||||
return np.array([
|
||||
[c, -s, 0, 0],
|
||||
[s, c, 0, 0],
|
||||
[0, 0, 1, 0],
|
||||
[0, 0, 0, 1]
|
||||
])
|
||||
|
||||
# 3x4行列の座標を基準として回転や移動を行う関数
|
||||
def transform_matrix(base_matrix, translation, rotation):
|
||||
homogeneous_base_matrix = toHomogeneous(base_matrix)
|
||||
translation_matrix = calcTranslationMatrix(translation)
|
||||
rotation_matrix_x = calcRotationMatrixX(rotation[0])
|
||||
rotation_matrix_y = calcRotationMatrixY(rotation[1])
|
||||
rotation_matrix_z = calcRotationMatrixZ(rotation[2])
|
||||
rotation_matrix = np.dot(rotation_matrix_z, np.dot(rotation_matrix_y, rotation_matrix_x))
|
||||
transformation_matrix = translation_matrix.copy()
|
||||
transformation_matrix[:3, :3] = rotation_matrix[:3, :3]
|
||||
result_matrix = np.dot(homogeneous_base_matrix, transformation_matrix)
|
||||
return result_matrix[:3, :]
|
||||
|
||||
def euler_to_rotation_matrix(angles):
|
||||
phi = angles[0] * np.pi / 180
|
||||
theta = angles[1] * np.pi / 180
|
||||
psi = angles[2]* np.pi / 180
|
||||
R_x = np.array([[1, 0, 0],
|
||||
[0, np.cos(phi), -np.sin(phi)],
|
||||
[0, np.sin(phi), np.cos(phi)]])
|
||||
R_y = np.array([[np.cos(theta), 0, np.sin(theta)],
|
||||
[0, 1, 0],
|
||||
[-np.sin(theta), 0, np.cos(theta)]])
|
||||
R_z = np.array([[np.cos(psi), -np.sin(psi), 0],
|
||||
[np.sin(psi), np.cos(psi), 0],
|
||||
[0, 0, 1]])
|
||||
return np.dot(R_z, np.dot(R_y, R_x))
|
||||
|
||||
if __name__ == "__main__":
|
||||
base_matrix = np.array([
|
||||
[1, 0, 0, 1],
|
||||
[0, 1, 0, 1],
|
||||
[0, 0, 1, 1]
|
||||
])
|
||||
translation = [1, 2, 3]
|
||||
rotation = [0, 0, 90]
|
||||
result_matrix = transform_matrix(base_matrix, translation, rotation)
|
||||
print(result_matrix)
|
||||
53
view.py
53
view.py
@@ -169,23 +169,42 @@ class View():
|
||||
CALLBACK_SET_OVERLAY_SMALL_LOG_SETTINGS=None,
|
||||
|
||||
VAR_LABEL_OVERLAY_SMALL_LOG_X_POS=StringVar(value=i18n.t("overlay_settings.x_position")),
|
||||
SLIDER_RANGE_OVERLAY_SMALL_LOG_X_POS=(-0.5, 0.5),
|
||||
NUMBER_OF_STEPS_OVERLAY_SMALL_LOG_X_POS=100,
|
||||
SLIDER_RANGE_OVERLAY_SMALL_LOG_X_POS=(-5, 5),
|
||||
NUMBER_OF_STEPS_OVERLAY_SMALL_LOG_X_POS=10000,
|
||||
VAR_OVERLAY_SMALL_LOG_X_POS=DoubleVar(value=config.OVERLAY_SMALL_LOG_SETTINGS["x_pos"]),
|
||||
VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_X_POS=StringVar(value=config.OVERLAY_SMALL_LOG_SETTINGS["x_pos"]),
|
||||
|
||||
VAR_LABEL_OVERLAY_SMALL_LOG_Y_POS=StringVar(value=i18n.t("overlay_settings.y_position")),
|
||||
SLIDER_RANGE_OVERLAY_SMALL_LOG_Y_POS=(-0.8, 0.8),
|
||||
NUMBER_OF_STEPS_OVERLAY_SMALL_LOG_Y_POS=160,
|
||||
SLIDER_RANGE_OVERLAY_SMALL_LOG_Y_POS=(-5, 5),
|
||||
NUMBER_OF_STEPS_OVERLAY_SMALL_LOG_Y_POS=10000,
|
||||
VAR_OVERLAY_SMALL_LOG_Y_POS=DoubleVar(value=config.OVERLAY_SMALL_LOG_SETTINGS["y_pos"]),
|
||||
VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_Y_POS=StringVar(value=config.OVERLAY_SMALL_LOG_SETTINGS["y_pos"]),
|
||||
|
||||
VAR_LABEL_OVERLAY_SMALL_LOG_DEPTH=StringVar(value=i18n.t("overlay_settings.depth")),
|
||||
SLIDER_RANGE_OVERLAY_SMALL_LOG_DEPTH=(0.5, 1.5),
|
||||
NUMBER_OF_STEPS_OVERLAY_SMALL_LOG_DEPTH=100,
|
||||
SLIDER_RANGE_OVERLAY_SMALL_LOG_DEPTH=(-5, 5),
|
||||
NUMBER_OF_STEPS_OVERLAY_SMALL_LOG_DEPTH=10000,
|
||||
VAR_OVERLAY_SMALL_LOG_DEPTH=DoubleVar(value=config.OVERLAY_SMALL_LOG_SETTINGS["depth"]),
|
||||
VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_DEPTH=StringVar(value=config.OVERLAY_SMALL_LOG_SETTINGS["depth"]),
|
||||
|
||||
VAR_LABEL_OVERLAY_SMALL_LOG_X_ROTATION=StringVar(value=i18n.t("overlay_settings.x_rotation")),
|
||||
SLIDER_RANGE_OVERLAY_SMALL_LOG_X_ROTATION=(-180, 180),
|
||||
NUMBER_OF_STEPS_OVERLAY_SMALL_LOG_X_ROTATION=360,
|
||||
VAR_OVERLAY_SMALL_LOG_X_ROTATION=DoubleVar(value=config.OVERLAY_SMALL_LOG_SETTINGS["x_rotation"]),
|
||||
VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_X_ROTATION=StringVar(value=config.OVERLAY_SMALL_LOG_SETTINGS["x_rotation"]),
|
||||
|
||||
VAR_LABEL_OVERLAY_SMALL_LOG_Y_ROTATION=StringVar(value=i18n.t("overlay_settings.y_rotation")),
|
||||
SLIDER_RANGE_OVERLAY_SMALL_LOG_Y_ROTATION=(-180, 180),
|
||||
NUMBER_OF_STEPS_OVERLAY_SMALL_LOG_Y_ROTATION=360,
|
||||
VAR_OVERLAY_SMALL_LOG_Y_ROTATION=DoubleVar(value=config.OVERLAY_SMALL_LOG_SETTINGS["y_rotation"]),
|
||||
VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_Y_ROTATION=StringVar(value=config.OVERLAY_SMALL_LOG_SETTINGS["y_rotation"]),
|
||||
|
||||
VAR_LABEL_OVERLAY_SMALL_LOG_Z_ROTATION=StringVar(value=i18n.t("overlay_settings.z_rotation")),
|
||||
SLIDER_RANGE_OVERLAY_SMALL_LOG_Z_ROTATION=(-180, 180),
|
||||
NUMBER_OF_STEPS_OVERLAY_SMALL_LOG_Z_ROTATION=360,
|
||||
VAR_OVERLAY_SMALL_LOG_Z_ROTATION=DoubleVar(value=config.OVERLAY_SMALL_LOG_SETTINGS["z_rotation"]),
|
||||
VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_Z_ROTATION=StringVar(value=config.OVERLAY_SMALL_LOG_SETTINGS["z_rotation"]),
|
||||
|
||||
|
||||
VAR_LABEL_OVERLAY_SMALL_LOG_DISPLAY_DURATION=StringVar(value=i18n.t("overlay_settings.display_duration")),
|
||||
SLIDER_RANGE_OVERLAY_SMALL_LOG_DISPLAY_DURATION=(1, 60),
|
||||
NUMBER_OF_STEPS_OVERLAY_SMALL_LOG_DISPLAY_DURATION=59,
|
||||
@@ -1146,8 +1165,11 @@ class View():
|
||||
}
|
||||
INIT_OVERLAY_SMALL_LOG_SETTINGS = {
|
||||
"x_pos": 0.0,
|
||||
"y_pos": -0.41,
|
||||
"depth": 1.0,
|
||||
"y_pos": 0.0,
|
||||
"depth": 0.0,
|
||||
"x_rotation": 0.0,
|
||||
"y_rotation": 0.0,
|
||||
"z_rotation": 0.0,
|
||||
"display_duration": 5,
|
||||
"fadeout_duration": 2,
|
||||
}
|
||||
@@ -1163,6 +1185,9 @@ class View():
|
||||
self.setLatestConfigVariable("OverlaySmallLogXPos")
|
||||
self.setLatestConfigVariable("OverlaySmallLogYPos")
|
||||
self.setLatestConfigVariable("OverlaySmallLogDepth")
|
||||
self.setLatestConfigVariable("OverlaySmallLogXRotation")
|
||||
self.setLatestConfigVariable("OverlaySmallLogYRotation")
|
||||
self.setLatestConfigVariable("OverlaySmallLogZRotation")
|
||||
self.setLatestConfigVariable("OverlaySmallLogDisplayDuration")
|
||||
self.setLatestConfigVariable("OverlaySmallLogFadeoutDuration")
|
||||
|
||||
@@ -1929,6 +1954,18 @@ class View():
|
||||
self.view_variable.VAR_OVERLAY_SMALL_LOG_DEPTH.set(config.OVERLAY_SMALL_LOG_SETTINGS["depth"])
|
||||
self.view_variable.VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_DEPTH.set(config.OVERLAY_SMALL_LOG_SETTINGS["depth"])
|
||||
|
||||
case "OverlaySmallLogXRotation":
|
||||
self.view_variable.VAR_OVERLAY_SMALL_LOG_X_ROTATION.set(config.OVERLAY_SMALL_LOG_SETTINGS["x_rotation"])
|
||||
self.view_variable.VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_X_ROTATION.set(config.OVERLAY_SMALL_LOG_SETTINGS["x_rotation"])
|
||||
|
||||
case "OverlaySmallLogYRotation":
|
||||
self.view_variable.VAR_OVERLAY_SMALL_LOG_Y_ROTATION.set(config.OVERLAY_SMALL_LOG_SETTINGS["y_rotation"])
|
||||
self.view_variable.VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_Y_ROTATION.set(config.OVERLAY_SMALL_LOG_SETTINGS["y_rotation"])
|
||||
|
||||
case "OverlaySmallLogZRotation":
|
||||
self.view_variable.VAR_OVERLAY_SMALL_LOG_Z_ROTATION.set(config.OVERLAY_SMALL_LOG_SETTINGS["z_rotation"])
|
||||
self.view_variable.VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_Z_ROTATION.set(config.OVERLAY_SMALL_LOG_SETTINGS["z_rotation"])
|
||||
|
||||
case "OverlaySmallLogDisplayDuration":
|
||||
self.view_variable.VAR_OVERLAY_SMALL_LOG_DISPLAY_DURATION.set(config.OVERLAY_SMALL_LOG_SETTINGS["display_duration"])
|
||||
self.view_variable.VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_DISPLAY_DURATION.set(f"{config.OVERLAY_SMALL_LOG_SETTINGS['display_duration']} second(s)")
|
||||
|
||||
@@ -19,6 +19,7 @@ class QuickSettingsWindow(CTkToplevel):
|
||||
self.configure(fg_color=self.settings.ctm.SB__BG_COLOR)
|
||||
|
||||
BG_HEX_COLOR = "#292a2d"
|
||||
self.grid_columnconfigure(0, weight=1)
|
||||
|
||||
self.qsw_background = CTkFrame(self, corner_radius=0, fg_color=self.settings.ctm.SB__BG_COLOR)
|
||||
self.qsw_background.grid(row=0, column=0, pady=0, sticky="ew")
|
||||
@@ -163,6 +164,64 @@ class QuickSettingsWindow(CTkToplevel):
|
||||
self.qsb__overlay_small_log_settings_depth.grid(row=row)
|
||||
|
||||
|
||||
|
||||
row+=1
|
||||
def overlaySmallLogSettingsXRotationSliderCallback(e):
|
||||
value = round(e,2)
|
||||
callFunctionIfCallable(view_variable.CALLBACK_SET_OVERLAY_SMALL_LOG_SETTINGS, value, "x_rotation")
|
||||
view_variable.VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_X_ROTATION.set(str(value))
|
||||
|
||||
self.qsb__overlay_small_log_settings_x_rotation = createSettingBoxSlider(
|
||||
for_var_label_text=view_variable.VAR_LABEL_OVERLAY_SMALL_LOG_X_ROTATION,
|
||||
for_var_current_value=view_variable.VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_X_ROTATION,
|
||||
slider_attr_name="qsb__overlay_small_log_settings_x_rotation_slider",
|
||||
slider_range=view_variable.SLIDER_RANGE_OVERLAY_SMALL_LOG_X_ROTATION,
|
||||
slider_number_of_steps=view_variable.NUMBER_OF_STEPS_OVERLAY_SMALL_LOG_X_ROTATION,
|
||||
command=overlaySmallLogSettingsXRotationSliderCallback,
|
||||
variable=view_variable.VAR_OVERLAY_SMALL_LOG_X_ROTATION,
|
||||
)
|
||||
self.qsb__overlay_small_log_settings_x_rotation.grid(row=row)
|
||||
|
||||
|
||||
|
||||
row+=1
|
||||
def overlaySmallLogSettingsYRotationSliderCallback(e):
|
||||
value = round(e,2)
|
||||
callFunctionIfCallable(view_variable.CALLBACK_SET_OVERLAY_SMALL_LOG_SETTINGS, value, "y_rotation")
|
||||
view_variable.VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_Y_ROTATION.set(str(value))
|
||||
|
||||
self.qsb__overlay_small_log_settings_y_rotation = createSettingBoxSlider(
|
||||
for_var_label_text=view_variable.VAR_LABEL_OVERLAY_SMALL_LOG_Y_ROTATION,
|
||||
for_var_current_value=view_variable.VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_Y_ROTATION,
|
||||
slider_attr_name="qsb__overlay_small_log_settings_y_rotation_slider",
|
||||
slider_range=view_variable.SLIDER_RANGE_OVERLAY_SMALL_LOG_Y_ROTATION,
|
||||
slider_number_of_steps=view_variable.NUMBER_OF_STEPS_OVERLAY_SMALL_LOG_Y_ROTATION,
|
||||
command=overlaySmallLogSettingsYRotationSliderCallback,
|
||||
variable=view_variable.VAR_OVERLAY_SMALL_LOG_Y_ROTATION,
|
||||
)
|
||||
self.qsb__overlay_small_log_settings_y_rotation.grid(row=row)
|
||||
|
||||
|
||||
|
||||
row+=1
|
||||
def overlaySmallLogSettingsZRotationSliderCallback(e):
|
||||
value = round(e,2)
|
||||
callFunctionIfCallable(view_variable.CALLBACK_SET_OVERLAY_SMALL_LOG_SETTINGS, value, "z_rotation")
|
||||
view_variable.VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_Z_ROTATION.set(str(value))
|
||||
|
||||
self.qsb__overlay_small_log_settings_z_rotation = createSettingBoxSlider(
|
||||
for_var_label_text=view_variable.VAR_LABEL_OVERLAY_SMALL_LOG_Z_ROTATION,
|
||||
for_var_current_value=view_variable.VAR_CURRENT_VALUE_OVERLAY_SMALL_LOG_Z_ROTATION,
|
||||
slider_attr_name="qsb__overlay_small_log_settings_z_rotation_slider",
|
||||
slider_range=view_variable.SLIDER_RANGE_OVERLAY_SMALL_LOG_Z_ROTATION,
|
||||
slider_number_of_steps=view_variable.NUMBER_OF_STEPS_OVERLAY_SMALL_LOG_Z_ROTATION,
|
||||
command=overlaySmallLogSettingsZRotationSliderCallback,
|
||||
variable=view_variable.VAR_OVERLAY_SMALL_LOG_Z_ROTATION,
|
||||
)
|
||||
self.qsb__overlay_small_log_settings_z_rotation.grid(row=row)
|
||||
|
||||
|
||||
|
||||
row+=1
|
||||
def overlaySmallLogSettingsDisplayDurationSliderCallback(e):
|
||||
value = int(e)
|
||||
|
||||
Reference in New Issue
Block a user