Instantly share code, notes, and snippets.

What would you like to do?
OSC with C4D
# Dependencies
# pyOSC:
# SimpleOSC:
# SimpleOSC is wrapper of pyOSC indeed. So this code might be able to be written much briefly.
import c4d
import SimpleOSC as osc
from OSC import OSCClient, OSCMessage
oscToNW = None
focalLength = 17
def onFrameChanged(addr, tags, data, source):
global oscToNW, focalLength, imaiFocal, cpFocal
# sync document time with received timecode
time = c4d.BaseTime(data[0], 24)
# send back focal length
obj = op.GetObject()
reader = obj[c4d.ID_USERDATA,9]
focalLength = reader[c4d.ID_USERDATA,13]
osc.sendOSCMsg("/focallength", [focalLength])
def main():
global focalLength, imaiFocal, cpFocal
osc.server == 0
if osc.server == 0:
# listen
osc.setOSCHandler(address='/frame', hd=onFrameChanged)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment