Skip to content

Include "context" with the pluginProcessed event data #391

Description

@BigRoy

Issue

Currently the pluginProcessed event does not include the context which makes it impossible to 'debug' data in it whenever a plug-in was processed that did not include an instance. It currently matches the result of pyblish.plugin.process().

Would it be problematic if we would include context in the process() results or potentially add context just to the result of the emitted event. Why, or why not?

Additional info

Being able to access the context would allow debugging like this Github Gist does without hacking like this:

        # Don't tell me why - but the pyblish event does not
        # pass along the context with the result. And thus
        # it's non trivial to debug step by step. So, we
        # get the context like the evil bastards we are.
        i = 0
        found_context = None
        current_frame = inspect.currentframe()
        for frame_info in inspect.getouterframes(current_frame):
            frame_locals = frame_info.frame.f_locals
            if "context" in frame_locals:
                found_context = frame_locals["context"]
                break
            i += 1
            if i > 5:
                print("Warning: Pyblish context not found..")
                # We should be getting to the context within 
                # a few frames
                break

Which is slow, unsafe and not explicit behavior - it's basically a hack currently. It works in Maya, but crashes e.g. Nuke.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions