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

bpy.context is lacking when calling from a Qt window #4

Open
MoisMoshev opened this issue Feb 24, 2021 · 2 comments
Open

bpy.context is lacking when calling from a Qt window #4

MoisMoshev opened this issue Feb 24, 2021 · 2 comments

Comments

@MoisMoshev
Copy link
Collaborator

When operating from a Qt window, it seems that bpy.context does not know the current area, camera, etc.

To Reproduce
Steps to reproduce the behavior:

  1. Open a Qt window with a button to call op that needs the current context
  2. Click the button to execute the app
  3. See that bpy.context.area, bpy.context.camera etc. are empty, although the currently selected area in blender is the correct view.

I wonder whether there is a canonical way to get to the original context.

@MoisMoshev
Copy link
Collaborator Author

I did some more digging, and found that the context is available before the menu opens, and not available afterwards. (which I should probably have expected).
Would you be interested in a PR that remembers the current bpy.context before opening the menu? i.e. as a property on the engine or so. Then it will be cleared when the menu/windows close.

Currently I see no better alternative.

@andreasmalta1
Copy link

Have you find a way around this ?
It's proving to be a problem when trying to do the following: bpy.ops.sequencer.image_strip_add()

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

2 participants