From 404466a0db8efd714565059b1fad1e715e22d4af Mon Sep 17 00:00:00 2001 From: Acly Date: Thu, 25 Jul 2024 12:56:09 +0200 Subject: [PATCH] Hotkey for live apply to new layer #959 --- ai_diffusion/ai_diffusion.action | 12 ++++++++++++ ai_diffusion/extension.py | 1 + ai_diffusion/ui/actions.py | 8 ++++++++ 3 files changed, 21 insertions(+) diff --git a/ai_diffusion/ai_diffusion.action b/ai_diffusion/ai_diffusion.action index f137edb12e..4b08464a49 100644 --- a/ai_diffusion/ai_diffusion.action +++ b/ai_diffusion/ai_diffusion.action @@ -75,6 +75,18 @@ false + + + Apply result (layer) + + + + 10000 + 0 + + false + + Create region diff --git a/ai_diffusion/extension.py b/ai_diffusion/extension.py index 97ae0e8bcf..f2561efa0d 100644 --- a/ai_diffusion/extension.py +++ b/ai_diffusion/extension.py @@ -50,6 +50,7 @@ def createActions(self, window): self._create_action(window, "cancel_all", actions.cancel_all) self._create_action(window, "toggle_preview", actions.toggle_preview) self._create_action(window, "apply", actions.apply) + self._create_action(window, "apply_alternative", actions.apply_alternative) self._create_action(window, "create_region", actions.create_region) self._create_action( window, "switch_workspace_generation", actions.set_workspace(Workspace.generation) diff --git a/ai_diffusion/ui/actions.py b/ai_diffusion/ui/actions.py index 75992e76eb..ff7aaed728 100644 --- a/ai_diffusion/ui/actions.py +++ b/ai_diffusion/ui/actions.py @@ -42,6 +42,14 @@ def apply(): model.live.apply_result() +def apply_alternative(): + if model := root.model_for_active_document(): + if model.workspace is Workspace.live: + model.live.apply_result(layer_only=True) + else: + apply() + + def create_region(): if model := root.model_for_active_document(): model.regions.create_region(group=model.workspace is not Workspace.live)