Skip to content

Commit 3993fae

Browse files
psychedelicioushipsterusername
authored andcommitted
fix(ui): unable to invoke w/ empty inpaint mask or raster layer
Removed the empty state checks for these layer types - it's always OK to invoke when they are empty.
1 parent 1446526 commit 3993fae

File tree

3 files changed

+83
-90
lines changed

3 files changed

+83
-90
lines changed

invokeai/frontend/web/public/locales/en.json

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,24 +1039,7 @@
10391039
"canvasIsSelectingObject": "Canvas is busy (selecting object)",
10401040
"noPrompts": "No prompts generated",
10411041
"noNodesInGraph": "No nodes in graph",
1042-
"systemDisconnected": "System disconnected",
1043-
"layer": {
1044-
"unsupportedModel": "layer not supported for selected base model",
1045-
"controlAdapterNoModelSelected": "no Control Adapter model selected",
1046-
"controlAdapterIncompatibleBaseModel": "incompatible Control Adapter base model",
1047-
"t2iAdapterIncompatibleBboxWidth": "$t(parameters.invoke.layer.t2iAdapterRequiresDimensionsToBeMultipleOf) {{multiple}}, bbox width is {{width}}",
1048-
"t2iAdapterIncompatibleBboxHeight": "$t(parameters.invoke.layer.t2iAdapterRequiresDimensionsToBeMultipleOf) {{multiple}}, bbox height is {{height}}",
1049-
"t2iAdapterIncompatibleScaledBboxWidth": "$t(parameters.invoke.layer.t2iAdapterRequiresDimensionsToBeMultipleOf) {{multiple}}, scaled bbox width is {{width}}",
1050-
"t2iAdapterIncompatibleScaledBboxHeight": "$t(parameters.invoke.layer.t2iAdapterRequiresDimensionsToBeMultipleOf) {{multiple}}, scaled bbox height is {{height}}",
1051-
"ipAdapterNoModelSelected": "no IP adapter selected",
1052-
"ipAdapterIncompatibleBaseModel": "incompatible IP Adapter base model",
1053-
"ipAdapterNoImageSelected": "no IP Adapter image selected",
1054-
"rgNoPromptsOrIPAdapters": "no text prompts or IP Adapters",
1055-
"rgNegativePromptNotSupported": "negative prompt not supported for selected base model",
1056-
"rgReferenceImagesNotSupported": "regional reference images not supported for selected base model",
1057-
"rgAutoNegativeNotSupported": "auto-negative not supported for selected base model",
1058-
"emptyLayer": "empty layer"
1059-
}
1042+
"systemDisconnected": "System disconnected"
10601043
},
10611044
"maskBlur": "Mask Blur",
10621045
"negativePromptPlaceholder": "Negative Prompt",
@@ -1805,6 +1788,21 @@
18051788
"replaceCurrent": "Replace Current",
18061789
"controlLayerEmptyState": "<UploadButton>Upload an image</UploadButton>, drag an image from the <GalleryButton>gallery</GalleryButton> onto this layer, or draw on the canvas to get started.",
18071790
"referenceImageEmptyState": "<UploadButton>Upload an image</UploadButton> or drag an image from the <GalleryButton>gallery</GalleryButton> onto this layer to get started.",
1791+
"warnings": {
1792+
"problemsFound": "Problems found",
1793+
"unsupportedModel": "layer not supported for selected base model",
1794+
"controlAdapterNoModelSelected": "no Control Layer model selected",
1795+
"controlAdapterIncompatibleBaseModel": "incompatible Control Layer base model",
1796+
"controlAdapterNoControl": "no control selected/drawn",
1797+
"ipAdapterNoModelSelected": "no Reference Image model selected",
1798+
"ipAdapterIncompatibleBaseModel": "incompatible Reference Image base model",
1799+
"ipAdapterNoImageSelected": "no Reference Image image selected",
1800+
"rgNoPromptsOrIPAdapters": "no text prompts or Reference Images",
1801+
"rgNegativePromptNotSupported": "Negative Prompt not supported for selected base model",
1802+
"rgReferenceImagesNotSupported": "regional Reference Images not supported for selected base model",
1803+
"rgAutoNegativeNotSupported": "Auto-Negative not supported for selected base model",
1804+
"rgNoRegion": "no region drawn"
1805+
},
18081806
"controlMode": {
18091807
"controlMode": "Control Mode",
18101808
"balanced": "Balanced (recommended)",

invokeai/frontend/web/src/features/controlLayers/components/common/CanvasEntityHeaderWarnings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const TooltipContent = memo((props: { warnings: string[] }) => {
8989
const { t } = useTranslation();
9090
return (
9191
<Flex flexDir="column">
92-
<Text>{t('common.warnings')}:</Text>
92+
<Text>{t('controlLayers.warnings.problemsFound')}:</Text>
9393
<UnorderedList>
9494
{props.warnings.map((warning, index) => (
9595
<ListItem key={index}>{warning}</ListItem>

invokeai/frontend/web/src/features/controlLayers/store/validators.ts

Lines changed: 66 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@ import type {
88
import type { ParameterModel } from 'features/parameters/types/parameterSchemas';
99

1010
export const WARNINGS = {
11-
EMPTY_LAYER: 'parameters.invoke.layer.emptyLayer',
12-
UNSUPPORTED_MODEL: 'parameters.invoke.layer.unsupportedModel',
13-
RG_NO_PROMPTS_OR_IP_ADAPTERS: 'parameters.invoke.layer.rgNoPromptsOrIPAdapters',
14-
RG_NEGATIVE_PROMPT_NOT_SUPPORTED: 'parameters.invoke.layer.rgNegativePromptNotSupported',
15-
RG_REFERENCE_IMAGES_NOT_SUPPORTED: 'parameters.invoke.layer.rgReferenceImagesNotSupported',
16-
RG_AUTO_NEGATIVE_NOT_SUPPORTED: 'parameters.invoke.layer.rgAutoNegativeNotSupported',
17-
IP_ADAPTER_NO_MODEL_SELECTED: 'parameters.invoke.layer.ipAdapterNoModelSelected',
18-
IP_ADAPTER_INCOMPATIBLE_BASE_MODEL: 'parameters.invoke.layer.ipAdapterIncompatibleBaseModel',
19-
IP_ADAPTER_NO_IMAGE_SELECTED: 'parameters.invoke.layer.ipAdapterNoImageSelected',
20-
CONTROL_ADAPTER_NO_MODEL_SELECTED: 'parameters.invoke.layer.controlAdapterNoModelSelected',
21-
CONTROL_ADAPTER_INCOMPATIBLE_BASE_MODEL: 'parameters.invoke.layer.controlAdapterIncompatibleBaseModel',
11+
UNSUPPORTED_MODEL: 'controlLayers.warnings.unsupportedModel',
12+
RG_NO_PROMPTS_OR_IP_ADAPTERS: 'controlLayers.warnings.rgNoPromptsOrIPAdapters',
13+
RG_NEGATIVE_PROMPT_NOT_SUPPORTED: 'controlLayers.warnings.rgNegativePromptNotSupported',
14+
RG_REFERENCE_IMAGES_NOT_SUPPORTED: 'controlLayers.warnings.rgReferenceImagesNotSupported',
15+
RG_AUTO_NEGATIVE_NOT_SUPPORTED: 'controlLayers.warnings.rgAutoNegativeNotSupported',
16+
RG_NO_REGION: 'controlLayers.warnings.rgNoRegion',
17+
IP_ADAPTER_NO_MODEL_SELECTED: 'controlLayers.warnings.ipAdapterNoModelSelected',
18+
IP_ADAPTER_INCOMPATIBLE_BASE_MODEL: 'controlLayers.warnings.ipAdapterIncompatibleBaseModel',
19+
IP_ADAPTER_NO_IMAGE_SELECTED: 'controlLayers.warnings.ipAdapterNoImageSelected',
20+
CONTROL_ADAPTER_NO_MODEL_SELECTED: 'controlLayers.warnings.controlAdapterNoModelSelected',
21+
CONTROL_ADAPTER_INCOMPATIBLE_BASE_MODEL: 'controlLayers.warnings.controlAdapterIncompatibleBaseModel',
22+
CONTROL_ADAPTER_NO_CONTROL: 'controlLayers.warnings.controlAdapterNoControl',
2223
} as const;
2324

2425
type WarningTKey = (typeof WARNINGS)[keyof typeof WARNINGS];
@@ -30,45 +31,45 @@ export const getRegionalGuidanceWarnings = (
3031
const warnings: WarningTKey[] = [];
3132

3233
if (entity.objects.length === 0) {
33-
// Layer is in empty state - skip other checks
34-
warnings.push(WARNINGS.EMPTY_LAYER);
35-
} else {
36-
if (entity.positivePrompt === null && entity.negativePrompt === null && entity.referenceImages.length === 0) {
37-
// Must have at least 1 prompt or IP Adapter
38-
warnings.push(WARNINGS.RG_NO_PROMPTS_OR_IP_ADAPTERS);
39-
}
34+
// Layer is in empty state
35+
warnings.push(WARNINGS.RG_NO_REGION);
36+
}
4037

41-
if (model) {
42-
if (model.base === 'sd-3' || model.base === 'sd-2') {
43-
// Unsupported model architecture
44-
warnings.push(WARNINGS.UNSUPPORTED_MODEL);
45-
} else if (model.base === 'flux') {
46-
// Some features are not supported for flux models
47-
if (entity.negativePrompt !== null) {
48-
warnings.push(WARNINGS.RG_NEGATIVE_PROMPT_NOT_SUPPORTED);
49-
}
50-
if (entity.referenceImages.length > 0) {
51-
warnings.push(WARNINGS.RG_REFERENCE_IMAGES_NOT_SUPPORTED);
38+
if (entity.positivePrompt === null && entity.negativePrompt === null && entity.referenceImages.length === 0) {
39+
// Must have at least 1 prompt or IP Adapter
40+
warnings.push(WARNINGS.RG_NO_PROMPTS_OR_IP_ADAPTERS);
41+
}
42+
43+
if (model) {
44+
if (model.base === 'sd-3' || model.base === 'sd-2') {
45+
// Unsupported model architecture
46+
warnings.push(WARNINGS.UNSUPPORTED_MODEL);
47+
} else if (model.base === 'flux') {
48+
// Some features are not supported for flux models
49+
if (entity.negativePrompt !== null) {
50+
warnings.push(WARNINGS.RG_NEGATIVE_PROMPT_NOT_SUPPORTED);
51+
}
52+
if (entity.referenceImages.length > 0) {
53+
warnings.push(WARNINGS.RG_REFERENCE_IMAGES_NOT_SUPPORTED);
54+
}
55+
if (entity.autoNegative) {
56+
warnings.push(WARNINGS.RG_AUTO_NEGATIVE_NOT_SUPPORTED);
57+
}
58+
} else {
59+
entity.referenceImages.forEach(({ ipAdapter }) => {
60+
if (!ipAdapter.model) {
61+
// No model selected
62+
warnings.push(WARNINGS.IP_ADAPTER_NO_MODEL_SELECTED);
63+
} else if (ipAdapter.model.base !== model.base) {
64+
// Supported model architecture but doesn't match
65+
warnings.push(WARNINGS.IP_ADAPTER_INCOMPATIBLE_BASE_MODEL);
5266
}
53-
if (entity.autoNegative) {
54-
warnings.push(WARNINGS.RG_AUTO_NEGATIVE_NOT_SUPPORTED);
67+
68+
if (!ipAdapter.image) {
69+
// No image selected
70+
warnings.push(WARNINGS.IP_ADAPTER_NO_IMAGE_SELECTED);
5571
}
56-
} else {
57-
entity.referenceImages.forEach(({ ipAdapter }) => {
58-
if (!ipAdapter.model) {
59-
// No model selected
60-
warnings.push(WARNINGS.IP_ADAPTER_NO_MODEL_SELECTED);
61-
} else if (ipAdapter.model.base !== model.base) {
62-
// Supported model architecture but doesn't match
63-
warnings.push(WARNINGS.IP_ADAPTER_INCOMPATIBLE_BASE_MODEL);
64-
}
65-
66-
if (!ipAdapter.image) {
67-
// No image selected
68-
warnings.push(WARNINGS.IP_ADAPTER_NO_IMAGE_SELECTED);
69-
}
70-
});
71-
}
72+
});
7273
}
7374
}
7475

@@ -109,50 +110,44 @@ export const getControlLayerWarnings = (
109110
const warnings: WarningTKey[] = [];
110111

111112
if (entity.objects.length === 0) {
112-
// Layer is in empty state - skip other checks
113-
warnings.push(WARNINGS.EMPTY_LAYER);
114-
} else {
115-
if (!entity.controlAdapter.model) {
116-
// No model selected
117-
warnings.push(WARNINGS.CONTROL_ADAPTER_NO_MODEL_SELECTED);
118-
} else if (model) {
119-
if (model.base === 'sd-3' || model.base === 'sd-2') {
120-
// Unsupported model architecture
121-
warnings.push(WARNINGS.UNSUPPORTED_MODEL);
122-
} else if (entity.controlAdapter.model.base !== model.base) {
123-
// Supported model architecture but doesn't match
124-
warnings.push(WARNINGS.CONTROL_ADAPTER_INCOMPATIBLE_BASE_MODEL);
125-
}
113+
// Layer is in empty state
114+
warnings.push(WARNINGS.CONTROL_ADAPTER_NO_CONTROL);
115+
}
116+
117+
if (!entity.controlAdapter.model) {
118+
// No model selected
119+
warnings.push(WARNINGS.CONTROL_ADAPTER_NO_MODEL_SELECTED);
120+
} else if (model) {
121+
if (model.base === 'sd-3' || model.base === 'sd-2') {
122+
// Unsupported model architecture
123+
warnings.push(WARNINGS.UNSUPPORTED_MODEL);
124+
} else if (entity.controlAdapter.model.base !== model.base) {
125+
// Supported model architecture but doesn't match
126+
warnings.push(WARNINGS.CONTROL_ADAPTER_INCOMPATIBLE_BASE_MODEL);
126127
}
127128
}
128129

129130
return warnings;
130131
};
131132

132133
export const getRasterLayerWarnings = (
133-
entity: CanvasRasterLayerState,
134+
_entity: CanvasRasterLayerState,
134135
_model: ParameterModel | null
135136
): WarningTKey[] => {
136137
const warnings: WarningTKey[] = [];
137138

138-
if (entity.objects.length === 0) {
139-
// Layer is in empty state - skip other checks
140-
warnings.push(WARNINGS.EMPTY_LAYER);
141-
}
139+
// There are no warnings at the moment for raster layers.
142140

143141
return warnings;
144142
};
145143

146144
export const getInpaintMaskWarnings = (
147-
entity: CanvasInpaintMaskState,
145+
_entity: CanvasInpaintMaskState,
148146
_model: ParameterModel | null
149147
): WarningTKey[] => {
150148
const warnings: WarningTKey[] = [];
151149

152-
if (entity.objects.length === 0) {
153-
// Layer is in empty state - skip other checks
154-
warnings.push(WARNINGS.EMPTY_LAYER);
155-
}
150+
// There are no warnings at the moment for inpaint masks.
156151

157152
return warnings;
158153
};

0 commit comments

Comments
 (0)