mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-26 02:58:11 +08:00
Add inpainting and outpainting to Imaginate (#864)
* Do not select layer immediatly on drag * Add LayerReferenceInput MVP widget * Properties Panel * Fix dragging marker flicker * Change mask shape to outline * Add mask rendering * Simplify select code * Remove colours * Fix inpaint/outpaint and rearrage widget UX * Add mask blur and mask starting fill parameters * Guard for the case when the layer is missing * Add icon to LayerReferenceInput to finalize its UI Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
committed by
Keavon Chambers
co-authored by
Keavon Chambers
parent
5bf7b9fdf8
commit
9d80defa14
@@ -15,7 +15,6 @@ export function createNodeGraphState(editor: Editor) {
|
||||
editor.subscriptions.subscribeJsMessage(UpdateNodeGraph, (updateNodeGraph) => {
|
||||
state.nodes = updateNodeGraph.nodes;
|
||||
state.links = updateNodeGraph.links;
|
||||
console.info("Recieved updated nodes", state.nodes);
|
||||
});
|
||||
editor.subscriptions.subscribeJsMessage(UpdateNodeTypes, (updateNodeTypes) => {
|
||||
state.nodeTypes = updateNodeTypes.nodeTypes;
|
||||
|
||||
@@ -68,7 +68,7 @@ export function createPortfolioState(editor: Editor) {
|
||||
imaginateCheckConnection(hostname, editor);
|
||||
});
|
||||
editor.subscriptions.subscribeJsMessage(TriggerImaginateGenerate, async (triggerImaginateGenerate) => {
|
||||
const { documentId, layerPath, hostname, refreshFrequency, baseImage, parameters } = triggerImaginateGenerate;
|
||||
const { documentId, layerPath, hostname, refreshFrequency, baseImage, maskImage, maskPaintMode, maskBlurPx, maskFillContent, parameters } = triggerImaginateGenerate;
|
||||
|
||||
// Handle img2img mode
|
||||
let image: Blob | undefined;
|
||||
@@ -79,7 +79,14 @@ export function createPortfolioState(editor: Editor) {
|
||||
preloadAndSetImaginateBlobURL(editor, image, documentId, layerPath, baseImage.size[0], baseImage.size[1]);
|
||||
}
|
||||
|
||||
imaginateGenerate(parameters, image, hostname, refreshFrequency, documentId, layerPath, editor);
|
||||
// Handle layer mask
|
||||
let mask: Blob | undefined;
|
||||
if (maskImage !== undefined) {
|
||||
// Rasterize the SVG to an image file
|
||||
mask = await rasterizeSVG(maskImage.svg, maskImage.size[0], maskImage.size[1], "image/png");
|
||||
}
|
||||
|
||||
imaginateGenerate(parameters, image, mask, maskPaintMode, maskBlurPx, maskFillContent, hostname, refreshFrequency, documentId, layerPath, editor);
|
||||
});
|
||||
editor.subscriptions.subscribeJsMessage(TriggerImaginateTerminate, async (triggerImaginateTerminate) => {
|
||||
const { documentId, layerPath, hostname } = triggerImaginateTerminate;
|
||||
|
||||
Reference in New Issue
Block a user