zero01101 / openOutpaint

local offline javascript and html canvas outpainting gizmo for stable diffusion webUI API 🐠
MIT License
507 stars 44 forks source link

Add mask in History #111

Closed mpmo10 closed 1 year ago

mpmo10 commented 1 year ago

Is your feature request related to a problem? Please describe. Problem is when I do ctrl + z to bring back the mask, it doesn't bring it back. Only brings back the previous generation (or the original pic)

Describe the solution you'd like When doing ctrl + z after a generation that I clicked "Y" to, I want the previous generation come back while the mask that I've put stays in its place and doesn't go away. So basically can you please add the option of putting the mask history in "History" tab?

zero01101 commented 1 year ago

so if i recall correctly, there's some quibbles with adding mask actions to history - @seijihariki might need to correct me because there's a high likelihood i'm wrong lol - but as an alternative to that, if you git checkout clear_brush_mask_option there should now be an option to preserve brushed masks in the dream and img2img tool context menus, which applies after accepting an image if you'd care to see if that does something like you're desiring

seijihariki commented 1 year ago

There are no actual implementation barriers regarding this, it was mostly a "we ended up doing this way, so it stayed" kind of thing. It was even a possibility I gave when discussing the implementation of the color brush tool: https://github.com/zero01101/openOutpaint/pull/64#issuecomment-1335970221

Implementation of this feature would be basically the same as the current implementation of color brushes. I think we should start finding some ways to organize the history because long editing sessions will have hundreds of entries there, many of them the same (50 entries of "Mask Brush Draw" and "Mask Brush Erase" one after another)...

Maybe even some "history cleaning", such as keeping the most recent n entries in the history (n defined on the settings page, probably). This should also allow freeing the RAM during long editing sessions and deleting unused layers. (we could also store history entries in the indexedDB. (workspaces and saving sessions, maybe??)

zero01101 commented 1 year ago

It was even a possibility I gave when discussing the implementation of the color brush tool:

yknow i literally missed that entire sentence in that post until now?? i promise i can read :|

i definitely think a history max x entries setting is a good idea just in general as well for what it's worth

mpmo10 commented 1 year ago

so if i recall correctly, there's some quibbles with adding mask actions to history - @seijihariki might need to correct me because there's a high likelihood i'm wrong lol - but as an alternative to that, if you git checkout clear_brush_mask_option there should now be an option to preserve brushed masks in the dream and img2img tool context menus, which applies after accepting an image if you'd care to see if that does something like you're desiring

oh ok will try that tonight thanks! Also, is there a way to increase the max steps count from 70 to 200? Sometimes for bigger outpainting jobs 70 isn't enough imo. So is there anyway I can edit one of the files to change the max 70 number..?

seijihariki commented 1 year ago

I feel some slider ranges should be configurable in the settings menu... For now, editing js/index.js should not be hard to increase the range. It has a bunch of 'createSlider' functions, and you just need to change the max value passed to it.

seijihariki commented 1 year ago

So you don't have to manually search for the correct slider, it is here: https://github.com/zero01101/openOutpaint/blob/35d586885459e8023a0d125b71b9676114191957/js/index.js#L606

Just change 70 to whatever you need for now, but I will give a look to making these more easily configurable.

mpmo10 commented 1 year ago

So you don't have to manually search for the correct slider, it is here:

https://github.com/zero01101/openOutpaint/blob/35d586885459e8023a0d125b71b9676114191957/js/index.js#L606

Just change 70 to whatever you need for now, but I will give a look to making these more easily configurable.

nice thanks!

mpmo10 commented 1 year ago

I did "git pull" but the mask goes away even after I choose "Y" to a generation and then undo. Am I doing something wrong?

zero01101 commented 1 year ago

did you run git checkout clear_brush_mask_option before git pull? there should be a new option checkbox in the context menu

mpmo10 commented 1 year ago

2022-12-24 00_10_05-Administrator_ Anaconda Prompt (anaconda3) - openOutpaint bat _sh

I got this error:

"(base) Z:\openOutpaint\openOutpaint>git checkout clear_brush_mask_option error: Your local changes to the following files would be overwritten by checkout: js/index.js Please commit your changes or stash them before you switch branches. Aborting"

I did edit the index.js to increase 70 steps to 200. Is that what's causing the issue?

zero01101 commented 1 year ago

yep, that'd be it - you can run git stash to put index.js back to unmodified state, and you should be able to checkout the other branch

mpmo10 commented 1 year ago

yep, that'd be it - you can run git stash to put index.js back to unmodified state, and you should be able to checkout the other branch

Hmm it says it worked but I still don't see the option in the context menu 2022-12-24 01_44_41-Administrator_ Anaconda Prompt (anaconda3) - openOutpaint bat _sh

2022-12-24 01_44_26-openOutpaint 🐠

zero01101 commented 1 year ago

you might need to refresh without cache - i believe the almost-universal shortcut for that on windows browsers is [CTRL]+[F5] but otherwise you could open your [F12] devtools window and there should be an option in there somewhere to disable cache

but yeah, you're looking for this toggle:
image

oh, also, you don't need to include "/sh" in the commandline; that was just indicating the file to run would be "openOutpaint.sh" on mac/linux systems

mpmo10 commented 1 year ago

Ahh it worked thanks! However now I tried to edit the index.js file to change 70 steps to 200 steps but it didn't apply. Is there a way to have both this option (preserve brushed masks) and also have the ability for us to change the max number of steps at the same time?

seijihariki commented 1 year ago

The steps thing should not have changed... Try erasing all site data and opening it again. This should clear the cache and update the slider max.

mpmo10 commented 1 year ago

The steps thing should not have changed... Try erasing all site data and opening it again. This should clear the cache and update the slider max.

ohh my bad, I forgot about the ctrl + f5 thing. Ok it's working now. Best out/inpainting UI out there, cheers fellas!!