GIMP Chat
http://gimpchat.com/

use in python of plug-in lighting
http://gimpchat.com/viewtopic.php?f=8&t=20741
Page 1 of 1

Author:  dinasset [ Fri Feb 02, 2024 5:34 am ]
Post subject:  use in python of plug-in lighting

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:
#!/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.

Author:  dinasset [ Fri Feb 02, 2024 7:17 am ]
Post subject:  Re: use in python of plug-in lighting

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)

Author:  dinasset [ Fri Feb 02, 2024 7:22 am ]
Post subject:  Re: use in python of plug-in lighting

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

Author:  trandoductin [ Fri Feb 02, 2024 9:29 am ]
Post subject:  Re: use in python of plug-in lighting

so did you get it work with None?

Author:  dinasset [ Fri Feb 02, 2024 11:00 am ]
Post subject:  Re: use in python of plug-in lighting

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

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/