Bug 509343

Summary: [Python] View.selectedNodes() returns reversed list if selecting using R+LMB+Shift
Product: [Applications] krita Reporter: faulknermano
Component: ScriptingAssignee: Krita Bugs <krita-bugs-null>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version First Reported In: 5.2.11   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Bug report log generated by Krita.
Python script to print selected nodes in order.

Description faulknermano 2025-09-10 12:25:30 UTC
Created attachment 184863 [details]
Bug report log generated by Krita.

# SUMMARY
When selecting layers (nodes) using hotkey 'R' + LMB (and Shift), returned list of nodes are reversed than if they were selected via the layers panel.

## STEPS TO REPRODUCE (PART 1: Selecting layers via layer panel)
1. Load or create any number of layers and name them uniquely enough for you to identify them.
2. Select a few layers in the layer panel in some a random order, but keep track of what order you selected them.
3. Run the attached script which will print out the list of selected nodes.

## OBSERVED RESULT (PART 1)
You will see that the first selected items appear at the beginning of the list.

# STEPS TO REPRODUCE (PART 2: Selecting layers via viewport with R hotkey)
1. Hold down ‘R’ and then LMB click on any number of layers, keeping track of the order.
3. Run the script above again.

## OBSERVED RESULT (PART 2)
This time you will see that the items you first selected appear at the end of the list. Essentially, the list has been reversed.


# EXPECTED RESULT
Both ways of selecting layers in viewport via 'R'+LMB+SHIFT, and in the layer panel should yield the same order of nodes in the order they were selected.


# SOFTWARE/OS VERSIONS
Krita

 Version: 5.2.11 (git a4da714)
Comment 1 faulknermano 2025-09-10 12:27:15 UTC
Created attachment 184864 [details]
Python script to print selected nodes in order.

I forgot to include the script referred to in the ticket steps. I've attached it now.