mirror of
https://github.com/EyeTrackVR/EyeTrackVR.git
synced 2025-11-04 14:39:42 +08:00
OSC refresh
This commit is contained in:
parent
5dbe549bfb
commit
662bfc91d7
@ -301,13 +301,16 @@ class CameraWidget:
|
|||||||
visy = abs(eye_info.y)
|
visy = abs(eye_info.y)
|
||||||
elif eye_info.y >= 0:
|
elif eye_info.y >= 0:
|
||||||
visy = -abs(eye_info.y)
|
visy = -abs(eye_info.y)
|
||||||
|
try:
|
||||||
|
|
||||||
graph.draw_circle(
|
graph.draw_circle(
|
||||||
(eye_info.x * -100, visy * -100),
|
(eye_info.x * -100, visy * -100),
|
||||||
25,
|
25,
|
||||||
fill_color="black",
|
fill_color="black",
|
||||||
line_color="white",
|
line_color="white",
|
||||||
)
|
)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
elif eye_info.blink:
|
elif eye_info.blink:
|
||||||
graph.update(background_color="#6f4ca1")
|
graph.update(background_color="#6f4ca1")
|
||||||
elif eye_info.info_type == InformationOrigin.FAILURE:
|
elif eye_info.info_type == InformationOrigin.FAILURE:
|
||||||
|
|||||||
@ -25,10 +25,11 @@ class VRChatOSC:
|
|||||||
self.client = udp_client.SimpleUDPClient(VRChatOSC.OSC_IP, VRChatOSC.OSC_PORT)
|
self.client = udp_client.SimpleUDPClient(VRChatOSC.OSC_IP, VRChatOSC.OSC_PORT)
|
||||||
self.cancellation_event = cancellation_event
|
self.cancellation_event = cancellation_event
|
||||||
self.msg_queue = msg_queue
|
self.msg_queue = msg_queue
|
||||||
|
|
||||||
yl = 0
|
yl = 0
|
||||||
yr = 0
|
yr = 0
|
||||||
|
|
||||||
sx = 0
|
sx = 0
|
||||||
|
sy = 0
|
||||||
se = 0
|
se = 0
|
||||||
|
|
||||||
|
|
||||||
@ -45,66 +46,75 @@ class VRChatOSC:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if not eye_info.blink:
|
if not eye_info.blink:
|
||||||
|
|
||||||
|
if was_blinking == True:
|
||||||
|
if eye_id in [EyeId.LEFT, EyeId.BOTH]:
|
||||||
|
self.client.send_message("/avatar/parameters/LeftEyeLid", float(0)) # old param open left
|
||||||
|
self.client.send_message("/avatar/parameters/LeftEyeLidExpandedSqueeze", float(0.8)) # open left eye
|
||||||
|
|
||||||
|
if eye_id in [EyeId.RIGHT, EyeId.BOTH]:
|
||||||
|
self.client.send_message("/avatar/parameters/RightEyeLid", float(0)) # old param open right, will be in the next few releases to not break things
|
||||||
|
self.client.send_message("/avatar/parameters/RightEyeLidExpandedSqueeze", float(0.8)) # open right eye
|
||||||
|
|
||||||
|
if se == 1:
|
||||||
|
self.client.send_message("/avatar/parameters/RightEyeLid", float(0))# old param open right
|
||||||
|
self.client.send_message("/avatar/parameters/LeftEyeLid", float(0))# old param open left
|
||||||
|
self.client.send_message("/avatar/parameters/RightEyeLidExpandedSqueeze", float(0.8)) # open right eye
|
||||||
|
self.client.send_message("/avatar/parameters/LeftEyeLidExpandedSqueeze", float(0.8)) # open left eye
|
||||||
|
was_blinking = False
|
||||||
|
|
||||||
if eye_id in [EyeId.RIGHT, EyeId.BOTH]:
|
if eye_id in [EyeId.RIGHT, EyeId.BOTH]:
|
||||||
sx = eye_info.x
|
sx = eye_info.x
|
||||||
self.client.send_message(
|
yr, sy = eye_info.y
|
||||||
"/avatar/parameters/RightEyeX", eye_info.x
|
self.client.send_message("/avatar/parameters/RightEyeX", eye_info.x)
|
||||||
)
|
|
||||||
# self.client.send_message(
|
# self.client.send_message(
|
||||||
# "/avatar/parameters/EyesDilation", eye_info.pupil_dialation
|
# "/avatar/parameters/EyesDilation", eye_info.pupil_dialation
|
||||||
#)
|
#)
|
||||||
if eye_id in [EyeId.LEFT, EyeId.BOTH]:
|
elif eye_id in [EyeId.LEFT, EyeId.BOTH]:
|
||||||
sx = eye_info.x
|
sx = eye_info.x
|
||||||
self.client.send_message(
|
yl, sy = eye_info.y
|
||||||
"/avatar/parameters/LeftEyeX", eye_info.x
|
self.client.send_message("/avatar/parameters/LeftEyeX", eye_info.x)
|
||||||
)
|
|
||||||
|
|
||||||
if eye_id in [EyeId.LEFT, EyeId.BOTH]:
|
if yr != 0 and yl != 0:
|
||||||
yl = eye_info.y
|
|
||||||
|
|
||||||
if eye_id in [EyeId.RIGHT, EyeId.BOTH]:
|
|
||||||
yr = eye_info.y
|
|
||||||
|
|
||||||
try:
|
|
||||||
y = (yr + yl) / 2
|
y = (yr + yl) / 2
|
||||||
self.client.send_message("/avatar/parameters/EyesY", y)
|
self.client.send_message("/avatar/parameters/EyesY", y)
|
||||||
se = 0
|
se = 0
|
||||||
except:
|
|
||||||
|
else:
|
||||||
se = 1
|
se = 1
|
||||||
self.client.send_message("/avatar/parameters/LeftEyeX", sx) # only one eye is detected or there is an error. Send mirrored data to both eyes.
|
self.client.send_message("/avatar/parameters/LeftEyeX", sx) # only one eye is detected or there is an error. Send mirrored data to both eyes.
|
||||||
self.client.send_message("/avatar/parameters/RightEyeX", sx)
|
self.client.send_message("/avatar/parameters/RightEyeX", sx)
|
||||||
self.client.send_message("/avatar/parameters/RightEyeLid", float(0))
|
self.client.send_message("/avatar/parameters/EyesY", sy)
|
||||||
self.client.send_message("/avatar/parameters/LeftEyeLid", float(0))
|
|
||||||
|
|
||||||
|
|
||||||
if eye_id in [EyeId.LEFT, EyeId.BOTH]:
|
if eye_id in [EyeId.LEFT, EyeId.BOTH]:
|
||||||
|
|
||||||
self.client.send_message(
|
self.client.send_message("/avatar/parameters/LeftEyeLid", float(0))
|
||||||
"/avatar/parameters/LeftEyeLid", float(0)
|
|
||||||
)
|
self.client.send_message("/avatar/parameters/LeftEyeLidExpandedSqueeze", float(0.8))
|
||||||
|
|
||||||
if eye_id in [EyeId.RIGHT, EyeId.BOTH]:
|
if eye_id in [EyeId.RIGHT, EyeId.BOTH]:
|
||||||
|
|
||||||
self.client.send_message(
|
self.client.send_message("/avatar/parameters/RightEyeLid", float(0)) # old param, will be in the next few releases to not break things
|
||||||
"/avatar/parameters/RightEyeLid", float(0)
|
|
||||||
)
|
self.client.send_message("/avatar/parameters/RightEyeLidExpandedSqueeze", float(0.8))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
if eye_id in [EyeId.LEFT, EyeId.BOTH]:
|
if eye_id in [EyeId.LEFT, EyeId.BOTH]:
|
||||||
|
|
||||||
self.client.send_message(
|
|
||||||
"/avatar/parameters/LeftEyeLid", float(1)
|
|
||||||
)
|
|
||||||
if eye_id in [EyeId.RIGHT, EyeId.BOTH]:
|
|
||||||
|
|
||||||
self.client.send_message(
|
|
||||||
"/avatar/parameters/RightEyeLid", float(1)
|
|
||||||
)
|
|
||||||
if se == 1:
|
|
||||||
self.client.send_message("/avatar/parameters/RightEyeLid", float(1))
|
|
||||||
self.client.send_message("/avatar/parameters/LeftEyeLid", float(1))
|
self.client.send_message("/avatar/parameters/LeftEyeLid", float(1))
|
||||||
|
|
||||||
|
elif eye_id in [EyeId.RIGHT, EyeId.BOTH]:
|
||||||
|
self.client.send_message("/avatar/parameters/RightEyeLid", float(1))
|
||||||
|
|
||||||
|
else:
|
||||||
|
self.client.send_message("/avatar/parameters/RightEyeLid", float(1)) #close eye
|
||||||
|
self.client.send_message("/avatar/parameters/LeftEyeLid", float(1))
|
||||||
|
self.client.send_message("/avatar/parameters/RightEyeLidExpandedSqueeze", float(0)) # close eye
|
||||||
|
self.client.send_message("/avatar/parameters/LeftEyeLidExpandedSqueeze", float(0))
|
||||||
|
was_blinking = True
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user