Skip to content

Instantly share code, notes, and snippets.

@BigRoy
Last active September 29, 2022 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BigRoy/c2d3a2469d0f416ba3f41d8027e5729a to your computer and use it in GitHub Desktop.
Save BigRoy/c2d3a2469d0f416ba3f41d8027e5729a to your computer and use it in GitHub Desktop.
Draft for the documentation on context/instance data during publishing

NOTE

This is clearly a work in progress

Context Data

Example of content in a Maya publish of context.data

key type description example value
anatomy Anatomy xxx Current project Anatomy
anatomyData dict xxx Current context Anatomy data
angularUnits str Maya Angular Units deg
appLabel str Application label Maya 2022
appName str Application name maya/2022
asset str Asset name asset1
assetEntity dict Asset document ...
cleanupEmptyDirs list xxx []
cleanupFullPaths list xxx []
comment str User comment typed during publish "My publish comment"
connectTime tuple xxx ('2022-09-29T21:15:19.462010Z',)
currentFile str Current workfile P:/Projects/test/asset1/work/debug/maya/scenes/test_asset1_debug_v286_review.ma
cwd str Current working directory S:\openpype\OpenPype\igniter
date str Publish date time 2022-09-29T21:15:20.135718Z
datetimeData dict Publish date time data used for formatting ...
deadlinePassMongoUrl bool Setting whether Mongo URL should be passed along with Deadline submission False
defaultDeadline str Default Deadline Webservice URL http://IPADDRESS_OR_URL:8082
fileDependencies list xxx []
fps float xxx 25.0
frameEnd int xxx 1100
frameEndHandle int xxx 1100
frameStart int xxx 1001
frameStartHandle int xxx 1001
handleEnd int xxx 0
handleStart int xxx 0
handles int xxx 0
host Host Registered host ...
hostName str Host name maya
icon str Icon for the context book
label str Label for the context Maya - test_asset1_debug_v286_review.ma
linearUnits str Maya Linear Units cm
loadedVersions list Loaded versions in workfile []
machine str Current machine/hostname CB1
name str Pyblish name of context/instance context
objectsets list ??? ['reviewMain']
openPypeModules dict All OpenPype modules found ...
port int Port number (what is it for?) -1
projectEntity dict Project document {'_id': ObjectId('61d46bed757d044dc2ed609b'), 'type': 'project', 'name': 'test', 'data': ...
projectName str Project name test
project_settings dict OpenPype Current Project Settings ...
publish bool Whether to publish this context/instance or not True
pyblishVersion tuple Pyblish Version ('1.8.8',)
pythonVersion str Python ersion 3.7.7 (tags/v3.7.7:d7c567b08f, Mar 10 2020, 10:41:24) [MSC v.1900 64 bit (AMD64)]
results list Pyblish default 'results' data ...
system_settings dict OpenPype System Settings ...
task str Task name debug
taskType str Task type Generic
time str Publish time 20220929T231519Z
user str Machine user (or Ftrack user?) Roy
version int Version of workfile or to publish to? 286
workspaceDir str Maya Workspace Directory P:\Projects\test\asset1\work\debug\maya

Instance members

Fusion: The single tool used as output. Houdini: The single ROP node generating the output. (Not sure if correct?) Maya: The hierarchy of nodes inside the instance's object set.

Instance data

Note that asset, task and its entities can be set per instance and thus the data on the instance is likely to be more specific than that context information on the Pyblish Context.

key type description
FRAME RANGES
frameStart int, float Start frame without handles
frameEnd int, float End frame without handles
frameStartHandle int, float Start frame with handle
frameEndHandle int, float End frame with handle
handleStart int, float Setting to define amount of start frame handles
handleEnd int, float Setting to define amount of end frame handles
byFrameStep int Start/end frame by frame step
step float Substeps for publishing (e.g. 0.5) - conflicts with byFrameStep?
fps float Frames per second
Special cases
proxyFrameStart int, float Start frame without handles (used by redshiftproxy family)
proxyFrameEnd int, float End frame without handles (used by redshiftproxy family)
proxyFrameStep int, float End frame without handles (used by redshiftproxy family)
INTEGRATION
version int ??
representations list ??
files list ??
transfers list List of 2-tuple (src, dest) transfers to perform during integration.
OTHERS
setMembers list The direct members of the container set. (Maya only?)
renderer str Name of current renderer
review bool Whether to review instance (?? seen in maya)

Example instances

Instance: reviewMain
key type description example value
active bool Whether instance is active/enabled for publishing True
anatomyData dict Anatomy Data .
asset str Asset Name asset1
assetEntity dict Asset Document ...
audio list xxx []
cbId str cbID attribute on instance (ignore this) 61d8a282b32db1c8ece2c516:1ef90dc41cc5
families list xxx ['ftrack']
family str xxx review
fps float xxx 25.0
frameEnd float xxx 1005.0
frameEndFtrack float xxx 1005.0
frameEndHandle float xxx 1005.0
frameStart float xxx 1001.0
frameStartFtrack float xxx 1001.0
frameStartHandle float xxx 1001.0
handleEnd int xxx 0
handleStart int xxx 0
id str xxx pyblish.avalon.instance
imagePlane bool xxx True
inputRepresentations list xxx []
isolate bool xxx False
keepImages bool xxx True
label str xxx reviewMain (asset1) [1001-1005]
latestVersion int xxx 283
name str xxx reviewMain
projectEntity dict xxx ...
publish bool xxx True
review_camera str xxx `
review_height int xxx 720
review_width int xxx 1280
setMembers list xxx `['
step float xxx 1.0
subset str xxx reviewMain
transparency int xxx 0
variant str xxx Main
version int xxx 286
Instance: test_asset1_debug_v286_review
key type description example value
anatomyData dict xxx ...
asset str xxx asset1
assetEntity dict xxx ...
families list xxx ['workfile']
family str xxx workfile
fps float xxx 25.0
frameEnd int xxx 1100
frameStart int xxx 1001
handleEnd int xxx 0
handleStart int xxx 0
inputRepresentations list xxx []
label str xxx workfileDebug
latestVersion int xxx 283
name str xxx test_asset1_debug_v286_review
projectEntity dict xxx {...}
publish bool xxx True
publishDir str xxx P:\Projects\test\asset1\publish\workfile\workfileDebug\v286
representations list xxx [...]
resourcesDir str xxx P:\Projects\test\asset1\publish\workfile\workfileDebug\v286\resources
setMembers list xxx ['P:/Projects/test/asset1/work/debug/maya/scenes/test_asset1_debug_v286_review.ma']
subset str xxx workfileDebug
version int xxx 286
@BigRoy
Copy link
Author

BigRoy commented Sep 29, 2022

Example Plugin to produce your own markdown table of your current publishes:

import pyblish.api


class DebugData(pyblish.api.ContextPlugin):

    label = "DEBUG DATA"
    order = pyblish.api.ValidatorOrder + 0.499

    def process(self, context):

        MAX_VALUE_STR_LEN = 100

        def format_data(data):
            yield "| key | type | description | example value |"
            yield "|-----|------|-------------|---------------|"
            for key, value in sorted(data.items()):
                value_str = str(value)
                if len(value_str) > MAX_VALUE_STR_LEN:
                    value_str = value_str[:MAX_VALUE_STR_LEN] + "..."
                msg = f"| **{key}** | `{type(value).__name__}` | x | `{value_str}` |"
                yield msg

        report = f"### Context: {context}\n\n"
        report += "\n".join(format_data(context.data))

        for instance in context:
            report += f"\n\n\n### Instance: {instance}\n\n"
            report += "\n".join(format_data(instance.data))

        print(report)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment