This commit is contained in:
tim h 2024-02-21 14:40:02 -06:00
parent ce6052d68e
commit c252ed6ea1
4 changed files with 34 additions and 7 deletions

View file

@ -186,12 +186,12 @@
<label id="hrFixLabel" class="hrfix">Choose HRfix upscaler</label> <label id="hrFixLabel" class="hrfix">Choose HRfix upscaler</label>
<div id="hrFixUpscaler" class="hrfix"></div> <div id="hrFixUpscaler" class="hrfix"></div>
<div id="hrDenoising" class="hrfix"></div> <div id="hrDenoising" class="hrfix"></div>
<input <!-- <input
type="checkbox" type="checkbox"
id="cbxRestoreFaces" id="cbxRestoreFaces"
onchange="changeRestoreFaces()" /> onchange="changeRestoreFaces()" />
<label for="cbxRestoreFaces">Restore Faces</label> <label for="cbxRestoreFaces">Restore Faces</label>
<br /> <br /> -->
<input <input
type="checkbox" type="checkbox"
id="cbxSyncCursorSize" id="cbxSyncCursorSize"
@ -534,7 +534,7 @@
<!-- Basics --> <!-- Basics -->
<script src="js/global.js?v=ac30d16" type="text/javascript"></script> <script src="js/global.js?v=ac30d16" type="text/javascript"></script>
<script src="js/defaults.js?v=5b06818" type="text/javascript"></script> <script src="js/defaults.js?v=5b06818" type="text/javascript"></script>
<script src="js/extensions.js?v=14e4f0f" type="text/javascript"></script> <script src="js/extensions.js?v=5102854" type="text/javascript"></script>
<!-- Base Libs --> <!-- Base Libs -->
<script src="js/lib/util.js?v=379aef7" type="text/javascript"></script> <script src="js/lib/util.js?v=379aef7" type="text/javascript"></script>
@ -560,7 +560,7 @@
<!-- Content --> <!-- Content -->
<script src="js/prompt.js?v=7a1c68c" type="text/javascript"></script> <script src="js/prompt.js?v=7a1c68c" type="text/javascript"></script>
<script src="js/index.js?v=70af18f" type="text/javascript"></script> <script src="js/index.js?v=206c7df" type="text/javascript"></script>
<script <script
src="js/ui/floating/history.js?v=4f29db4" src="js/ui/floating/history.js?v=4f29db4"
@ -574,7 +574,7 @@
src="js/ui/tool/generic.js?v=3e678e0" src="js/ui/tool/generic.js?v=3e678e0"
type="text/javascript"></script> type="text/javascript"></script>
<script src="js/ui/tool/dream.js?v=d8cfe88" type="text/javascript"></script> <script src="js/ui/tool/dream.js?v=b224aac" type="text/javascript"></script>
<script <script
src="js/ui/tool/maskbrush.js?v=e9bd0eb" src="js/ui/tool/maskbrush.js?v=e9bd0eb"
type="text/javascript"></script> type="text/javascript"></script>

View file

@ -5,6 +5,7 @@
const extensions = { const extensions = {
// alwaysOnScriptsData: {}, // alwaysOnScriptsData: {},
alwaysOnScripts: false, alwaysOnScripts: false,
// softInpaintingEnabled: false, //???
controlNetEnabled: false, controlNetEnabled: false,
controlNetActive: false, controlNetActive: false,
controlNetReferenceActive: false, controlNetReferenceActive: false,

View file

@ -170,7 +170,7 @@ function startup() {
changeRefinerEnabled(); changeRefinerEnabled();
changeHiResFix(); changeHiResFix();
changeHiResSquare(); changeHiResSquare();
changeRestoreFaces(); // changeRestoreFaces();
changeSyncCursorSize(); changeSyncCursorSize();
changeControlNetExtension(); changeControlNetExtension();
changeControlNetReference(); changeControlNetReference();
@ -1558,7 +1558,7 @@ function loadSettings() {
document.getElementById("maskBlur").value = Number(_mask_blur); document.getElementById("maskBlur").value = Number(_mask_blur);
document.getElementById("seed").value = Number(_seed); document.getElementById("seed").value = Number(_seed);
document.getElementById("cbxHRFix").checked = Boolean(_enable_hr); document.getElementById("cbxHRFix").checked = Boolean(_enable_hr);
document.getElementById("cbxRestoreFaces").checked = Boolean(_restore_faces); // document.getElementById("cbxRestoreFaces").checked = Boolean(_restore_faces);
document.getElementById("cbxSyncCursorSize").checked = document.getElementById("cbxSyncCursorSize").checked =
Boolean(_sync_cursor_size); Boolean(_sync_cursor_size);
document.getElementById("hrFixScale").value = Number(_hrfix_scale); document.getElementById("hrFixScale").value = Number(_hrfix_scale);

View file

@ -1585,6 +1585,7 @@ const dream_img2img_callback = (bb, resolution, state) => {
if (extensions.dynamicPromptsEnabled) { if (extensions.dynamicPromptsEnabled) {
addDynamicPromptsToAlwaysOnScripts(state); addDynamicPromptsToAlwaysOnScripts(state);
} }
// and controlnet
if (extensions.controlNetActive) { if (extensions.controlNetActive) {
if (extensions.controlNetReferenceActive) { if (extensions.controlNetReferenceActive) {
addControlNetToAlwaysOnScripts( addControlNetToAlwaysOnScripts(
@ -1596,6 +1597,12 @@ const dream_img2img_callback = (bb, resolution, state) => {
addControlNetToAlwaysOnScripts(state, null, null); // //WTF??? addControlNetToAlwaysOnScripts(state, null, null); // //WTF???
} }
} }
// and soft inpainting
if (state.softInpaint) {
addSoftInpaintingToAlwaysOnScripts(state);
// TODO build always on scripts entry for soft inpaint
}
if (extensions.alwaysOnScripts) { if (extensions.alwaysOnScripts) {
// check again just to be sure because i'm an idiot? // check again just to be sure because i'm an idiot?
// addControlNetToAlwaysOnScripts(state); // addControlNetToAlwaysOnScripts(state);
@ -2751,6 +2758,7 @@ const img2imgTool = () =>
"icon-squircle", "icon-squircle",
() => { () => {
if (state.softInpaint) { if (state.softInpaint) {
extensions.checkForSoftInpainting();
state.ctxmenu.softInpaintScheduleBiasSlider.classList.remove( state.ctxmenu.softInpaintScheduleBiasSlider.classList.remove(
"invisible" "invisible"
); );
@ -3082,11 +3090,29 @@ const sendSeed = (seed) => {
}; };
function buildAlwaysOnScripts(state) { function buildAlwaysOnScripts(state) {
//todo make sure soft inpainting works
if (extensions.alwaysOnScripts) { if (extensions.alwaysOnScripts) {
state.alwayson_scripts = {}; state.alwayson_scripts = {};
} }
} }
function addSoftInpaintingToAlwaysOnScripts(state) {
if (extensions.alwaysOnScripts) {
//?????
state.alwayson_scripts["Soft Inpainting"] = {};
state.alwayson_scripts["Soft Inpainting"].args = [
state.softInpaint,
state.softInpaintScheduleBias,
state.softInpaintPreservationStrength,
state.softInpaintTransitionContrastBoost,
state.softInpaintMaskInfluence,
state.softInpaintDifferenceThreshold,
state.softInpaintDifferenceContrast,
];
}
}
function addDynamicPromptsToAlwaysOnScripts(state) { function addDynamicPromptsToAlwaysOnScripts(state) {
if (extensions.dynamicPromptsEnabled) { if (extensions.dynamicPromptsEnabled) {
state.alwayson_scripts[extensions.dynamicPromptsAlwaysonScriptName] = {}; state.alwayson_scripts[extensions.dynamicPromptsAlwaysonScriptName] = {};