It is currently Tue Jul 02, 2024 3:31 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: use in python of plug-in lighting
PostPosted: Fri Feb 02, 2024 5:34 am  (#1) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
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.

_________________
"Where am I ?"


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: use in python of plug-in lighting
PostPosted: Fri Feb 02, 2024 7:17 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
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)

_________________
"Where am I ?"


Top
 Post subject: Re: use in python of plug-in lighting
PostPosted: Fri Feb 02, 2024 7:22 am  (#3) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
I let this post open for a while in case someone else is interested.

_________________
"Where am I ?"


Top
 Post subject: Re: use in python of plug-in lighting
PostPosted: Fri Feb 02, 2024 9:29 am  (#4) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4001
Location: Canada
so did you get it work with None?

_________________
TinT


Top
 Post subject: Re: use in python of plug-in lighting
PostPosted: Fri Feb 02, 2024 11:00 am  (#5) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
Exactly.
That's the reason I had to let the initial help request open.
Someone can benefit...

_________________
"Where am I ?"


Top
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) GIMP Python-Fu Plug-in template

4

No new posts GIMP 2.10 doesn't install my python plug-ins

1

No new posts Plug-in crashes after OS upgrade: python version mismatch? maybe?

4

No new posts Convert GIMP plugin from Python 2 to Python 3

4

No new posts Attachment(s) Salvaging color and lighting

17



* Login  



Powered by phpBB3 © phpBB Group