Bug 506377 - PyKrita scripting: severe issues creating multiple selection masks reliably
Summary: PyKrita scripting: severe issues creating multiple selection masks reliably
Status: REPORTED
Alias: None
Product: krita
Classification: Applications
Component: Scripting (other bugs)
Version First Reported In: 5.2.9
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-06-30 08:44 UTC by Blonde Ron
Modified: 2025-06-30 08:44 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Blonde Ron 2025-06-30 08:44:35 UTC
Description:

Using PyKrita scripting (Krita 5.2.9), I've observed the following severe limitations:

1. Calling 'convert_to_selection_mask' always converts the original active base layer, regardless of attempts to set the active node explicitly (via `doc.setActiveNode()` or GUI actions like 'activateNextLayer').

2. Using global selection (`select_all` → setPixelData → 'add_new_selection_mask') allows creation of only one functioning selection mask. Creating subsequent masks overwrites or clears selection pixels from previously created masks, making multiple independent masks impossible.

3. Attempting to duplicate masks programmatically results in masks incorrectly turning into base image layers or disappearing entirely from the layer stack.

These issues explicitly prevent reliable scripted creation of multiple independent selection masks.

Expected Behavior:
- Allow explicit scripting-based activation of nodes so GUI actions affect intended layers.
- Allow global selection-based creation of multiple independent selection masks without overwriting previous selections.
- Provide clear and stable API methods to programmatically create and manage selection masks independently.

Actual Behavior:
- GUI actions ignore scripting-based active node changes.
- Global selection state is transient, preventing stable multi-mask creation.
- Duplicating masks causes unintended layer-type conversions and deletions.

Reproduction steps and detailed test results available upon request.