Bug 442783 - Doesn't add a new resource type to the database if the database was created without it (seexpr)
Summary: Doesn't add a new resource type to the database if the database was created w...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Resource Management (show other bugs)
Version: git master (please specify the git hash!)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-21 17:17 UTC by Tiar
Modified: 2021-09-22 08:24 UTC (History)
0 users

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


Attachments
Screenshot of the database without the seexpr resource type entry (71.89 KB, image/png)
2021-09-21 17:17 UTC, Tiar
Details
Screenshot showing an empty seexpr resource chooser (59.90 KB, image/png)
2021-09-21 17:18 UTC, Tiar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tiar 2021-09-21 17:17:38 UTC
Created attachment 141774 [details]
Screenshot of the database without the seexpr resource type entry

SUMMARY
I compiled kseexpr and installed it into Krita, and Krita's seexpr works, but the resources don't show up. Text in the console:

"Adding to database failed, resource id after adding is  -1 ! (Probable reason: the resource has the same filename, storage, resource type as an existing resource). Resource is:  "Wolthera's_fractional_Brownian_Motion" "Wolthera's_fractional_Brownian_Motion.kse" "seexpr_scripts" "Krita_Artists_SeExpr_examples.bundle""

I believe the reason it cannot be added is because it cannot find an appropriate id for the seexpr resource type, and that's because the seexpr resource type is not available in the database at all.

STEPS TO REPRODUCE
1. Remove your resource folder.
2. Use Krita that doesn't have seexpr (which is an optional dependency). See that there is no text on the console (because it considers the seexpr resources just broken).
3. Use Krita with seexpr.

OBSERVED RESULT
No seexpr scripts in the seexpr dialog.
Warnings on the console about not being able to add seexpr scripts entries to the database.
Seexpr script written by the user works (and actually, it even by default uses the last script the user wrote or used, I think?).

EXPECTED RESULT
Seexpr scripts resources are available in the seexpr dialog.

NOTE
If we figure out how to handle it nicely, it should help us add further resource types in the future. All of the new resource types will be in the same situation, after all (already existing database without that type in the resource_types table).
The easy solution for this particular bug would be to just always add the seexpr entry even if Krita has no access to seexpr scripts, but maybe it could be handled better and handle an existing database without that entry already (and just add it).

SOFTWARE/OS VERSIONS
Krita

 Version: 5.1.0-prealpha (git 09aee17)
 Languages: en_US, en, en_US, en, en_US, en, pl_PL, pl, pl_PL, pl
 Hidpi: true

Qt

  Version (compiled): 5.11.1
  Version (loaded): 5.11.1
Comment 1 Tiar 2021-09-21 17:18:28 UTC
Created attachment 141775 [details]
Screenshot showing an empty seexpr resource chooser
Comment 2 Halla Rempt 2021-09-22 08:23:55 UTC
Git commit 6cfc02eb6fc7cb7454fa2e19e4ca8a0b3673cb92 by Halla Rempt.
Committed on 22/09/2021 at 08:23.
Pushed by rempt into branch 'master'.

Add resource types that have been added since creating the cache db

M  +7    -0    libs/resources/KisResourceLocator.cpp

https://invent.kde.org/graphics/krita/commit/6cfc02eb6fc7cb7454fa2e19e4ca8a0b3673cb92
Comment 3 Halla Rempt 2021-09-22 08:24:19 UTC
Git commit 3434f57091eea6fae1f766b0cc2041f27f8554f7 by Halla Rempt.
Committed on 22/09/2021 at 08:24.
Pushed by rempt into branch 'krita/5.0'.

Add resource types that have been added since creating the cache db
(cherry picked from commit 6cfc02eb6fc7cb7454fa2e19e4ca8a0b3673cb92)

M  +7    -0    libs/resources/KisResourceLocator.cpp

https://invent.kde.org/graphics/krita/commit/3434f57091eea6fae1f766b0cc2041f27f8554f7