[Tutor] Return error message for my script in Blender

bob gailer bgailer at gmail.com
Sun Jul 18 02:01:00 CEST 2010


On 7/17/2010 5:11 PM, Andrew Martin wrote:
> I am new to Blender and Python (2.6 on vista) and was trying to follow 
> a tutorial in the book Blender 2.49 Scripting by Michel Anders. I was 
> trying to write a script that would create a user interface where the 
> user could select various aspect of an insect and the code would 
> create a polygonal bug. However, when I copied code exactly from the 
> book, I got an error saying "'return' outside function". Here is the 
> code I had in the text editor:
>
>
> #!BPY
>
> import Blender
> import mymesh2
>
> Draw = Blender.Draw
> THORAXSEGMENTS = Draw.Create(3)
> TAILSEGMENTS = Draw.Create(5)
> LEGSEGMENTS = Draw.Create(2)
> WINGSEGMENTS = Draw.Create(2)
> EYESIZE = Draw.Create(1.0)
> TAILTAPER = Draw.Create(0.9)
>
> if not Draw.PupBlock('Add CreepyCrawly', [\
> ('Thorax segments:'  , THORAXSEGMENTS, 2,  50,
>     'Number of thorax segments'),
> ('Tail segments:' , TAILSEGMENTS, 0,  50, 'Number of tail segments'),
> ('Leg segments:' , LEGSEGMENTS, 2,  10,
>     'Number of thorax segments with legs'),
> ('Wing segments:' , WINGSEGMENTS, 0,  10,
>     'Number of thorax segments with wings'),
> ('Eye size:' , EYESIZE, 0.1,10, 'Size of the eyes'),
> ('Tail taper:' , TAILTAPER, 0.1,10,
>     'Taper fraction of each tail segment'),]):
>      return
>
>
> Anybody know why I keep getting this error?

The return statement is not in a function. What else can we say. Either 
you copied incorrectly or there is a problem with the book.

Do you understand?

-- 
Bob Gailer
919-636-4239
Chapel Hill NC



More information about the Tutor mailing list