GT Portal . Forums . Official Tutorials . Art Galleries . FAQs . Search . New Posts . Contact Us Login  .  Register


Board index » GIMP Art Galleries and Resources » GIMP Plugins, Filters, and Scripts Make Money Online . Free Image Hosting
Featured Tutorial : Learn how to create characters by Griatch
Search for :  


Post new topic Reply to topic   [ 4 posts ]  


Author Message
 Post subject:
PostPosted: Mon Apr 28, 2008 10:41 pm 
Offline
User avatar

Joined:
Mon Apr 28, 2008 10:29 pm

Topics: 1
Posts: 2

Find User's Topics

I've been banging my head on this one for awhile and I can't get past "TypeError: wrong parameter type". I've set all the values to integers since I figured it could automagically convert them to floats if it needed to. I realize I shouldn't have tangled with a function that has 40+ arguments, but it's what I need. I got a colortoalpha plugin to work, but I've removed it for clarity.

I'm new to python so I suspect I'm indenting wrong or some such thing. Please set me straight.

Here's my code:

#!/usr/bin/env python

import math
from gimpfu import *

def create_spherical_animation(img, drw):
img.disable_undo()
layer_ovoid = drw.copy(True)
layer_ovoid.mode = NORMAL_MODE
layer_ovoid.name = "Ovoid"
img.add_layer(layer_ovoid, -1)
pdb.plug_in_map_object(img, layer_ovoid, 1,
#viewpoint x, y, z
1, 1, 2,
#position x, y, z
1, 1, 1,
#first-axis x, y, z
1, 0, 0,
#second-axis x, y, z
0, 1, 0,
#rotation-angle x, y, z
0, 0, 5,
#light type = directional
1,
#light color (r,g,b)
(255,255,255),
#light position
-5,-5,2,
#light direction
-1,-1,1,
#intensity levels
1,1,
#reflectivity
1,0,27,
#general options
1,0,0,1,
#sphere radius
1,
#scale
0,0,0,
#cylinder
0,
-1,-1,-1,-1,-1,-1,-1,-1)
img.enable_undo()
gimp.displays_flush


register(
"create_spherical_animation",
"Create a series of frames from a rotating sphere",
"HOW TO",
"Author",
"cc sa by",
"2008",
"<Image>/Filters/Animation/S_pherical",
"RGB*, GRAY*",
[],
[],
create_spherical_animation)

main()




Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 29, 2008 6:13 am 
Offline

Joined:
Sat Feb 16, 2008 7:08 am

Topics: 0
Posts: 47

Find User's Topics
Hi Bob,
Your mistake is not an indentation problem; almost every indentation problem causes a SyntaxError or IndentationError.
The TypeError comes from the drawables; you have given -1 for the drawables, however they need to be a drawable -1, not an integer -1.
if you do
na = gimp._id2drawable(-1)
and then replace the -1's with na, does that help?

Lastly, you are not calling gimp.displays_flush.
Instead, you are getting its value (and then discarding it). This is because you omitted the ()



Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 29, 2008 6:33 am 
Offline
User avatar

Joined:
Mon Apr 28, 2008 10:29 pm

Topics: 1
Posts: 2

Find User's Topics
I'm not sure how to repay your quick response. You nailed it. The -1 not being a drawable was it. I had no clue about the need to make the -1 a drawable even though it clearly shows that in the procedure browser.

If you want my avatar you only need ask.



Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 30, 2008 2:33 am 
Offline

Joined:
Sat Feb 16, 2008 7:08 am

Topics: 0
Posts: 47

Find User's Topics
My pleasure, really.
(I'm the same guy who talked to you elsewhere, recommending the spacing out across lines + commenting)
I had some trouble with -1 drawables myself, before, so it's good to know for me too.



Top
 Profile  
 
Display posts from previous:  Sort by  

Post new topic Reply to topic
 [ 4 posts ] 



Who is online

Users browsing this forum: lylejk and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Related Website
Gimp tutorials database
All rights reserved © GimpTalk 2008
forum software by
phpBB