think it's finally getting somewhere but it's still really janky

This commit is contained in:
tim h 2023-07-08 16:17:25 -05:00
parent e5d1b23268
commit 5b3782e82a

View file

@ -1414,6 +1414,10 @@ const dream_img2img_callback = (bb, resolution, state) => {
// Get visible pixels // Get visible pixels
const visibleCanvas = uil.getVisible(bb); const visibleCanvas = uil.getVisible(bb);
if (extensions.alwaysOnScripts) {
buildAlwaysOnScripts(state);
}
// Do nothing if no image exists // Do nothing if no image exists
if (isCanvasBlank(0, 0, bb.w, bb.h, visibleCanvas)) return; if (isCanvasBlank(0, 0, bb.w, bb.h, visibleCanvas)) return;
@ -1558,6 +1562,20 @@ const dream_img2img_callback = (bb, resolution, state) => {
request.mask = reqCanvas.toDataURL(); request.mask = reqCanvas.toDataURL();
request.inpaint_full_res = state.fullResolution; request.inpaint_full_res = state.fullResolution;
// add dynamic prompts stuff if it's enabled
if (extensions.dynamicPromptsEnabled) {
addDynamicPromptsToAlwaysOnScripts(state);
}
if (extensions.controlNetActive) {
addControlNetToAlwaysOnScripts(state, null, null);
}
if (extensions.alwaysOnScripts) {
// check again just to be sure because i'm an idiot?
// addControlNetToAlwaysOnScripts(state);
// addDynamicPromptsToAlwaysOnScripts(state);
request.alwayson_scripts = state.alwayson_scripts;
}
// Dream // Dream
_generate("img2img", request, bb, { _generate("img2img", request, bb, {
keepUnmask: state.keepUnmasked ? bbCanvas : null, keepUnmask: state.keepUnmasked ? bbCanvas : null,
@ -2827,17 +2845,32 @@ function addDynamicPromptsToAlwaysOnScripts(state) {
function addControlNetToAlwaysOnScripts(state, initCanvas, maskCanvas) { function addControlNetToAlwaysOnScripts(state, initCanvas, maskCanvas) {
if (extensions.controlNetEnabled && extensions.controlNetActive) { if (extensions.controlNetEnabled && extensions.controlNetActive) {
state.alwayson_scripts.controlnet = {}; state.alwayson_scripts.controlnet = {};
state.alwayson_scripts.controlnet.args = [ if (initCanvas == null && maskCanvas == null) {
{ //img2img?
input_image: initCanvas.toDataURL(), state.alwayson_scripts.controlnet.args = [
mask: maskCanvas.toDataURL(), {
module: extensions.selectedControlNetModule, module: extensions.selectedControlNetModule,
model: extensions.selectedControlNetModel, model: extensions.selectedControlNetModel,
control_mode: document.getElementById("controlNetMode-select").value, control_mode: document.getElementById("controlNetMode-select").value,
// resize mode? processor_res: 64,
// weights / steps? // resize mode?
}, // weights / steps?
]; },
];
} else {
state.alwayson_scripts.controlnet.args = [
{
module: extensions.selectedControlNetModule,
model: extensions.selectedControlNetModel,
control_mode: document.getElementById("controlNetMode-select").value,
input_image: initCanvas.toDataURL(),
mask: maskCanvas.toDataURL(),
processor_res: 64,
// resize mode?
// weights / steps?
},
];
}
} }
// request.alwayson_scripts = state.alwayson_scripts; // request.alwayson_scripts = state.alwayson_scripts;