Acly / krita-ai-diffusion

Streamlined interface for generating images with AI in Krita. Inpaint and outpaint with optional text prompt, no tweaking required.
GNU General Public License v3.0
5.55k stars 245 forks source link

Error on undo: 'LayerManager' object has no attribute 'active' #862

Open arcusmaximus opened 1 week ago

arcusmaximus commented 1 week ago

This one happened when pressing Undo after accidentally flattening the entire image. No ControlNet or regions active. Sadly can't reproduce.

AttributeError
Python 3.10.7: D:\Krita\bin\krita.exe
Sun Jun 23 00:29:49 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\ui\generation.py in update_generate_button(self=<ai_diffusion.ui.generation.GenerationWidget object>)
  674             return
  675         has_regions = len(self.model.regions) > 0
  676         has_active_region = self.model.regions.is_linked(self.model.layers.active)
  677         is_region_only = has_regions and has_active_region and self.model.region_only
  678         self.region_mask_button.setVisible(has_regions)
has_active_region undefined
self = <ai_diffusion.ui.generation.GenerationWidget object>
self.model = <ai_diffusion.model.Model object>
self.model.regions = <ai_diffusion.region.RootRegion object>
self.model.regions.is_linked = <bound method RootRegion.is_linked of <ai_diffusion.region.RootRegion object>>
self.model.layers = <ai_diffusion.layer.LayerManager object>
self.model.layers.active undefined
AttributeError: 'LayerManager' object has no attribute 'active'
    __cause__ = None
    __class__ = <class 'AttributeError'>
    __context__ = None
    __delattr__ = <method-wrapper '__delattr__' of AttributeError object>
    __dict__ = {}
    __dir__ = <built-in method __dir__ of AttributeError object>
    __doc__ = 'Attribute not found.'
    __eq__ = <method-wrapper '__eq__' of AttributeError object>
    __format__ = <built-in method __format__ of AttributeError object>
    __ge__ = <method-wrapper '__ge__' of AttributeError object>
    __getattribute__ = <method-wrapper '__getattribute__' of AttributeError object>
    __gt__ = <method-wrapper '__gt__' of AttributeError object>
    __hash__ = <method-wrapper '__hash__' of AttributeError object>
    __init__ = <method-wrapper '__init__' of AttributeError object>
    __init_subclass__ = <built-in method __init_subclass__ of type object>
    __le__ = <method-wrapper '__le__' of AttributeError object>
    __lt__ = <method-wrapper '__lt__' of AttributeError object>
    __ne__ = <method-wrapper '__ne__' of AttributeError object>
    __new__ = <built-in method __new__ of type object>
    __reduce__ = <built-in method __reduce__ of AttributeError object>
    __reduce_ex__ = <built-in method __reduce_ex__ of AttributeError object>
    __repr__ = <method-wrapper '__repr__' of AttributeError object>
    __setattr__ = <method-wrapper '__setattr__' of AttributeError object>
    __setstate__ = <built-in method __setstate__ of AttributeError object>
    __sizeof__ = <built-in method __sizeof__ of AttributeError object>
    __str__ = <method-wrapper '__str__' of AttributeError object>
    __subclasshook__ = <built-in method __subclasshook__ of type object>
    __suppress_context__ = False
    __traceback__ = <traceback object>
    args = ("'LayerManager' object has no attribute 'active'",)
    name = 'active'
    obj = <ai_diffusion.layer.LayerManager object>
    with_traceback = <built-in method with_traceback of AttributeError 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\ui\generation.py", line 676, in update_generate_button
    has_active_region = self.model.regions.is_linked(self.model.layers.active)
AttributeError: 'LayerManager' object has no attribute 'active'