#!/usr/bin/python import sys from mhrc.JsonCall import JsonCall jsc = JsonCall() jsc.setFunction("getAppliedTargets") response = jsc.send() if not response: print("Command failed (returned null response)\n") sys.exit(1) if hasattr(response, "error") and getattr(response, "error"): print("ERROR: " + getattr(response, "error")) sys.exit(1) data = response.getData() for name in data.keys(): print(name + " " + str(data[name]))
print "Modifier name is the name as listed by the listAvailableModifiers" print "script. Power is either (usually) between 0.0 and +1.0, but some" print "modifiers may accept a range between -1.0 and +1.0." sys.exit(1) if len(sys.argv) < 3: usage() if len(sys.argv) > 3: usage() modname = sys.argv[1] modval = sys.argv[2] jsc = JsonCall() jsc.setFunction("applyModifier") jsc.setParam("modifier", modname) jsc.setParam("power", modval) response = jsc.send() if not response: print "Command failed (returned null response)\n" sys.exit(1) if hasattr(response, "error") and getattr(response, "error"): print "ERROR: " + getattr(response, "error") sys.exit(1)
#!/usr/bin/python import sys from mhrc.JsonCall import JsonCall jsc = JsonCall() jsc.setFunction("getAvailableModifierNames") response = jsc.send() if not response: print("Command failed (returned null response)") sys.exit(1) if hasattr(response, "error") and getattr(response, "error"): print("ERROR: " + getattr(response, "error")) sys.exit(1) for m in response.getData(): print(m)
if len(sys.argv) == 3: usage() if len(sys.argv) > 4: usage() function = sys.argv[1] argname = None argval = None if len(sys.argv) > 2: argname = sys.argv[2] argval = sys.argv[3] jsc = JsonCall() jsc.setFunction(function) if argname: jsc.setParam(argname,argval) response = jsc.send() if not response: print "Command failed (returned null response)\n" sys.exit(1) if hasattr(response,"error") and getattr(response,"error"): print "ERROR: " + getattr(response,"error") sys.exit(1) print response.getData()
if len(sys.argv) == 3: usage() if len(sys.argv) > 4: usage() function = sys.argv[1] argname = None argval = None if len(sys.argv) > 2: argname = sys.argv[2] argval = sys.argv[3] jsc = JsonCall() jsc.setFunction(function) if argname: jsc.setParam(argname, argval) response = jsc.send() if not response: print("Command failed (returned null response)\n") sys.exit(1) if hasattr(response, "error") and getattr(response, "error"): print("ERROR: " + getattr(response, "error")) sys.exit(1) print(response.getData())
#!/usr/bin/python import sys from mhrc.JsonCall import JsonCall jsc = JsonCall() jsc.setFunction("getAppliedTargets") response = jsc.send() if not response: print "Command failed (returned null response)\n" sys.exit(1) if hasattr(response,"error") and getattr(response,"error"): print "ERROR: " + getattr(response,"error") sys.exit(1) data = response.getData() for name in data.keys(): print name + " " + str(data[name])
def snap(filename='/home/mraiser/Desktop/xyz.jpg'): jsc = JsonCall() jsc.setFunction("applyModifier") jsc.setParam("modifier", 'camera/snapshot') jsc.setParam("filename", filename) jsc.setParam("power", 0) jsc.send()
#!/usr/bin/python import sys from mhrc.JsonCall import JsonCall jsc = JsonCall() jsc.setFunction("getAvailableModifierNames") response = jsc.send() if not response: print "Command failed (returned null response)\n" sys.exit(1) if hasattr(response,"error") and getattr(response,"error"): print "ERROR: " + getattr(response,"error") sys.exit(1) for m in response.getData(): print m
def rot(axis, amt): jsc = JsonCall() jsc.setFunction("applyModifier") jsc.setParam("modifier", 'camera/rot_'+axis) jsc.setParam("power", amt) jsc.send()
def zoom(axis, amt): jsc = JsonCall() jsc.setFunction("applyModifier") jsc.setParam("modifier", 'camera/zoom') jsc.setParam("power", amt) jsc.send()
def modify(modifier, amt): jsc = JsonCall() jsc.setFunction("applyModifier") jsc.setParam("modifier", modifier) jsc.setParam("power", amt) jsc.send()
def reset_camera(): jsc = JsonCall() jsc.setFunction("applyModifier") jsc.setParam("modifier", 'camera/reset') jsc.setParam("power", 0) jsc.send()
print " applyModifier.py <modifier name> <power>\n"; print "Modifier name is the name as listed by the listAvailableModifiers" print "script. Power is either (usually) between 0.0 and +1.0, but some" print "modifiers may accept a range between -1.0 and +1.0." sys.exit(1) if len(sys.argv) < 3: usage() if len(sys.argv) > 3: usage() modname = sys.argv[1] modval = sys.argv[2] jsc = JsonCall() jsc.setFunction("applyModifier") jsc.setParam("modifier",modname); jsc.setParam("power",modval); response = jsc.send() if not response: print "Command failed (returned null response)\n" sys.exit(1) if hasattr(response,"error") and getattr(response,"error"): print "ERROR: " + getattr(response,"error") sys.exit(1)