plug-ins: Use selected layer for DDS export option

When we removed the drawables parameter for image exports,
we switched to using gimp_image_list_layers () to retrieve the
layers from the image parameter inside the function.
However, for DDS, this provided all layers rather than the selected
ones, so we always exported the top layer. This patch switches
to using gimp_image_get_selected_layers () to only retrieve the
subset of selected layers.
This commit is contained in:
Alx Sa 2025-03-30 01:38:18 +00:00
parent 031a80a981
commit f6b87826d6

View file

@ -386,7 +386,7 @@ dds_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GimpLayer **drawables;
GError *error = NULL;
gdouble gamma;
@ -396,7 +396,7 @@ dds_export (GimpProcedure *procedure,
gimp_ui_init ("dds");
export = gimp_export_options_get_image (options, &image);
drawables = gimp_image_list_layers (image);
drawables = gimp_image_get_selected_layers (image);
g_object_get (config,
"gamma", &gamma,
@ -414,7 +414,7 @@ dds_export (GimpProcedure *procedure,
/* TODO: support multiple-layers selection, especially as DDS has
* DDS_SAVE_SELECTED_LAYER option support.
*/
status = write_dds (file, image, drawables->data,
status = write_dds (file, image, GIMP_DRAWABLE (drawables[0]),
run_mode == GIMP_RUN_INTERACTIVE,
procedure, config,
export == GIMP_EXPORT_EXPORT);
@ -422,6 +422,6 @@ dds_export (GimpProcedure *procedure,
if (export == GIMP_EXPORT_EXPORT)
gimp_image_delete (image);
g_list_free (drawables);
g_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}