python-fu script
This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.
This is a read-only list on gimpusers.com so this discussion thread is read-only, too.
python-fu script | peter kostov | 10 May 16:00 |
python-fu script | Sven Neumann | 10 May 17:45 |
python-fu script | Joao S. O. Bueno | 10 May 23:57 |
python-fu script | David Gowers | 11 May 04:09 |
python-fu script | Sven Neumann | 11 May 11:22 |
python-fu script | Joao S. O. Bueno | 11 May 00:12 |
python-fu script
Hello,
I am trying to write a python script. The problematic part of it is:
--- snip ---
def run_resynthesize(image, drawable, vtileable=1, htileable=1): defalut_args = (0, 0, 0, 0, 0.50, 0.12, 30, 200) args = list(defalut_args)
pdb.plug_in_resynthesizer(image,drawable,vtileable,htileable,*args)
def create_tileable(location, file_type_search, create_nmap,
texture_name, normal_map_name, save_as_type, new_img_location):
images = get_images(file_type_search, location)
num_images = len(images)
for i in range(num_images):
image = pdb.gimp_file_load(images[i]['image_file'],
images[i]['image_file'])
#drawable = PF_DRAWABLE
drawable = pdb.gimp_image_get_active_drawable(image)
#print drawable
run_resynthesize(image,drawable,1,1)
--- snip ---
I am getting a window listig several errors like this:
Procedure 'gimp-drawable-width' has been called with an invalid ID for argument 'drawable'. Most likely a plug-in is trying to work on a layer that doesn't exist any longer.
And an 'RuntimeError: execution error' message on the console.
I have googled, but not managed to find any answer :(
How should I get the 'drawable' and what exactly should I feed to the resynthesize plug-in as 'DRAWABLE'?
Please, please help!
Kind regards,
Peter
python-fu script
Hi,
On Sat, 2008-05-10 at 17:00 +0300, peter kostov wrote:
Procedure 'gimp-drawable-width' has been called with an invalid ID for argument 'drawable'. Most likely a plug-in is trying to work on a layer that doesn't exist any longer.
And an 'RuntimeError: execution error' message on the console.
I have googled, but not managed to find any answer :(
How should I get the 'drawable' and what exactly should I feed to the resynthesize plug-in as 'DRAWABLE'?
The drawable you are passing looks just right. But doesn't the resynthesizer PDB procedure take run-mode as its first parameter?
Sven
python-fu script
On Sat 10 May 2008 12:45:09 pm Sven Neumann wrote:
Hi,
On Sat, 2008-05-10 at 17:00 +0300, peter kostov wrote:
Procedure 'gimp-drawable-width' has been called with an invalid ID for argument 'drawable'. Most likely a plug-in is trying to work on a layer that doesn't exist any longer.
And an 'RuntimeError: execution error' message on the console.
I have googled, but not managed to find any answer :(
How should I get the 'drawable' and what exactly should I feed to the resynthesize plug-in as 'DRAWABLE'?
The drawable you are passing looks just right. But doesn't the resynthesizer PDB procedure take run-mode as its first parameter?
When caling PDB stuff from a python plug-in, the run-mode parameter is always omited and assumed to be "non-interactive"
Sven
python-fu script
On Sat 10 May 2008 11:00:57 am peter kostov wrote:
Hello,
I am trying to write a python script. The problematic part of it is:
--- snip ---
def run_resynthesize(image, drawable, vtileable=1, htileable=1): defalut_args = (0, 0, 0, 0, 0.50, 0.12, 30, 200) args = list(defalut_args)
pdb.plug_in_resynthesizer(image,drawable,vtileable,htileable,*args)
def create_tileable(location, file_type_search, create_nmap, texture_name, normal_map_name, save_as_type, new_img_location): images = get_images(file_type_search, location) num_images = len(images)
for i in range(num_images):
image = pdb.gimp_file_load(images[i]['image_file'], images[i]['image_file'])#drawable = PF_DRAWABLE drawable = pdb.gimp_image_get_active_drawable(image) #print drawable
run_resynthesize(image,drawable,1,1)--- snip ---
I am getting a window listig several errors like this:
Procedure 'gimp-drawable-width' has been called with an invalid ID for argument 'drawable'. Most likely a plug-in is trying to work on a layer that doesn't exist any longer.
Hi. You should check the parameters passed to the resynthesizer plug-in I'd recomend testing it with one image from the python console, and check if the same error is raised
Once you have an image object, you can get it's top layer with image.layers[0] - no need to call pdb.gimp_image_get_active_drawable
To work, from the python console, on an image already open in gimp, just make a call to gimp.image_list() - it return a list of all open images as python objects.
js
->
And an 'RuntimeError: execution error' message on the console.
I have googled, but not managed to find any answer :(
How should I get the 'drawable' and what exactly should I feed to the resynthesize plug-in as 'DRAWABLE'?
Please, please help!
Kind regards,
Peter
python-fu script
On Sun, May 11, 2008 at 7:27 AM, Joao S. O. Bueno wrote:
The drawable you are passing looks just right. But doesn't the resynthesizer PDB procedure take run-mode as its first parameter?
When caling PDB stuff from a python plug-in, the run-mode parameter is always omited and assumed to be "non-interactive"
For the sake of completeness, I'll mention that you *can* use other run modes, by specifying the kwarg 'run_mode' like this
pdb.plug_in_gauss (i, i.layers[0], 4, 4, 1, run_mode = 0)
^^^ Brings up the normal interactive dialog.
python-fu script
Hi,
On Sat, 2008-05-10 at 18:57 -0300, Joao S. O. Bueno wrote:
When caling PDB stuff from a python plug-in, the run-mode parameter is always omited and assumed to be "non-interactive"
That is a very bad design decision. How are you supposed to call a PDB function interactively then?
Sven