06-02-2016, 12:37 PM
I'll show the Python Client to give you an idea
Thea has a built in remote server which you can start from the command line ie
thea -noshow -remoteserver
then basically you just past commands and wait for a reply, like in the example you can get scene information and change it.
Its only really any good for loading a scene getting information, engine cores, rendering settings, display (iso, fnumber) It can't do a lists of commands so you couldn't get the materials or change them, the only way I found was to write and xml material file and use merge to replace the original
Code:
from ctypes import *
import traceback
import sys
import socket
import struct
from os import path
port=6300 #port
host='127.0.0.1'#ip address
def sendSocketMsg(host, port, message): #client code
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, int(port)))
msg = struct.pack('<l',len(message))+struct.pack('<l',0)+message
s.sendall(msg)
data = s.recv(1024)
s.close()
print (data.decode("utf-8"))
return data.decode("utf-8")
except:
return 'ERROR'
next
#get studio version
message = b'version'
sendSocketMsg(host, port, message)
#load a scene
message = b"message \"Load C:\\Temp\\scene.scn.thea\""
sendSocketMsg(host, port, message)
#get active camera
message =b"get \"./Scenes/Active/Cameras/Active\""
sendSocketMsg(host, port, message)
#get time limit
message = b'get \"./Scenes/Active/Render/Time Limit\"'
sendSocketMsg(host, port, message)
#get samples
message = b'get \"./Scenes/Active/Render/Sample Limit\"'
sendSocketMsg(host, port, message)
#render scene
message = b"message \"Render\""
sendSocketMsg(host, port, message)
############################################
#while loop would go here looping until data is Idle
##command in the loop
message = b'status'
sendSocketMsg(host, port, message)
##end loop
###########################################
##then save
#message = b"message 'SaveImage C:\\Temp\\scenex.png'"
sendSocketMsg(host, port, message)
Thea has a built in remote server which you can start from the command line ie
thea -noshow -remoteserver
then basically you just past commands and wait for a reply, like in the example you can get scene information and change it.
Its only really any good for loading a scene getting information, engine cores, rendering settings, display (iso, fnumber) It can't do a lists of commands so you couldn't get the materials or change them, the only way I found was to write and xml material file and use merge to replace the original