Implemented main & overrides
This commit is contained in:
9
cameraOverrides.json
Normal file
9
cameraOverrides.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"/usercamera/Mode": 4,
|
||||||
|
"/usercamera/Exposure": 0.0,
|
||||||
|
"/usercamera/Zoom": 45.0,
|
||||||
|
"/usercamera/FlySpeed": 0.4,
|
||||||
|
"/usercamera/TurnSpeed": 1.0,
|
||||||
|
"/avatar/parameters/VF110_FacePuppetHorizontal": -1.0,
|
||||||
|
"/avatar/parameters/VF110_FacePuppetVertical": 0
|
||||||
|
}
|
||||||
39
main.py
Normal file
39
main.py
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
"""
|
||||||
|
VRCCC (VRChat Custom Camera) is a simple Python script to
|
||||||
|
override camera options in VRChat using OSC.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
|
from pythonosc import udp_client, osc_server
|
||||||
|
from pythonosc.dispatcher import Dispatcher
|
||||||
|
|
||||||
|
from camera import Camera
|
||||||
|
|
||||||
|
overrides = {}
|
||||||
|
|
||||||
|
def onCameraEnabled(cam: Camera):
|
||||||
|
"""
|
||||||
|
Camera enabled callback.
|
||||||
|
This will load the overrides.
|
||||||
|
"""
|
||||||
|
|
||||||
|
for address, value in overrides.items():
|
||||||
|
cam.oscClient.send_message(address, value)
|
||||||
|
|
||||||
|
with open('cameraOverrides.json', 'r', encoding='utf-8') as f:
|
||||||
|
overrides = json.loads(f.read())
|
||||||
|
|
||||||
|
client = udp_client.SimpleUDPClient('127.0.0.1', 9000, timeout=2.5)
|
||||||
|
dispatcher = Dispatcher()
|
||||||
|
camera = Camera(dispatcher, client, onCameraEnabled)
|
||||||
|
server = osc_server.ThreadingOSCUDPServer(('127.0.0.1', 9001), dispatcher, timeout=2.5)
|
||||||
|
|
||||||
|
try:
|
||||||
|
server.serve_forever() # Serve, queen 💅
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
pass
|
||||||
|
|
||||||
|
camera.close()
|
||||||
|
server.server_close()
|
||||||
|
client.close()
|
||||||
Reference in New Issue
Block a user