feat: add commands for clearing candidates and reusing candidate settings, update UI controls
This commit is contained in:
@@ -24,6 +24,10 @@ export type GenerationRemoveCandidatePayload = {
|
||||
candidateId: GenerationCandidateId;
|
||||
};
|
||||
|
||||
export type GenerationReuseCandidateSettingsPayload = {
|
||||
candidateId: GenerationCandidateId;
|
||||
};
|
||||
|
||||
export type GenerationApplyCandidateAsLayerPayload = {
|
||||
candidateId: GenerationCandidateId;
|
||||
assetId: AssetId;
|
||||
@@ -140,6 +144,30 @@ export const generationClearCandidatesCommand: Command = {
|
||||
},
|
||||
};
|
||||
|
||||
export const generationReuseCandidateSettingsCommand: Command<GenerationReuseCandidateSettingsPayload> = {
|
||||
id: commandIds.generationReuseCandidateSettings,
|
||||
name: "Reuse generation candidate settings",
|
||||
execute({ state }, payload) {
|
||||
const candidate = state.editor.generation.candidates.find((item) => item.id === payload.candidateId);
|
||||
if (!candidate) return state;
|
||||
return {
|
||||
...state,
|
||||
editor: {
|
||||
...state.editor,
|
||||
tools: {
|
||||
...state.editor.tools,
|
||||
generate: {
|
||||
...candidate.settings,
|
||||
seed: candidate.seed,
|
||||
outpaint: { ...candidate.settings.outpaint },
|
||||
inpaint: { ...candidate.settings.inpaint },
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
export const generationApplyCandidateAsLayerCommand: Command<GenerationApplyCandidateAsLayerPayload> = {
|
||||
id: commandIds.generationApplyCandidateAsLayer,
|
||||
name: "Apply generation candidate as layer",
|
||||
@@ -284,6 +312,7 @@ export const generationCommands = [
|
||||
generationSetCompareModeCommand,
|
||||
generationRemoveCandidateCommand,
|
||||
generationClearCandidatesCommand,
|
||||
generationReuseCandidateSettingsCommand,
|
||||
generationApplyCandidateAsLayerCommand,
|
||||
generationReplaceCandidatePixelsCommand,
|
||||
generationStartJobCommand,
|
||||
|
||||
Reference in New Issue
Block a user