ScriptFu: fix #11954 err call PDB file-export-foo type GimpExportOption

GimpExportOptions is incomplete.
It exists so the API is stable.
For now, ScriptFu eat and ignore actual args,
binding to NULL, in calls to PDB procedures
file-export-foo having formal args of this type.

Unlikely that in the future ScriptFu will do anything else:
if a plugin needs export options, use another language.
The few file exporters used by existing ScriptFu scripts
(file-gbr-export and file-pat-export)
don't honor export options.
This commit is contained in:
lloyd konneker 2024-08-28 08:13:11 -04:00
parent 0e245e86c1
commit cb1a46511a
5 changed files with 23 additions and 5 deletions

View File

@ -32,7 +32,8 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
#define GIMP_TYPE_EXPORT_OPTIONS (gimp_export_options_get_type ())
#define GIMP_TYPE_EXPORT_OPTIONS (gimp_export_options_get_type ())
#define GIMP_VALUE_HOLDS_EXPORT_OPTIONS(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_EXPORT_OPTIONS))
G_DECLARE_FINAL_TYPE (GimpExportOptions, gimp_export_options, GIMP, EXPORT_OPTIONS, GObject)

View File

@ -1388,6 +1388,20 @@ script_fu_marshal_procedure_call (scheme *sc,
g_value_set_object (&value, resource);
}
}
else if (GIMP_VALUE_HOLDS_EXPORT_OPTIONS (&value))
{
/* ExportOptions is work in progress.
* For now, you can't instantiate (no gimp_export_options_new())
* and a script must always pass the equivalent of NULL
* when calling PDB functions having formal arg type ExportOptions.
*
* TEMPORARY: eat the actual Scheme arg but bind to C NULL.
* FUTURE: (unlikely) ScriptFu plugins can use non-NULL export options.
* check Scheme type of actual arg, must be int ID
* create a GimpExportOptions (actually a proxy?)
*/
g_value_set_object (&value, NULL);
}
else
{
g_snprintf (error_str, sizeof (error_str),

View File

@ -49,7 +49,8 @@
(gimp-context-set-background '(0 0 0))
(gimp-drawable-edit-fill drawable FILL-BACKGROUND)
(file-gbr-export 1 img filename spacing name)
; -1: NULL export_options
(file-gbr-export 1 img filename -1 spacing name)
(gimp-image-delete img)
(gimp-context-pop)
@ -119,7 +120,7 @@
(gimp-context-set-background '(0 0 0))
(gimp-drawable-edit-fill drawable FILL-BACKGROUND)
(file-gbr-export 1 img filename spacing name)
(file-gbr-export 1 img filename -1 spacing name)
(gimp-image-delete img)
(gimp-context-pop)
@ -175,7 +176,7 @@
(gimp-drawable-edit-fill drawable FILL-BACKGROUND)
(file-gbr-export 1 img filename spacing name)
(file-gbr-export 1 img filename -1 spacing name)
(gimp-image-delete img)
(gimp-context-pop)
@ -244,7 +245,7 @@
(gimp-context-set-background '(0 0 0))
(gimp-drawable-edit-fill drawable FILL-BACKGROUND)
(file-gbr-export 1 img filename spacing name)
(file-gbr-export 1 img filename -1 spacing name)
(gimp-image-delete img)
(gimp-context-pop)

View File

@ -47,6 +47,7 @@
(file-gbr-export RUN-NONINTERACTIVE
brush-image
path
-1 ; NULL ExportOptions
spacing name)
(gimp-image-delete brush-image)

View File

@ -33,6 +33,7 @@
(file-pat-export RUN-NONINTERACTIVE
pattern-image
path
-1 ; NULL ExportOptions
name)
(gimp-image-delete pattern-image)