👍️[Update] Model : OverlayのUIを調整
This commit is contained in:
@@ -47,9 +47,9 @@ def getHMDBaseMatrix():
|
|||||||
return arr
|
return arr
|
||||||
|
|
||||||
def getLeftHandBaseMatrix():
|
def getLeftHandBaseMatrix():
|
||||||
x_pos = 0.1
|
x_pos = 0.3
|
||||||
y_pos = 0.1
|
y_pos = 0.1
|
||||||
z_pos = -0.2
|
z_pos = -0.31
|
||||||
x_rotation = -65.0
|
x_rotation = -65.0
|
||||||
y_rotation = 165.0
|
y_rotation = 165.0
|
||||||
z_rotation = 115.0
|
z_rotation = 115.0
|
||||||
@@ -57,12 +57,12 @@ def getLeftHandBaseMatrix():
|
|||||||
return arr
|
return arr
|
||||||
|
|
||||||
def getRightHandBaseMatrix():
|
def getRightHandBaseMatrix():
|
||||||
x_pos = 0.0
|
x_pos = -0.3
|
||||||
y_pos = -0.06
|
y_pos = 0.1
|
||||||
z_pos = -0.14
|
z_pos = -0.31
|
||||||
x_rotation = -62.0
|
x_rotation = -65.0
|
||||||
y_rotation = -154.0
|
y_rotation = -165.0
|
||||||
z_rotation = -71.0
|
z_rotation = -115.0
|
||||||
arr = getBaseMatrix(x_pos, y_pos, z_pos, x_rotation, y_rotation, z_rotation)
|
arr = getBaseMatrix(x_pos, y_pos, z_pos, x_rotation, y_rotation, z_rotation)
|
||||||
return arr
|
return arr
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ class Overlay:
|
|||||||
def updateUiScaling(self, ui_scaling, size):
|
def updateUiScaling(self, ui_scaling, size):
|
||||||
self.settings[size]["ui_scaling"] = ui_scaling
|
self.settings[size]["ui_scaling"] = ui_scaling
|
||||||
if self.initialized is True:
|
if self.initialized is True:
|
||||||
if "large" == size:
|
if size == "large":
|
||||||
self.overlay.setOverlayWidthInMeters(self.handle[size], self.settings[size]["ui_scaling"]*0.25)
|
self.overlay.setOverlayWidthInMeters(self.handle[size], self.settings[size]["ui_scaling"]*0.25)
|
||||||
else:
|
else:
|
||||||
self.overlay.setOverlayWidthInMeters(self.handle[size], self.settings[size]["ui_scaling"])
|
self.overlay.setOverlayWidthInMeters(self.handle[size], self.settings[size]["ui_scaling"])
|
||||||
@@ -289,6 +289,9 @@ class Overlay:
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
from overlay_image import OverlayImage
|
from overlay_image import OverlayImage
|
||||||
|
import logging
|
||||||
|
|
||||||
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
||||||
small_settings = {
|
small_settings = {
|
||||||
"x_pos": 0.0,
|
"x_pos": 0.0,
|
||||||
@@ -297,10 +300,10 @@ if __name__ == "__main__":
|
|||||||
"x_rotation": 0.0,
|
"x_rotation": 0.0,
|
||||||
"y_rotation": 0.0,
|
"y_rotation": 0.0,
|
||||||
"z_rotation": 0.0,
|
"z_rotation": 0.0,
|
||||||
"display_duration": 5,
|
"display_duration": 0,
|
||||||
"fadeout_duration": 2,
|
"fadeout_duration": 100,
|
||||||
"opacity": 1.0,
|
"opacity": 1.0,
|
||||||
"ui_scaling": 0.5,
|
"ui_scaling": 1.0,
|
||||||
"tracker": "HMD",
|
"tracker": "HMD",
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,11 +314,11 @@ if __name__ == "__main__":
|
|||||||
"x_rotation": 0.0,
|
"x_rotation": 0.0,
|
||||||
"y_rotation": 0.0,
|
"y_rotation": 0.0,
|
||||||
"z_rotation": 0.0,
|
"z_rotation": 0.0,
|
||||||
"display_duration": 5,
|
"display_duration": 0,
|
||||||
"fadeout_duration": 0,
|
"fadeout_duration": 100,
|
||||||
"opacity": 1.0,
|
"opacity": 1.0,
|
||||||
"ui_scaling": 0.5,
|
"ui_scaling": 1.0,
|
||||||
"tracker": "LeftHand",
|
"tracker": "RightHand",
|
||||||
}
|
}
|
||||||
|
|
||||||
settings_dict = {
|
settings_dict = {
|
||||||
@@ -323,6 +326,9 @@ if __name__ == "__main__":
|
|||||||
"large": large_settings
|
"large": large_settings
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# オーバーレイの初期化設定を確認
|
||||||
|
logging.debug(f"Settings Dict: {settings_dict}")
|
||||||
|
|
||||||
overlay_image = OverlayImage()
|
overlay_image = OverlayImage()
|
||||||
overlay = Overlay(settings_dict)
|
overlay = Overlay(settings_dict)
|
||||||
overlay.startOverlay()
|
overlay.startOverlay()
|
||||||
@@ -331,19 +337,31 @@ if __name__ == "__main__":
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
# Example usage
|
# Example usage
|
||||||
img = overlay_image.createOverlayImageLargeLog("send", "こんにちは、世界!さようなら", "Japanese", "Hello,World!Goodbye", "Japanese")
|
|
||||||
overlay.updateImage(img, "large")
|
|
||||||
|
|
||||||
for i in range(100):
|
for i in range(100):
|
||||||
print(i)
|
try:
|
||||||
# Example usage
|
img = overlay_image.createOverlayImageLargeLog("send", f"こんにちは、世界!さようなら {i}", "Japanese", "Hello,World!Goodbye", "Japanese")
|
||||||
img = overlay_image.createOverlayImageSmallLog(f"こんにちは、世界!さようなら_{i}", "Japanese", "Hello,World!Goodbye", "Japanese")
|
logging.debug(f"Generated Image: {img}")
|
||||||
overlay.updateImage(img, "small")
|
overlay.updateImage(img, "large")
|
||||||
time.sleep(5)
|
img = overlay_image.createOverlayImageSmallLog(f"こんにちは、世界!さようなら_{i}", "Japanese", "Hello,World!Goodbye", "Japanese")
|
||||||
|
overlay.updateImage(img, "small")
|
||||||
|
time.sleep(1)
|
||||||
|
except openvr.error_code.OverlayError_InvalidParameter as e:
|
||||||
|
logging.error(f"OverlayError_InvalidParameter: {e}")
|
||||||
|
break
|
||||||
|
except Exception as e:
|
||||||
|
logging.error(f"Unexpected error: {e}")
|
||||||
|
break
|
||||||
|
|
||||||
if i%2 == 0:
|
# for i in range(100):
|
||||||
overlay.updatePosition(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, "HMD", "small")
|
# print(i)
|
||||||
else:
|
# # Example usage
|
||||||
overlay.updatePosition(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, "RightHand", "small")
|
# img = overlay_image.createOverlayImageSmallLog(f"こんにちは、世界!さようなら_{i}", "Japanese", "Hello,World!Goodbye", "Japanese")
|
||||||
|
# overlay.updateImage(img, "small")
|
||||||
|
# time.sleep(5)
|
||||||
|
|
||||||
|
# if i%2 == 0:
|
||||||
|
# overlay.updatePosition(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, "HMD", "small")
|
||||||
|
# else:
|
||||||
|
# overlay.updatePosition(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, "RightHand", "small")
|
||||||
|
|
||||||
overlay.shutdownOverlay()
|
overlay.shutdownOverlay()
|
||||||
@@ -96,13 +96,13 @@ class OverlayImage:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def getUiSizeLargeLog() -> dict:
|
def getUiSizeLargeLog() -> dict:
|
||||||
return {
|
return {
|
||||||
"width": 960*4,
|
"width": 960,
|
||||||
"font_size_large": 30*4,
|
"font_size_large": 30,
|
||||||
"font_size_small": 20*4,
|
"font_size_small": 20,
|
||||||
"margin": 25*4,
|
"margin": 25,
|
||||||
"radius": 25*4,
|
"radius": 25,
|
||||||
"padding": 10*4,
|
"padding": 10,
|
||||||
"clause_margin": 20*4,
|
"clause_margin": 20,
|
||||||
}
|
}
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -211,8 +211,8 @@ class OverlayImage:
|
|||||||
"datetime": datetime.now().strftime("%H:%M")
|
"datetime": datetime.now().strftime("%H:%M")
|
||||||
})
|
})
|
||||||
|
|
||||||
if len(self.message_log) > 10:
|
if len(self.message_log) > 5:
|
||||||
self.message_log = self.message_log[-10:]
|
self.message_log = self.message_log[-5:]
|
||||||
|
|
||||||
imgs = [
|
imgs = [
|
||||||
self.createTextboxLargeLog(
|
self.createTextboxLargeLog(
|
||||||
|
|||||||
Reference in New Issue
Block a user