After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 792520 - Image symmetries should be saved
Image symmetries should be saved
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: General
git master
Other All
: Normal blocker
: 2.10
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2018-01-14 22:51 UTC by Jehan
Modified: 2018-04-01 16:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Save/load symmetries using gimp_config_(de)serialize_string() (5.20 KB, patch)
2018-03-31 23:39 UTC, Jehan
none Details | Review

Description Jehan 2018-01-14 22:51:26 UTC
To fully make the feature from bug 648776 even better, symmetries should be saved in an image, so that you can continue working later without having to reset them.

Basically a symmetry is a painting helper (such as guides, etc.).

There was a first version as commit cafc616da5ffea79e0b3457ea0fcde8a0eaf66ed in the "symmetry" branch, but the data needs to be versionned.

Anyway I believe I will improve and push a finale version in a 2.10.x. There is no need to rush. The base feature is there and working fine as-is.
Comment 1 Michael Natterer 2018-03-26 18:38:35 UTC
It seemss we forgot to make this a blocker for 2.10.
Comment 2 Jehan 2018-03-31 23:39:29 UTC
Created attachment 370401 [details] [review]
Save/load symmetries using gimp_config_(de)serialize_string()

Mitch > I remember that, back from Wilber Week, the one comment you told me was that the symmetry saving should be versionned.

So I just reviewed my old patch back from 2016. Really it is simple and straightforward and simply uses gimp_config_serialize_to_string() on saving then gimp_config_deserialize_string() on loading.

So yes, that's not versionned. But really it is so simple and based on GimpConfig, using config properties, that really I feel like it would be a shame to change. Basically alternative would be to serialize/unserialize the symmetries using a custom format which would be versionned. But is it really necessary? I'm not sure.
Comment 3 Jehan 2018-03-31 23:44:47 UTC
So basically, can't I just push this?
It just works, is simple and based on shared GimpConfig code which makes it quite robust.
Comment 4 Michael Natterer 2018-04-01 09:40:34 UTC
Eek no I didn't mean not to use GimpConfig, that would be insane.

We haven't used versioning with GimpConfig yet so we'd have to come
up with something... perhaps an integer "version" property, and after
deserializing succeeds (if it doesn't, incompatibility is clear), check
if the property still has its default value; if not, discard the object?

I'm not quite sure if that's the best approach, as said, I've totally
forgotten the issue :)
Comment 5 Jehan 2018-04-01 16:01:53 UTC
(In reply to Michael Natterer from comment #4)
> Eek no I didn't mean not to use GimpConfig, that would be insane.
> 
> We haven't used versioning with GimpConfig yet so we'd have to come
> up with something... perhaps an integer "version" property, and after
> deserializing succeeds (if it doesn't, incompatibility is clear), check
> if the property still has its default value; if not, discard the object?
> 
> I'm not quite sure if that's the best approach, as said, I've totally
> forgotten the issue :)

Ok this version property seems like ok to me. Let's do like this.
All pushed! Finally (first commit is more than 2 years old)!

commit 65717041edc22ba8bec33d8b1c98ee65d69f57cf
Author: Jehan <jehan@girinstud.io>
Date:   Wed Jan 27 19:18:53 2016 +0100

    app: save image symmetries in the XCF file.
    
    Symmetries are saved in a parasite, which is backward compatible.

 app/xcf/xcf-load.c | 37 +++++++++++++++++++++++++++++++++++++
 app/xcf/xcf-save.c | 31 +++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+)

commit e0029d31b476da4e93760e4eac0a006d51f02a96 (HEAD -> master, origin/master, origin/HEAD)
Author: Jehan <jehan@girinstud.io>
Date:   Sun Apr 1 17:51:07 2018 +0200

    Bug 792520 - Image symmetries should be saved: version the properties.
    
    Care for future changes of symmetries, by adding a version property. For
    now, all symmetries are at version 0, and no real check is done. If any
    symmetry bumps its settings in the future, it will have to override also
    update_version() to change settings properly if necessary, according to
    any new behavior.

 app/core/gimpsymmetry.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 app/core/gimpsymmetry.h |  3 +++
 2 files changed, 67 insertions(+)