mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): edge cases in auto-process
This commit is contained in:
parent
45c2ac41d5
commit
6effa19626
@ -38,17 +38,20 @@ export const addControlAdapterPreprocessor = (startAppListening: AppStartListeni
|
|||||||
.find((l) => l.id === layerId);
|
.find((l) => l.id === layerId);
|
||||||
|
|
||||||
// Conditions to bail
|
// Conditions to bail
|
||||||
|
const layerDoesNotExist = !precheckLayer;
|
||||||
|
const layerHasNoImage = !precheckLayer?.controlAdapter.image;
|
||||||
|
const layerHasNoProcessorConfig = !precheckLayer?.controlAdapter.processorConfig;
|
||||||
|
const layerIsAlreadyProcessingImage = precheckLayer?.controlAdapter.isProcessingImage;
|
||||||
|
const areImageAndProcessorUnchanged =
|
||||||
|
isEqual(precheckLayer?.controlAdapter.image, precheckLayerOriginal?.controlAdapter.image) &&
|
||||||
|
isEqual(precheckLayer?.controlAdapter.processorConfig, precheckLayerOriginal?.controlAdapter.processorConfig);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
// Layer doesn't exist
|
layerDoesNotExist ||
|
||||||
!precheckLayer ||
|
layerHasNoImage ||
|
||||||
// Layer doesn't have an image
|
layerHasNoProcessorConfig ||
|
||||||
!precheckLayer.controlAdapter.image ||
|
areImageAndProcessorUnchanged ||
|
||||||
// Layer doesn't have a processor config
|
layerIsAlreadyProcessingImage
|
||||||
!precheckLayer.controlAdapter.processorConfig ||
|
|
||||||
// Layer is already processing an image
|
|
||||||
precheckLayer.controlAdapter.isProcessingImage ||
|
|
||||||
// Processor config is the same
|
|
||||||
isEqual(precheckLayerOriginal?.controlAdapter.processorConfig, precheckLayer.controlAdapter.processorConfig)
|
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -250,8 +250,17 @@ export const controlLayersSlice = createSlice({
|
|||||||
layer.bbox = null;
|
layer.bbox = null;
|
||||||
layer.bboxNeedsUpdate = true;
|
layer.bboxNeedsUpdate = true;
|
||||||
layer.isEnabled = true;
|
layer.isEnabled = true;
|
||||||
layer.controlAdapter.image = imageDTO ? imageDTOToImageWithDims(imageDTO) : null;
|
if (imageDTO) {
|
||||||
layer.controlAdapter.processedImage = null;
|
const newImage = imageDTOToImageWithDims(imageDTO);
|
||||||
|
if (isEqual(newImage, layer.controlAdapter.image)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
layer.controlAdapter.image = newImage;
|
||||||
|
layer.controlAdapter.processedImage = null;
|
||||||
|
} else {
|
||||||
|
layer.controlAdapter.image = null;
|
||||||
|
layer.controlAdapter.processedImage = null;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
caLayerProcessedImageChanged: (state, action: PayloadAction<{ layerId: string; imageDTO: ImageDTO | null }>) => {
|
caLayerProcessedImageChanged: (state, action: PayloadAction<{ layerId: string; imageDTO: ImageDTO | null }>) => {
|
||||||
const { layerId, imageDTO } = action.payload;
|
const { layerId, imageDTO } = action.payload;
|
||||||
|
Loading…
Reference in New Issue
Block a user