Bug 446725 - Overwritten gradient resource doesn't update until selected again
Summary: Overwritten gradient resource doesn't update until selected again
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Resource Management (show other bugs)
Version: 5.0.0-beta5
Platform: Other Linux
: NOR minor
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-09 11:22 UTC by sh_zam
Modified: 2021-12-13 16:28 UTC (History)
1 user (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 sh_zam 2021-12-09 11:22:20 UTC
STEPS TO REPRODUCE
1.  Import a gradient resource
2.  Select it
3.  Import a different gradient resource with same name, and click "Yes" for the Overwrite dialog
4.  The overwritten gradient does not get updated until selected again in the gradient chooser.

Version: Krita-5.0.0-beta5 (git e18c9f0)
Comment 1 Dmitry Kazakov 2021-12-10 14:11:06 UTC
Well, there is an easy solution to just activate the preset on every import... And more complicate solution to activate a preset only when it has been overridden :)
Comment 2 Dmitry Kazakov 2021-12-13 07:54:59 UTC
The main problem here is that KisResourceLocator doesn't notify the model when it **deletes** the resource being notified. I'm trying to implement it now.
Comment 3 Dmitry Kazakov 2021-12-13 11:45:32 UTC
This bug will be fixed as part of this MR: https://invent.kde.org/graphics/krita/-/merge_requests/1216
Comment 4 Halla Rempt 2021-12-13 16:20:52 UTC
Git commit b00b00637a423dd7ad3b945ddb1db2f009153982 by Halla Rempt, on behalf of Dmitry Kazakov.
Committed on 13/12/2021 at 15:51.
Pushed by dkazakov into branch 'master'.

Fix updates of the model when the resource is overridden during import

Now KisResourceLocator emits all the signals that are needed to override
the resource. Theoretically, we could emit item-moved signal instead of
remove+add pair. It would probably handle selection better. Though I'm
not sure if it will actually work, because the newly added resource **is**
different from the first one. So, technically, we would need to emit
move+change pair. I don't want to try that right now :)

M  +10   -2    libs/resources/KisResourceLocator.cpp
M  +6    -0    libs/resources/KisResourceLocator.h
M  +28   -35   libs/resources/KisResourceModel.cpp
M  +12   -0    libs/resources/KisResourceModel.h
M  +16   -1    libs/resourcewidgets/KisResourceItemChooser.cpp

https://invent.kde.org/graphics/krita/commit/b00b00637a423dd7ad3b945ddb1db2f009153982
Comment 5 Dmitry Kazakov 2021-12-13 16:28:46 UTC
Git commit 732efefbf5429af120f20a3328723ec1330e299a by Dmitry Kazakov.
Committed on 13/12/2021 at 16:21.
Pushed by dkazakov into branch 'krita/5.0'.

Fix updates of the model when the resource is overridden during import

Now KisResourceLocator emits all the signals that are needed to override
the resource. Theoretically, we could emit item-moved signal instead of
remove+add pair. It would probably handle selection better. Though I'm
not sure if it will actually work, because the newly added resource **is**
different from the first one. So, technically, we would need to emit
move+change pair. I don't want to try that right now :)

M  +10   -2    libs/resources/KisResourceLocator.cpp
M  +6    -0    libs/resources/KisResourceLocator.h
M  +28   -35   libs/resources/KisResourceModel.cpp
M  +12   -0    libs/resources/KisResourceModel.h
M  +16   -1    libs/resourcewidgets/KisResourceItemChooser.cpp

https://invent.kde.org/graphics/krita/commit/732efefbf5429af120f20a3328723ec1330e299a