Skip to content

Commit e16598c

Browse files
authored
Merge branch 'main' into patch-2
2 parents 6506ce3 + 0e5eac7 commit e16598c

File tree

8 files changed

+73
-26
lines changed

8 files changed

+73
-26
lines changed

docs/nodes/communityNodes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ To use a community node graph, download the the `.json` node graph file and load
4141

4242
**Description:** This InvokeAI node takes in a collection of images and randomly chooses one. This can be useful when you have a number of poses to choose from for a ControlNet node, or a number of input images for another purpose.
4343

44-
**Node Link:** https://github.com/JPPhoto/film-grain-node
44+
**Node Link:** https://github.com/JPPhoto/image-picker-node
4545

4646
--------------------------------
4747
### Retroize

invokeai/app/services/graph.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class IterateInvocationOutput(BaseInvocationOutput):
182182

183183

184184
# TODO: Fill this out and move to invocations
185-
@invocation("iterate")
185+
@invocation("iterate", version="1.0.0")
186186
class IterateInvocation(BaseInvocation):
187187
"""Iterates over a list of items"""
188188

@@ -203,7 +203,7 @@ class CollectInvocationOutput(BaseInvocationOutput):
203203
)
204204

205205

206-
@invocation("collect")
206+
@invocation("collect", version="1.0.0")
207207
class CollectInvocation(BaseInvocation):
208208
"""Collects values into a collection"""
209209

invokeai/backend/install/invokeai_configure.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ def create(self):
507507
scroll_exit=True,
508508
)
509509
else:
510-
self.vram_cache_size = DummyWidgetValue.zero
510+
self.vram = DummyWidgetValue.zero
511511
self.nextrely += 1
512512
self.outdir = self.add_widget_intelligent(
513513
FileBox,
@@ -605,7 +605,8 @@ def marshall_arguments(self):
605605
"vram",
606606
"outdir",
607607
]:
608-
setattr(new_opts, attr, getattr(self, attr).value)
608+
if hasattr(self, attr):
609+
setattr(new_opts, attr, getattr(self, attr).value)
609610

610611
for attr in self.autoimport_dirs:
611612
directory = Path(self.autoimport_dirs[attr].value)

invokeai/frontend/install/invokeai_update.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,15 @@ def welcome(versions: dict):
5454
def text():
5555
yield f"InvokeAI Version: [bold yellow]{__version__}"
5656
yield ""
57-
yield "This script will update InvokeAI to the latest release, or to a development version of your choice."
57+
yield "This script will update InvokeAI to the latest release, or to the development version of your choice."
58+
yield ""
59+
yield "When updating to an arbitrary tag or branch, be aware that the front end may be mismatched to the backend,"
60+
yield "making the web frontend unusable. Please downgrade to the latest release if this happens."
5861
yield ""
5962
yield "[bold yellow]Options:"
6063
yield f"""[1] Update to the latest official release ([italic]{versions[0]['tag_name']}[/italic])
61-
[2] Update to the bleeding-edge development version ([italic]main[/italic])
62-
[3] Manually enter the [bold]tag name[/bold] for the version you wish to update to
63-
[4] Manually enter the [bold]branch name[/bold] for the version you wish to update to"""
64+
[2] Manually enter the [bold]tag name[/bold] for the version you wish to update to
65+
[3] Manually enter the [bold]branch name[/bold] for the version you wish to update to"""
6466

6567
console.rule()
6668
print(
@@ -104,11 +106,11 @@ def main():
104106
if choice == "1":
105107
release = versions[0]["tag_name"]
106108
elif choice == "2":
107-
release = "main"
109+
while not tag:
110+
tag = Prompt.ask("Enter an InvokeAI tag name")
108111
elif choice == "3":
109-
tag = Prompt.ask("Enter an InvokeAI tag name")
110-
elif choice == "4":
111-
branch = Prompt.ask("Enter an InvokeAI branch name")
112+
while not branch:
113+
branch = Prompt.ask("Enter an InvokeAI branch name")
112114

113115
extras = get_extras()
114116

invokeai/frontend/web/src/features/canvas/store/canvasSlice.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,18 @@ export const canvasSlice = createSlice({
235235
state.boundingBoxDimensions.width,
236236
state.boundingBoxDimensions.height,
237237
];
238+
const [currScaledWidth, currScaledHeight] = [
239+
state.scaledBoundingBoxDimensions.width,
240+
state.scaledBoundingBoxDimensions.height,
241+
];
238242
state.boundingBoxDimensions = {
239243
width: currHeight,
240244
height: currWidth,
241245
};
246+
state.scaledBoundingBoxDimensions = {
247+
width: currScaledHeight,
248+
height: currScaledWidth,
249+
};
242250
},
243251
setBoundingBoxCoordinates: (state, action: PayloadAction<Vector2d>) => {
244252
state.boundingBoxCoordinates = floorCoordinates(action.payload);
@@ -788,6 +796,10 @@ export const canvasSlice = createSlice({
788796
state.boundingBoxDimensions.width / ratio,
789797
64
790798
);
799+
state.scaledBoundingBoxDimensions.height = roundToMultiple(
800+
state.scaledBoundingBoxDimensions.width / ratio,
801+
64
802+
);
791803
}
792804
});
793805
},

invokeai/frontend/web/src/features/nodes/util/parseSchema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const parseSchema = (
7373
const title = schema.title.replace('Invocation', '');
7474
const tags = schema.tags ?? [];
7575
const description = schema.description ?? '';
76-
const version = schema.version ?? '';
76+
const version = schema.version;
7777

7878
const inputs = reduce(
7979
schema.properties,

invokeai/frontend/web/src/features/parameters/components/Parameters/Canvas/InfillAndScaling/ParamScaledHeight.tsx

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { createSelector } from '@reduxjs/toolkit';
22
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
33
import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions';
44
import IAISlider from 'common/components/IAISlider';
5+
import { roundToMultiple } from 'common/util/roundDownToMultiple';
56
import { canvasSelector } from 'features/canvas/store/canvasSelectors';
67
import { setScaledBoundingBoxDimensions } from 'features/canvas/store/canvasSlice';
78
import { generationSelector } from 'features/parameters/store/generationSelectors';
@@ -12,20 +13,21 @@ const selector = createSelector(
1213
[generationSelector, canvasSelector],
1314
(generation, canvas) => {
1415
const { scaledBoundingBoxDimensions, boundingBoxScaleMethod } = canvas;
15-
const { model } = generation;
16+
const { model, aspectRatio } = generation;
1617

1718
return {
1819
model,
1920
scaledBoundingBoxDimensions,
2021
isManual: boundingBoxScaleMethod === 'manual',
22+
aspectRatio,
2123
};
2224
},
2325
defaultSelectorOptions
2426
);
2527

2628
const ParamScaledHeight = () => {
2729
const dispatch = useAppDispatch();
28-
const { model, isManual, scaledBoundingBoxDimensions } =
30+
const { model, isManual, scaledBoundingBoxDimensions, aspectRatio } =
2931
useAppSelector(selector);
3032

3133
const initial = ['sdxl', 'sdxl-refiner'].includes(model?.base_model as string)
@@ -35,19 +37,33 @@ const ParamScaledHeight = () => {
3537
const { t } = useTranslation();
3638

3739
const handleChangeScaledHeight = (v: number) => {
40+
let newWidth = scaledBoundingBoxDimensions.width;
41+
const newHeight = Math.floor(v);
42+
43+
if (aspectRatio) {
44+
newWidth = roundToMultiple(newHeight * aspectRatio, 64);
45+
}
46+
3847
dispatch(
3948
setScaledBoundingBoxDimensions({
40-
...scaledBoundingBoxDimensions,
41-
height: Math.floor(v),
49+
width: newWidth,
50+
height: newHeight,
4251
})
4352
);
4453
};
4554

4655
const handleResetScaledHeight = () => {
56+
let resetWidth = scaledBoundingBoxDimensions.width;
57+
const resetHeight = Math.floor(initial);
58+
59+
if (aspectRatio) {
60+
resetWidth = roundToMultiple(resetHeight * aspectRatio, 64);
61+
}
62+
4763
dispatch(
4864
setScaledBoundingBoxDimensions({
49-
...scaledBoundingBoxDimensions,
50-
height: Math.floor(initial),
65+
width: resetWidth,
66+
height: resetHeight,
5167
})
5268
);
5369
};

invokeai/frontend/web/src/features/parameters/components/Parameters/Canvas/InfillAndScaling/ParamScaledWidth.tsx

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { createSelector } from '@reduxjs/toolkit';
22
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
33
import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions';
44
import IAISlider from 'common/components/IAISlider';
5+
import { roundToMultiple } from 'common/util/roundDownToMultiple';
56
import { canvasSelector } from 'features/canvas/store/canvasSelectors';
67
import { setScaledBoundingBoxDimensions } from 'features/canvas/store/canvasSlice';
78
import { generationSelector } from 'features/parameters/store/generationSelectors';
@@ -12,11 +13,12 @@ const selector = createSelector(
1213
[canvasSelector, generationSelector],
1314
(canvas, generation) => {
1415
const { boundingBoxScaleMethod, scaledBoundingBoxDimensions } = canvas;
15-
const { model } = generation;
16+
const { model, aspectRatio } = generation;
1617

1718
return {
1819
model,
1920
scaledBoundingBoxDimensions,
21+
aspectRatio,
2022
isManual: boundingBoxScaleMethod === 'manual',
2123
};
2224
},
@@ -25,7 +27,7 @@ const selector = createSelector(
2527

2628
const ParamScaledWidth = () => {
2729
const dispatch = useAppDispatch();
28-
const { model, isManual, scaledBoundingBoxDimensions } =
30+
const { model, isManual, scaledBoundingBoxDimensions, aspectRatio } =
2931
useAppSelector(selector);
3032

3133
const initial = ['sdxl', 'sdxl-refiner'].includes(model?.base_model as string)
@@ -35,19 +37,33 @@ const ParamScaledWidth = () => {
3537
const { t } = useTranslation();
3638

3739
const handleChangeScaledWidth = (v: number) => {
40+
const newWidth = Math.floor(v);
41+
let newHeight = scaledBoundingBoxDimensions.height;
42+
43+
if (aspectRatio) {
44+
newHeight = roundToMultiple(newWidth / aspectRatio, 64);
45+
}
46+
3847
dispatch(
3948
setScaledBoundingBoxDimensions({
40-
...scaledBoundingBoxDimensions,
41-
width: Math.floor(v),
49+
width: newWidth,
50+
height: newHeight,
4251
})
4352
);
4453
};
4554

4655
const handleResetScaledWidth = () => {
56+
const resetWidth = Math.floor(initial);
57+
let resetHeight = scaledBoundingBoxDimensions.height;
58+
59+
if (aspectRatio) {
60+
resetHeight = roundToMultiple(resetWidth / aspectRatio, 64);
61+
}
62+
4763
dispatch(
4864
setScaledBoundingBoxDimensions({
49-
...scaledBoundingBoxDimensions,
50-
width: Math.floor(initial),
65+
width: resetWidth,
66+
height: resetHeight,
5167
})
5268
);
5369
};

0 commit comments

Comments
 (0)