Skip to content

Response

return value will be dict or None

def main(event={}):
    data = event.get("data", {})
    new_min = data["min"] * 2
    new_max = data["max] * 2
    cmds.playbackOptions(min=new_min, max=new_max)
    print("{} - {}".format(new_min, new_max))

    update_context = {"min": new_min, "max": new_max}
    return {"return_code": 0, "update_context": update_context}
key default type description
return_code 0 int result for task process
update_context {} dict update context
break_on_conditions False bool if True, stop all process except closure step

return code

id results description
0 Success
1 Error
2 skipped
4 Import Error task was not found in sys.path
5 Key Error required key was not exists(optional)

update context

add value to context

sample of break on conditions

when start frame is lower then 0, stop the other tasks

def main(event):
    if cmds.playbackOptions(min=True, q=True) < 0:
        return {"return_code": 0, "break_on_conditions": True}
    return {"return_code": 0}