Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Control Layers disappear & only top 2 layers left there. #823

Closed
pendave opened this issue Jun 17, 2024 · 4 comments
Closed

[bug] Control Layers disappear & only top 2 layers left there. #823

pendave opened this issue Jun 17, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@pendave
Copy link

pendave commented Jun 17, 2024

It's strange that when I paste in a new image layer and do Ctrl +E combine image layers action, the Control Layers already there suddenly disappear and only mayby top 2 layers left, even they have no relationship to the combined image layer.

image

I tried many times and it always happens. Please fix this bug.

If there're Control Layers have relationship with the image layer, for example here 'draw01' layer, when it's combined and updated to 'draw01 合并' layer, please also update the Control Layers related to 'draw01 合并' layer.

Thanks!

@Acly Acly added the bug Something isn't working label Jun 17, 2024
@arcusmaximus
Copy link

arcusmaximus commented Jun 18, 2024

Posting here since it's related. When merging a regular layer into the only ControlNet layer in my project, I got the following error:

ValueError
Python 3.10.7: D:\Krita\bin\krita.exe
Tue Jun 18 21:53:07 2024

A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.

 C:\Users\...\AppData\Roaming\krita\pykrita\ai_diffusion\control.py in <lambda>()
  166         control = ControlLayer(self._model, self._last_mode, layer.id)
  167         control.mode_changed.connect(self._update_last_mode)
  168         layer.removed.connect(lambda: self.remove(control))
  169         self._layers.append(control)
  170         self.added.emit(control)
layer undefined
self = <ai_diffusion.control.ControlLayerList object>
self.remove = <bound method ControlLayerList.remove of <ai_diffusion.control.ControlLayerList object>>
control = <ai_diffusion.control.ControlLayer object>

 C:\Users\...\AppData\Roaming\krita\pykrita\ai_diffusion\control.py in remove(self=<ai_diffusion.control.ControlLayerList object>, control=<ai_diffusion.control.ControlLayer object>)
  175 
  176     def remove(self, control: ControlLayer):
  177         self._layers.remove(control)
  178         self.removed.emit(control)
  179 
self = <ai_diffusion.control.ControlLayerList object>
self._layers = [<ai_diffusion.control.ControlLayer object>]
self._layers.remove = <built-in method remove of list object>
control = <ai_diffusion.control.ControlLayer object>
ValueError: list.remove(x): x not in list
    __cause__ = None
    __class__ = <class 'ValueError'>
    __context__ = None
    __delattr__ = <method-wrapper '__delattr__' of ValueError object>
    __dict__ = {}
    __dir__ = <built-in method __dir__ of ValueError object>
    __doc__ = 'Inappropriate argument value (of correct type).'
    __eq__ = <method-wrapper '__eq__' of ValueError object>
    __format__ = <built-in method __format__ of ValueError object>
    __ge__ = <method-wrapper '__ge__' of ValueError object>
    __getattribute__ = <method-wrapper '__getattribute__' of ValueError object>
    __gt__ = <method-wrapper '__gt__' of ValueError object>
    __hash__ = <method-wrapper '__hash__' of ValueError object>
    __init__ = <method-wrapper '__init__' of ValueError object>
    __init_subclass__ = <built-in method __init_subclass__ of type object>
    __le__ = <method-wrapper '__le__' of ValueError object>
    __lt__ = <method-wrapper '__lt__' of ValueError object>
    __ne__ = <method-wrapper '__ne__' of ValueError object>
    __new__ = <built-in method __new__ of type object>
    __reduce__ = <built-in method __reduce__ of ValueError object>
    __reduce_ex__ = <built-in method __reduce_ex__ of ValueError object>
    __repr__ = <method-wrapper '__repr__' of ValueError object>
    __setattr__ = <method-wrapper '__setattr__' of ValueError object>
    __setstate__ = <built-in method __setstate__ of ValueError object>
    __sizeof__ = <built-in method __sizeof__ of ValueError object>
    __str__ = <method-wrapper '__str__' of ValueError object>
    __subclasshook__ = <built-in method __subclasshook__ of type object>
    __suppress_context__ = False
    __traceback__ = <traceback object>
    args = ('list.remove(x): x not in list',)
    with_traceback = <built-in method with_traceback of ValueError object>

The above is a description of an error in a Python program.  Here is
the original traceback:

Traceback (most recent call last):
  File "C:\Users\...\AppData\Roaming\krita\pykrita\ai_diffusion\control.py", line 168, in <lambda>
    layer.removed.connect(lambda: self.remove(control))
  File "C:\Users\...\AppData\Roaming\krita\pykrita\ai_diffusion\control.py", line 177, in remove
    self._layers.remove(control)
ValueError: list.remove(x): x not in list

Sadly I can't reproduce it.

Maybe it's worth considering to remove the automatic deletion of ControlNet and region definitions, and instead leave them without a referenced layer (so they sit there doing nothing until you either assign them to a new layer or delete them manually). Losing regions is especially annoying since you need to retype the prompt.

@Acly
Copy link
Owner

Acly commented Jun 18, 2024

Regions aren't removed like control layers, they can be in "unlinked" state (can also be linked to multiple layers). Due to the way hierarchies work you might have to select the bottom/root region to see them, then you can relink them with layers.

Merging/removing a layer that is used as control layer is expected to remove it. It's currently buggy though, leading to issues described here. Having unssigned control layers is an option, but comes with bunch of headaches (and probably further bugs...).

@arcusmaximus
Copy link

arcusmaximus commented Jun 18, 2024

Hmm you're right, regions do stay when deleting a layer. Not sure why they were suddenly all gone earlier on then...

Due to the way hierarchies work you might have to select the bottom/root region to see them

So the region list is aware of Krita group layers and only displays a subset of the regions depending on the selected layer? That could explain it, although it's not immediately obvious it works that way if that's the case.

Anyway, I don't want to derail this ticket - I'll create a separate one if needed.

@Acly
Copy link
Owner

Acly commented Jun 23, 2024

Fixed in v1.19.0

@Acly Acly closed this as completed Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants