https://bugs.kde.org/show_bug.cgi?id=497346

            Bug ID: 497346
           Summary: recursively creating duplicate frames in groups causes
                    crash.
    Classification: Applications
           Product: krita
           Version: 5.2.6
          Platform: Appimage
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: Scripting
          Assignee: krita-bugs-n...@kde.org
          Reporter: stingpi...@gmail.com
  Target Milestone: ---

Created attachment 176540
  --> https://bugs.kde.org/attachment.cgi?id=176540&action=edit
This is the script

SUMMARY
Using a custom script to create duplicate frames for all paint layers in a
complicated group layer causes krita to crash. Krita spits out 'ASSERT (krita):
"row >= 0" in file
/builds/graphics/krita/plugins/dockers/animation/KisAnimCurvesChannelsModel.cpp,
line 181' in the terminal, and then quits. 

This is the script I am using, and running through the script editor:
from PyQt5.QtWidgets import QDialog, QHBoxLayout, QPushButton, QLineEdit,
QLabel

global isTextDifferent
isTextDifferent=True


application = Krita.instance()
currentDoc = application.activeDocument()




def groupDuplicate():
    global isTextDifferent
    global currentDoc
    global application
    if(isTextDifferent):

        layers = currentDoc.nodeByName(text.text())

        if(text.text()==""):
            layers = currentDoc.activeNode()


        if(layers == None):
            print('layer does not exist!')
            return
        elif(str(type(layers)) != "<class 'PyKrita.krita.GroupLayer'>"):
            print('Not a group layer!')
            return
        GroupDuplicateLayer(layers.childNodes())
        isTextDifferent = False
    return

def GroupDuplicateLayer(layers):
    for layer in layers:
        print(layer)
        if(str(type(layer)) == "<class 'PyKrita.krita.Node'>"):
            layer.enableAnimation()
            global currentDoc
            currentDoc.setActiveNode(layer)
            Krita.instance().action('add_duplicate_frame').trigger()
        else:
            GroupDuplicateLayer(layer.childNodes())



def textChanged(x):
    global isTextDifferent
    isTextDifferent = True

# add button and layout for button
layout = QHBoxLayout()
newButton = QPushButton("Enter") 
text = QLineEdit()
label = QLabel("Update which group layer?")

layout.addWidget(label)
layout.addWidget(text)
layout.addWidget(newButton)

newButton.clicked.connect(groupDuplicate)
text.returnPressed.connect(groupDuplicate)
text.textEdited.connect(textChanged)

# create dialog  and show it
newDialog = QDialog() 
newDialog.setLayout(layout)
newDialog.setWindowTitle("New Dialog Title!") 
newDialog.exec_() # show the dialog



STEPS TO REPRODUCE
1. create a new image
2.  add several recursive group layers with paint layers inside them
3.  run the script above.

OBSERVED RESULT
It crashes.

EXPECTED RESULT
all the child paint layers to have a duplicate frame at the current frame
number.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
I am using the appimage on Arch.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to