Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include "context" with the pluginProcessed event data #391

Open
BigRoy opened this issue Oct 4, 2022 · 0 comments
Open

Include "context" with the pluginProcessed event data #391

BigRoy opened this issue Oct 4, 2022 · 0 comments

Comments

@BigRoy
Copy link
Member

BigRoy commented Oct 4, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant