[Gimp-developer] Bucket-fill the selection in a python plugin

2010-09-06 Thread Ofnuts
  Hello from the noob...

I'm working on my first Gimp plugin in python, and most things work, but 
I can't seem to make a bucket-fill into the selection.

My code currently does:

 
res=pdb.gimp_edit_bucket_fill_full(drawable,FG_BUCKET_FILL,NORMAL_MODE,0,0,True,False,SELECT_CRITERION_COMPOSITE,0,0)

... but this returns None, so I suspect something is not correct in 
the call. As far as I can tell:

-  drawable is indeed an existing layer of the image.
-  there is a selection.

I have tried various other values to no avail. I've also tried the 
python-fu console, after creating a selection by hand on a plain new image:

  print gimp.image_list()[0]
gimp.Image 'Untitled'
  img=gimp.image_list()[0]
  layer=img.active_layer
  print layer
gimp.Layer 'Background'
  print 
pdb.gimp_edit_bucket_fill_full(layer,FG_BUCKET_FILL,NORMAL_MODE,0,0,True,False,SELECT_CRITERION_COMPOSITE,0,0)
None
  print 
pdb.gimp_edit_bucket_fill_full(layer,FG_BUCKET_FILL,NORMAL_MODE,0,0,True,False,SELECT_CRITERION_V,0,0)
None
 


Running Gimp Windows 2.6.10

Any ideas? That must be something fairly obvious for anyone else...

Ofnuts


PS: flattery kind=outrightI take the opportunity to thank all the 
contributors to that fine piece of software./flattery

___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Bucket-fill the selection in a python plugin

2010-09-06 Thread Sven Neumann
On Mon, 2010-09-06 at 20:59 +0200, Ofnuts wrote:

 I'm working on my first Gimp plugin in python, and most things work, but 
 I can't seem to make a bucket-fill into the selection.
 
 My code currently does:
 
  
 res=pdb.gimp_edit_bucket_fill_full(drawable,FG_BUCKET_FILL,NORMAL_MODE,0,0,True,False,SELECT_CRITERION_COMPOSITE,0,0)

You are using opacity=0. The fill does of course not have any effect
then.

Are you certain that you actually want to bucket-fill at all? Since you
are using a selection, it seems likely that you actually want to fill
that selection. Then you can use layer.fill() instead.


Sven


___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer