# Gimp.Procedure.new

    function new(plug_in: Gimp.PlugIn, name: String, proc_type: Gimp.PDBProcType, run_func: Gimp.RunFunc): Gimp.Procedure {
        // Gjs wrapper for gimp_procedure_new()
    }

Creates a new procedure named name which will call run_func when invoked.

The name parameter is mandatory and should be unique, or it will overwrite an already existing procedure (overwrite procedures only if you know what you're doing).

proc_type should be [enum@Gimp.PDBProcType.PLUGIN] for "normal" plug-ins.

Using [enum@Gimp.PDBProcType.PERSISTENT] means that the plug-in will add temporary procedures. Therefore, the GIMP core will wait until the Gimp.PDBProcType.persistent procedure has called [method@Procedure.persistent_ready], which means that the procedure has done its initialization, installed its temporary procedures and is ready to run.

*Not calling [method@Procedure.persistent_ready] from a Gimp.PDBProcType.persistent procedure will cause the GIMP core to lock up.*

Additionally, a Gimp.PDBProcType.persistent procedure with no arguments added is an "automatic" extension that will be automatically started on each GIMP startup.

[enum@Gimp.PDBProcType.TEMPORARY] must be used for temporary procedures that are created during a plug-ins lifetime. They must be added to the Gimp.PlugIn using [method@PlugIn.add_temp_procedure].

run_func is called via [method@Procedure.run].

For Gimp.PDBProcType.plugin and Gimp.PDBProcType.persistent procedures the call of run_func is basically the lifetime of the plug-in.

Since 3.0

plug_in

  a Gimp.PlugIn.

name

  the new procedure's name.

proc_type

  the new procedure's Gimp.PDBProcType.

run_func

  the run function for the new procedure.

Returns

  a new Gimp.Procedure.