It is currently Mon Jul 01, 2024 4:03 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: "Wrong parameter type" using Map object (Solved)
PostPosted: Sat Sep 05, 2020 12:40 pm  (#1) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
Hi guys! I'm writing a plugin using Map object and is giving me this error. What i'm I missing?

Image


I'm using the procedure code sample by Graechan here: viewtopic.php?f=9&t=10856 post #3
pdb.plug_in_map_object(img, pumLayer,
                                   1,    # Type of mapping (0=plane,1=sphere,2=box,3=cylinder)
                       0.5, 0.5, 2.0,    # viewpoint
                       0.5, 0.5, 0.0,    # object pos
                       1.0, 0.0, 0.0,    # first axis
                       0.0, 1.0, 0.0,    # 2nd axis
                      0.0, 0.0, 15.0,    # axis rotation
                                0,    # Type of lightsource (0=point,1=directional,2=none)
                     (255, 255, 255),    # Lightsource color (r,g,b)
                        0.5, 0.5, 2,    # light position
                     -1.0, -1.0, 1.0,    # light direction
            0.8, 0.5, 0.4, 0.0, 27.0,    # material (amb, diff, refl, spec, high)
                           TRUE,    # antialias
                           FALSE,    # tile
                           FALSE,    # new image
                           TRUE,    # transparency
                           1.00,    # Sphere/cylinder radius (only used when maptype=1 or 3)
                     0.5, 0.5, 0.5,    # box size
                           1.00,    # unused parameter Cylinder length
                             -1,    # Box front face (set these to -1 if not used)
                             -1,    # Box back face
                             -1,    # Box top face                           
                              -1,    # Box bottom face
                             -1,    # Box left face
                              -1,    # Box right face
                             -1,    # Cylinder top face (unused parameter)
                             -1)    # Cylinder bottom face (unused parameter)

_________________
https://www.deviantart.com/pocholo17
Image


Last edited by Pocholo on Sun Sep 06, 2020 9:09 am, edited 1 time in total.

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: "Wrong parameter type" using Map object
PostPosted: Sat Sep 05, 2020 2:50 pm  (#2) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2260
Location: Poland
Hi Pocholo.

Right now, the only plugin I can remember that works fine with plug_in_map_object is "Planet_wire_frame_model.py" by TinTran:
https://gimplearn.net/viewtopic.php?f=3&t=535
pdb.plug_in_map_object(image, drawable,1,0.5,0.5,2.0,0.5,0.5,0.0,1.0,0.0,0.0,0.0,1.0,0.0,-1.5,70,45,2,(255,255,255),1.0,1.0,1.0,1.0,1.0,1.0,0.3,1,0.5,0,27,True,False,False,True,0.25,0.25,0.25,0.25,1.00,None,None,None,None,None,None,None,None)

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: "Wrong parameter type" using Map object
PostPosted: Sat Sep 05, 2020 9:24 pm  (#3) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
Thank you so much for your help, MararoQ. I will try that. :yes

_________________
https://www.deviantart.com/pocholo17
Image


Top
 Post subject: Re: "Wrong parameter type" using Map object
PostPosted: Sat Sep 05, 2020 9:48 pm  (#4) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
Pocholo Please post your pumpkin pattern or xcf file so I can run map object on it

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: "Wrong parameter type" using Map object
PostPosted: Sun Sep 06, 2020 12:48 am  (#5) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
Graechan wrote:
Pocholo Please post your pumpkin pattern or xcf file so I can run map object on it


Graechan, I got the Map object fixed and working with MareroQ sample from one of Tin Tran plugin "Planet_wire_frame_model.py".

The only difference a I see on the code is that some parameters were written in lowercase (True, False) and the last 8 parameters were written as None instead of -1.

pdb.plug_in_map_object(img, pumLayer,
                                       1,    # Type of mapping (0=plane,1=sphere,2=box,3=cylinder)
                           0.5, 0.5, 2.0,    # viewpoint
                           0.5, 0.5, 0.0,    # object pos
                           1.0, 0.0, 0.0,    # first axis
                           0.0, 1.0, 0.0,    # 2nd axis
                          0.0, 0.0, 20.0,    # axis rotation
                                       0,    # Type of lightsource (0=point,1=directional,2=none)
                         (255, 255, 255),    # Lightsource color (r,g,b)
                           0.5, 0.5, 2.0,    # light position
                         -1.0, -1.0, 1.0,    # light direction
             0.80, 0.50, 0.40, 0.0, 27.0,    # material (amb, diff, refl, spec, high)
                                    True,    # antialias
                                   False,    # tile
                                   False,    # new image
                                    True,    # transparency
                                    0.25,    # Sphere/cylinder radius (only used when maptype=1 or 3)
                           0.5, 0.5, 0.5,    # box size
                                    1.00,    # unused parameter Cylinder length
                                    None,    # Box front face (set these to -1 if not used)
                                    None,    # Box back face
                                    None,    # Box top face                           
                                    None,    # Box bottom face
                                    None,    # Box left face
                                    None,    # Box right face
                                    None,    # Cylinder top face (unused parameter)
                                    None)    # Cylinder bottom face (unused parameter)



This is the result using Map object and G'MIC:
Image

Thank you anyway, you guys are being great in my coding learning journey.

_________________
https://www.deviantart.com/pocholo17
Image


Top
 Post subject: Re: "Wrong parameter type" using Map object
PostPosted: Sun Sep 06, 2020 1:51 am  (#6) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
That was just reflecting the difference between Python and Scheme
by the way great looking Pumpkin

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: "Wrong parameter type" using Map object
PostPosted: Sun Sep 06, 2020 2:42 am  (#7) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4752
Pocholo wrote:
The only difference a I see on the code is that some parameters were written in lowercase (True, False) and the last 8 parameters were written as None instead of -1.


Because:

1) in Python, the two boolean values are True and False, with an initial cap.
2) In Script-fu, you don't deal with Gimp objects (image, layers, paths...), directly but with a "handle" which is a positive integer number (more or less a sequence number of creation), so "no object" is the special "-1" handle. In Python-fu, the Gimp objects are wrapped in a Python object, so "no object" is "None", which is the reserved value for "nothing" in Python (most other programming languages use "null" instead).

_________________
Image


Top
 Post subject: Re: "Wrong parameter type" using Map object
PostPosted: Sun Sep 06, 2020 7:52 am  (#8) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
@Graechan, Thank you for the amiability to help! What I'm trying to archive is creating a carved pumpkin. By the way, I'm using the pumpkin gradient created by our latest friend Oregonian: viewtopic.php?f=23&t=622&p=6131&hilit=pumpkin+gradient#p6131

@Thanks for the explanation Ofnuts, I couldn't said it better myself. :hehe

_________________
https://www.deviantart.com/pocholo17
Image


Top
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts wrong parameter type in pdb.plug_in_cubism

9

No new posts Python-fu gimp_drawable_levels(): "TypeError: wrong parameter type"

2

No new posts Script-fu skip run-mode parameter (solved)

6

No new posts Invalid parameter name dialog status error

4

No new posts What am I doing wrong? [Solved]

3



* Login  



Powered by phpBB3 © phpBB Group