Re: [Gimp-developer] marking a document/image as dirty/changed in a plugin

2019-11-11 Thread Ofnuts

On 11/10/19 5:23 AM, Dan Hitt via gimp-developer-list wrote:

The other hole is that i find that so far i cannot read and write a
pixel.



From my experiments:

- start an "undo group": this marks the image "dirty"

- attach an "undoable" parasite

- end the undo group and exit

At that point if you list the parasites you find the one that was added

If you then Ctrl-Z and list the parasites the added  parasite is gone.



Actual Python code used in the Pyhon console:

>>> # Assumes you have only a single image loaded

>>> image=gimp.image_list()[0]

>>> # when you enter the line below, the title bar gets an '*'
indicating a dirty image

>>> image.undo_group_start()

>>> Check dirtiness with API

>>> image.dirty
True
>>> p=gimp.Parasite('foo',PARASITE_UNDOABLE,'bar')
>>> image.parasite_attach(p)
>>> image.undo_group_end()
>>> image.parasite_list()
('gimp-comment', 'jpeg-settings', 'foo')

>>> Now undo with Ctrl-Z in the image window, and retest the parasites:

>>> image.parasite_list()
('gimp-comment', 'jpeg-settings')

___
gimp-developer-list mailing list
List address:gimp-developer-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list


Re: [Gimp-developer] marking a document/image as dirty/changed in a plugin

2019-11-11 Thread Dan Hitt via gimp-developer-list
On Mon, Nov 11, 2019 at 1:40 AM Ofnuts  wrote:

> On 11/10/19 5:23 AM, Dan Hitt via gimp-developer-list wrote:
> > The other hole is that i find that so far i cannot read and write a
> > pixel.
>
>
>  From my experiments:
>
> - start an "undo group": this marks the image "dirty"
>
> - attach an "undoable" parasite
>
> - end the undo group and exit
>
> At that point if you list the parasites you find the one that was added
>
> If you then Ctrl-Z and list the parasites the added  parasite is gone.
>
>   <<< clipped >>>
>

Awesome, thank you so much Ofnuts!

It works in c as well, exactly as you describe, solving both the problem of
getting the document marked dirty, as well as providing a means for undoing
it.  This it fills in that first hole that i had.

dan
___
gimp-developer-list mailing list
List address:gimp-developer-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list