Fix loading of layer trees when there is a floating selection

A floating selection is always the first layer in the image, but on
XCF loading it is attached *after* all layers are loaded, so the item
paths for child layers read from the XCF are off-by-one in their
toplevel index. Adjust them so everything loads as it should.
This commit is contained in:
Michael Natterer 2009-08-31 15:15:30 +02:00
parent c6fa4f7206
commit cdbb8e1697
1 changed files with 16 additions and 0 deletions

View File

@ -210,6 +210,22 @@ xcf_load_image (Gimp *gimp,
if (item_path)
{
if (info->floating_sel)
{
/* there is a floating selection, but it will get
* added after all layers are loaded, so toplevel
* layer indices are off-by-one. Adjust item paths
* accordingly:
*/
gint toplevel_index;
toplevel_index = GPOINTER_TO_UINT (item_path->data);
toplevel_index--;
item_path->data = GUINT_TO_POINTER (toplevel_index);
}
parent = GIMP_LAYER
(gimp_item_stack_get_parent_by_path (GIMP_ITEM_STACK (layers),
item_path,