SUMMARY Creating a new layer and selecting that new layer does not select it STEPS TO REPRODUCE 1. open Krita with a image 2. run the code provided OBSERVED RESULT the selected layer is still the previously selected layer EXPECTED RESULT created layer to be the active layer SOFTWARE/OS VERSIONS Windows: 10 Qt Version: 5.15.7 ADDITIONAL INFORMATION Code: """ # Imports import krita # Function def Wait( ad ): ad.waitForDone() ad.refreshProjection() # Read ki = Krita.instance() ad = ki.activeDocument() node = ad.activeNode() # Create New Layer new_node = ad.createNode( "New Layer", "paintLayer" ) ad.activeNode().parentNode().addChildNode( new_node, node ) Wait( ad ) # Select New Layer ad.setActiveNode( new_node ) Wait( ad ) # Output active_node = ad.activeNode().name() print( str(active_node) ) """
This sounds very similar to bug I planned to submit but turned out different thing. Tested it and can confirm in krita 5.2.3 and 5.2.1 on win. Can add some info tho - new layer actually get selected but after script is done but if there is some actions that should be done to new layer they will be done on previous node (merge layer for example).
Related bug: https://bugs.kde.org/show_bug.cgi?id=495811
Hm, I just tried this, and I cannot reproduce it. The new layer is selected here. I wonder what I'm missing?
Created attachment 175547 [details] screenshot that shows my new layer being selected right after run
🐛🧹 ⚠️ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME. For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging. Thank you for helping us make KDE software even better for everyone!
🐛🧹 This bug has been in NEEDSINFO status with no change for at least 30 days. Closing as RESOLVED WORKSFORME.