From 24424755fc07a54a5592c903186d283a4e026504 Mon Sep 17 00:00:00 2001 From: Ben Rugg Date: Sat, 28 Oct 2023 16:35:38 -0500 Subject: [PATCH] Show the AI result image in an image editor even if the render result window is closed --- utils.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/utils.py b/utils.py index d687997..978e152 100644 --- a/utils.py +++ b/utils.py @@ -188,11 +188,17 @@ def get_areas_by_type(area_type, scene=None, context=None): def find_area_showing_render_result(scene=None, context=None): areas = get_areas_by_type('IMAGE_EDITOR', scene, context) + potential_area = None + for area in areas: active_image = area.spaces.active.image - if active_image is not None and active_image.type == 'RENDER_RESULT': - return area - return None + if active_image is not None: + if active_image.type == 'RENDER_RESULT': + return area + else: + potential_area = area + + return potential_area def split_area(context, area, direction='HORIZONTAL', factor=0.5):