Bug 445367

Summary: Adding a bundle with resource duplicated in disabled bundle disables the resource
Product: [Applications] krita Reporter: Dmitry Kazakov <dimula73>
Component: Resource ManagementAssignee: amyspark <amy>
Status: RESOLVED FIXED    
Severity: normal CC: amy, eoinoneill1991, tamtamy.tymona
Priority: NOR    
Version: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Bug Depends on:    
Bug Blocks: 446009, 446705    

Description Dmitry Kazakov 2021-11-12 07:37:57 UTC
SUMMARY

When the user adds a bundle with a resource that is present in some other bundle, this resource becomes disabled. It doesn't even matter if the existing bundle it disabled or not.

STEPS TO REPRODUCE

1. Export "y) Texture Reptile" preset into a separate bundle and name it "reptile.bundle"
2. Import "reptile.bundle" into Krita
3. Disable "Krita 4 Resources" bundle

OBSERVED RESULT

"y) Texture Reptile" preset is not available in any GUI, even though it is present in a non-disabled bundle

EXPECTED RESULT

"y) Texture Reptile" is available in the GUI as long as it is present in at least one non-disable bundle
Comment 1 Dmitry Kazakov 2021-11-12 07:41:32 UTC
The user can neither import this resource manually using "Import Resource". The resource will be disabled.
Comment 2 Dmitry Kazakov 2021-11-12 11:58:53 UTC
Just a side note, when a duplicated resource is added via model.importResource(), this deactivation doesn't happen. Therefore this bug doesn't affect the embedded resources.
Comment 3 Eoin O'Neill 2021-11-17 03:45:26 UTC
Hmm, I can't seem to reproduce this in master. Has this been fixed?
Comment 4 Tiar 2021-11-17 04:21:40 UTC
Related (possibly talking about issues related to automatic deactivation in case of equal md5):

bug 443876 (reported)
bug 439703 (marked as intentional)
bug 445408 (marked as fixed, because after the fix it was possible to find and put deactivated brush tips into the bundle)
bug 441347 (marked as fixed, because after the fix the presets started working with deactivated brush tips, I think)
Comment 5 Dmitry Kazakov 2021-11-25 12:50:59 UTC
This masking brush issue is related to this bug: https://bugs.kde.org/show_bug.cgi?id=446009
Comment 6 Bug Janitor Service 2021-11-25 13:40:01 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1175
Comment 7 Dmitry Kazakov 2021-11-25 14:32:36 UTC
Git commit aeed954b09cbdb68a6844d2d7b47626f8009c9e4 by Dmitry Kazakov.
Committed on 25/11/2021 at 14:31.
Pushed by dkazakov into branch 'krita/5.0'.

Fix deduplication of resources on import

On importing resource we shouldn't just disable the copies. All the
copies should be available in the database as active, until the user
explicitly disables them. Though we should de-duplicate them
based on their name-filename-md5 signature when listing them in the
model. That can be easily done by simple adding "group by" to the
query.

Such solution both fixes legacy presets (bug 446009), and makes
importing resources less embarrassing (bug 445367).
Related: bug 446009

M  +1    -28   libs/resources/KisResourceCacheDb.cpp
M  +3    -0    libs/resources/KisResourceModel.cpp

https://invent.kde.org/graphics/krita/commit/aeed954b09cbdb68a6844d2d7b47626f8009c9e4
Comment 8 Dmitry Kazakov 2021-11-25 14:33:00 UTC
Git commit 0b260f71b614e700d6ae9108e31509f81b66fbf2 by Dmitry Kazakov.
Committed on 25/11/2021 at 14:32.
Pushed by dkazakov into branch 'master'.

Fix deduplication of resources on import

On importing resource we shouldn't just disable the copies. All the
copies should be available in the database as active, until the user
explicitly disables them. Though we should de-duplicate them
based on their name-filename-md5 signature when listing them in the
model. That can be easily done by simple adding "group by" to the
query.

Such solution both fixes legacy presets (bug 446009), and makes
importing resources less embarrassing (bug 445367).
Related: bug 446009
(cherry picked from commit aeed954b09cbdb68a6844d2d7b47626f8009c9e4)

M  +1    -28   libs/resources/KisResourceCacheDb.cpp
M  +3    -0    libs/resources/KisResourceModel.cpp

https://invent.kde.org/graphics/krita/commit/0b260f71b614e700d6ae9108e31509f81b66fbf2