Bug 457553 - Duplicating layers with layer styles, and changing style on new layer results in wrong serialization and both layer have same layer styles after load.
Summary: Duplicating layers with layer styles, and changing style on new layer results...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: layer styles (show other bugs)
Version: 5.0.6
Platform: Microsoft Windows Microsoft Windows
: NOR major
Target Milestone: ---
Assignee: Tiar
URL:
Keywords: triaged
: 451385 461870 464041 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-08-06 13:43 UTC by dnlike12
Modified: 2023-04-17 19:36 UTC (History)
6 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dnlike12 2022-08-06 13:43:01 UTC
SUMMARY
When working with game UI i had to use layer styles a lot and I was duplicating layers, after saving and loading those files I notice that its looking different. Layer which I duplicated with different layer styles shares one same layer style. It was really pain because I lost lot of my work and I simply could not saved it properly. 

STEPS TO REPRODUCE
1. Create layer with layer styles (E.g. vector layer with rectangle with black inner glow)
2. Duplicate that layer
3. On duplicated layer change layer styles (E.g. red inner glow and stroke)
4. Save file and close Krita
5. Open Krita and load previously saved file.

OBSERVED RESULT
Both layer have same layer styles, last created (E.g. red inner glow and stroke)

EXPECTED RESULT
Layers have their own layer styles (E.g first gave black inner glow and second have red inner glow and stroke)

SOFTWARE/OS VERSIONS
Windows: 11 Home 21H2

ADDITIONAL INFORMATION
I was looking through the code and saved files and find out that after duplicating layer both layers layer styles have same Uuid. Which stays the same even when one layer style setting are changed. Sadly I am not c++ programmer but a programmer after all and I think change in KisAslLayerStyleSerializer::collectAllLayerStyles would fix the issue. When collecting layer just check if layers with same uuid are exactly the same if not assign new uuid. 

WORKAROUND: 
If issue would take some time to be fixed and someone encounter same problem as me, I would recommend to always create new layers and never touch duplicate layer button.
Comment 1 Tiar 2022-08-10 11:31:26 UTC
Setting to "major" since it's dataloss.
Assigning to me since it's related to resource management.
Comment 2 wolthera 2023-01-12 12:29:12 UTC
*** Bug 464041 has been marked as a duplicate of this bug. ***
Comment 3 wolthera 2023-01-12 12:29:32 UTC
*** Bug 461870 has been marked as a duplicate of this bug. ***
Comment 4 Tiar 2023-04-17 19:35:05 UTC
*** Bug 451385 has been marked as a duplicate of this bug. ***
Comment 5 Tiar 2023-04-17 19:36:46 UTC
Fixed in 9c847ba5c8ec912bf3c4d318ed5c654a89400418.