Post #5170: : post_05173
🏷️ Tags
v1-18-7 context-override technical-implementation advanced unsolved
⚙️ Related PME Features
- pme.popup_area
- pme.sidearea_toggle
- extra_operators
- context override system
💬 Content
Pluglug:
(I won’t be working on
pme.popup_areafor a while. It’s not just the asset browser; there seem to be multiple issues.)
I thought it sounded familiar, so I looked it up and found that I’d had this problem in the past, and I’d tried to deal with it, but I’d given up. But I can’t remember anything about that… And I don’t have time to look into it at the moment.
I can’t remember if this is related to the pme.popup_area problem, but my biggest concern at the moment is the removal of the traditional context override. I would have to switch to temp_override, but that is probably beyond me.
PS: From the traceback, it still seems likely that the context override is not working. (At least that’s what I’m working from.) Check temp_override. It might give you some clues.
When I fixed pme.sidearea_toggle, I also replaced it with temp_override. Have a look at the extra_operators.py I share in the following post.
Pie Menu Editor 1.18.7 Released Scripts and Themes
Just wrapped up work on the pme.sidearea_toggle operator. Here’s the preview file. Fixed the issue where the Preferences>Interface>Display>Line Width set to “Thick” wouldn’t recognize adjacent areas. Corrected the error that occurred when opening and closing areas in Blender versions 4.0 and later. Tested and confirmed working on Blender 4.0.1 and 3.6.5. Hey @ismailov.dima, give it a try! extra_operators.py (30.7 KB) Please replace this file with the one in the following directory: “C:\Us…
I was so curious that I couldn’t get anything else done, so I gave it a try. Yep, it worked by exactly the same means.(The issue of hard crashing when trying to popup the asset browser remains. Other options such as size need to be checked as well. But it shouldn’t be hard to fix. Try it.)
I found that I have in the past created a with_override function in screen_utils to deal with the context override issue. I share it as it might be useful.
def with_override(
operation, area, screen=None, window=None, region='WINDOW', **kwargs):
window = window or bpy.context.window
screen = screen or bpy.context.screen
region = region or bpy.context.region
if isinstance(screen, str):
screen = bpy.data.screens.get(screen, bpy.context.screen)
if not screen:
return dict()
if isinstance(area, str):
for a in screen.areas:
if a.type == area:
area = a
break
else:
return dict()
if isinstance(region, str):
for r in area.regions:
if r.type == region:
region = r
break
else:
region = area.regions[0]
if bpy.app.version >= (4, 0, 0):
with bpy.context.temp_override(window=window, area=area, region=region, **kwargs):
return operation()
else:
override = override_context(area, window=window, region=region, **kwargs)
return operation(override)
image1133×348 21.9 KB
image798×412 38.1 KB