Skip to content

Commit

Permalink
it works
Browse files Browse the repository at this point in the history
  • Loading branch information
zero01101 committed Feb 21, 2024
1 parent ce6052d commit c252ed6
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 7 deletions.
10 changes: 5 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,12 @@
<label id="hrFixLabel" class="hrfix">Choose HRfix upscaler</label>
<div id="hrFixUpscaler" class="hrfix"></div>
<div id="hrDenoising" class="hrfix"></div>
<input
<!-- <input
type="checkbox"
id="cbxRestoreFaces"
onchange="changeRestoreFaces()" />
<label for="cbxRestoreFaces">Restore Faces</label>
<br />
<br /> -->
<input
type="checkbox"
id="cbxSyncCursorSize"
Expand Down Expand Up @@ -534,7 +534,7 @@
<!-- Basics -->
<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/extensions.js?v=14e4f0f" type="text/javascript"></script>
<script src="js/extensions.js?v=5102854" type="text/javascript"></script>

<!-- Base Libs -->
<script src="js/lib/util.js?v=379aef7" type="text/javascript"></script>
Expand All @@ -560,7 +560,7 @@

<!-- Content -->
<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
src="js/ui/floating/history.js?v=4f29db4"
Expand All @@ -574,7 +574,7 @@
src="js/ui/tool/generic.js?v=3e678e0"
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
src="js/ui/tool/maskbrush.js?v=e9bd0eb"
type="text/javascript"></script>
Expand Down
1 change: 1 addition & 0 deletions js/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
const extensions = {
// alwaysOnScriptsData: {},
alwaysOnScripts: false,
// softInpaintingEnabled: false, //???
controlNetEnabled: false,
controlNetActive: false,
controlNetReferenceActive: false,
Expand Down
4 changes: 2 additions & 2 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ function startup() {
changeRefinerEnabled();
changeHiResFix();
changeHiResSquare();
changeRestoreFaces();
// changeRestoreFaces();
changeSyncCursorSize();
changeControlNetExtension();
changeControlNetReference();
Expand Down Expand Up @@ -1558,7 +1558,7 @@ function loadSettings() {
document.getElementById("maskBlur").value = Number(_mask_blur);
document.getElementById("seed").value = Number(_seed);
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 =
Boolean(_sync_cursor_size);
document.getElementById("hrFixScale").value = Number(_hrfix_scale);
Expand Down
26 changes: 26 additions & 0 deletions js/ui/tool/dream.js
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,7 @@ const dream_img2img_callback = (bb, resolution, state) => {
if (extensions.dynamicPromptsEnabled) {
addDynamicPromptsToAlwaysOnScripts(state);
}
// and controlnet
if (extensions.controlNetActive) {
if (extensions.controlNetReferenceActive) {
addControlNetToAlwaysOnScripts(
Expand All @@ -1596,6 +1597,12 @@ const dream_img2img_callback = (bb, resolution, state) => {
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) {
// check again just to be sure because i'm an idiot?
// addControlNetToAlwaysOnScripts(state);
Expand Down Expand Up @@ -2751,6 +2758,7 @@ const img2imgTool = () =>
"icon-squircle",
() => {
if (state.softInpaint) {
extensions.checkForSoftInpainting();
state.ctxmenu.softInpaintScheduleBiasSlider.classList.remove(
"invisible"
);
Expand Down Expand Up @@ -3082,11 +3090,29 @@ const sendSeed = (seed) => {
};

function buildAlwaysOnScripts(state) {
//todo make sure soft inpainting works

if (extensions.alwaysOnScripts) {
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) {
if (extensions.dynamicPromptsEnabled) {
state.alwayson_scripts[extensions.dynamicPromptsAlwaysonScriptName] = {};
Expand Down

0 comments on commit c252ed6

Please sign in to comment.