Skip to content

Context

context can access from everywhere

name description
_app_ process app name
_user_name_ PUZZLE_USERNAME or USERNAME
_datetime_ datetime when process start
_os_ version of os
_python_version_ version of python

How to Use update_context

use data_key_replace function to add context. to prefix before the value name.
This way, the value will be searched from context.

config

config = [
  "step": "main",
  "tasks": [
      {
        "name": "set frame with offset",
        "module": "somewhere.set_frame"
      },
      {
        "name": "render",
        "module": "somewhere.render"
        "comment": "use new value from pre task",
        "data_key_replace":
        {
          "start": "context.new_min",
          "end": "context.new_max"
        }
      }
  ]
]

set_frame.py

def main(event):
    data = event["data"]
    update_context = {}

    cmds.playbackOptions(min=data["min"] - data["offset"])
    cmds.playbackOptions(max=data["max"] + data["offset"])

    update_context["new_min"] = data["min"] - data["offset]
    update_context["new_max"] = data["max"] + data["offset]

    return {"return_code": 0, "update_context": update_context}

render.py

def main(event={}):
    data = event.get("data")
    print("{} - {}".format(data["start]))
    render_file(data["start"], data["end"])
    return {"return_code": 0}

>> 201 - 300