For a project I need to drive shape keys with data received via a network connection. In my setup I receive input form a TouchOSC app running on an iPad into PureData on a Mac. The input data then is processed and sent out over UDP to

That's all working fine but now I need Blender to receive the packets, evaluate them and use the values to drive properties on objects. In my case I need to drive the value property of shape keys.

Is this possible and if so, how can I approach this the best way?


The basic idea is to open a socket, poll the data and apply the received values to the shape keys:

import socket

# open network socket
port = 13001
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(("", port))
print "waiting on port:", port

# poll data (could use a timer)
data, addr = s.recvfrom(1024) 
print data
# set float value from data
# value convert from data
bpy.context.object.data.shape_keys.key_blocks['Key 1'].value = float(value)


  • $\begingroup$ Brilliant, many thanks for your answer. I thought it would be more complex but this works great. $\endgroup$
    – wout
    Apr 2 '15 at 7:53
  • $\begingroup$ How would this look on a time operator it crashes blender when I run it $\endgroup$
    – Ymmanuel
    Jul 7 '17 at 23:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.