Switch to full style
Ask all general Gimp related questions here
Post a reply

use in python of plug-in lighting

Fri Feb 02, 2024 5:34 am

GIMP Version: 2.10.36
Operating System: Windows
GIMP Experience: Intermediate User

List any relevant plug-ins or scripts:
plug_in_ligthing

List any ERROR messages you received:
wrong parameter type



I wanted to try using the Gimp plug-in Lighting in a python filter.
I wrote this simple filter:
Code:
#!/usr/bin/env python

from gimpfu import *

def test_lighting(inImage, inDrawable, doIt) :
       
    newDrawable=inDrawable.copy()
    inImage.add_layer (newDrawable, 0)
    pdb.plug_in_lighting (
    inImage,      #  Input image,
    newDrawable,  #  Input drawable,
    inDrawable,   #  Bumpmap drawable (set to 0 if disabled),
    0,            #  Environmentmap drawable (set to 0 if disabled),
    True,         #  Enable bumpmapping (TRUE/FALSE),
    False,        #  Enable Environmentmapping (TRUE/FALSE),
    0,            #  Type of mapping (0=linear,1=log, 2=sinusoidal, 3=spherical),
    0,            #  Type of lightsource (0=point,1=directional,3=spot,4=none),
    (255,255,255),#  Lightsource color (R,G,B),
    -1.0,-1.0,1.0,#  Lightsource position (x), (y), (z),
    -1.0,-1.0,1.0,#  Lightsource direction (x), (y), (z),
    0.2,          #  Material ambient intensity (0..1),
    0.5,          #  Material diffuse intensity (0..1),
    0.5,          #  Material diffuse reflectivity (0..1),
    0.0,          #  Material specular reflectivity (0..1),
    0.0,          #  Material highlight (0..>), (note: it's exponential)
    True,         #  Apply antialiasing (TRUE/FALSE),
    False,        #  Create a new image (TRUE/FALSE),
    False         #  Make BG transparent (TRUE/FALSE),
    )
   
   
    return

register(
        "test_lighting",
        "test_lighting",
        "test_lighting",
        "DN",
        "DN",
        "2024",
        "test_lighting...",
        "RGB*",
        [
                (PF_IMAGE, "image", "Input image", None),
                (PF_DRAWABLE, "drawable", "Input drawable", None),
                (PF_TOGGLE, "test", "do test?", True),
        ],
        [],
        test_lighting,
        menu="<Image>/Diego/Test"
        )

main()

The error message says: wrong parameter type.
Which one?
Did someone have experience on using this plug-in in a python filter?
Thanks for any help.

Re: use in python of plug-in lighting

Fri Feb 02, 2024 7:17 am

pls ignore
found a solution in an old python

environment map should not be set to 0 but to None (comment in descr seems to be wrong)

Re: use in python of plug-in lighting

Fri Feb 02, 2024 7:22 am

I let this post open for a while in case someone else is interested.

Re: use in python of plug-in lighting

Fri Feb 02, 2024 9:29 am

so did you get it work with None?

Re: use in python of plug-in lighting

Fri Feb 02, 2024 11:00 am

Exactly.
That's the reason I had to let the initial help request open.
Someone can benefit...
Post a reply