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);
|
||||
|
||||
// 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 (
|
||||
// Layer doesn't exist
|
||||
!precheckLayer ||
|
||||
// Layer doesn't have an image
|
||||
!precheckLayer.controlAdapter.image ||
|
||||
// Layer doesn't have a processor config
|
||||
!precheckLayer.controlAdapter.processorConfig ||
|
||||
// Layer is already processing an image
|
||||
precheckLayer.controlAdapter.isProcessingImage ||
|
||||
// Processor config is the same
|
||||
isEqual(precheckLayerOriginal?.controlAdapter.processorConfig, precheckLayer.controlAdapter.processorConfig)
|
||||
layerDoesNotExist ||
|
||||
layerHasNoImage ||
|
||||
layerHasNoProcessorConfig ||
|
||||
areImageAndProcessorUnchanged ||
|
||||
layerIsAlreadyProcessingImage
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
@ -250,8 +250,17 @@ export const controlLayersSlice = createSlice({
|
||||
layer.bbox = null;
|
||||
layer.bboxNeedsUpdate = true;
|
||||
layer.isEnabled = true;
|
||||
layer.controlAdapter.image = imageDTO ? imageDTOToImageWithDims(imageDTO) : null;
|
||||
layer.controlAdapter.processedImage = null;
|
||||
if (imageDTO) {
|
||||
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 }>) => {
|
||||
const { layerId, imageDTO } = action.payload;
|
||||
|
Loading…
Reference in New Issue
Block a user