Skip to content

Commit

Permalink
Hotkey for live apply to new layer #959
Browse files Browse the repository at this point in the history
  • Loading branch information
Acly committed Jul 25, 2024
1 parent 2630ee5 commit 404466a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ai_diffusion/ai_diffusion.action
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@
<isCheckable>false</isCheckable>
<statusTip/>
</Action>
<Action name="ai_diffusion_apply_alternative">
<icon/>
<text>Apply result (layer)</text>
<whatsThis/>
<toolTip/>
<iconText/>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip/>
</Action>
<Action name="ai_diffusion_create_region">
<icon/>
<text>Create region</text>
Expand Down
1 change: 1 addition & 0 deletions ai_diffusion/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions ai_diffusion/ui/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 404466a

Please sign in to comment.