2015-01-03 2 views
0

У меня есть эта функция def enumerategrid(image, width, height, tcolor, theight, font, startfrom)Gimp - текущее изображение не передается в качестве параметра для моего плагина функции

и он register изд:

gimpfu.register(
    proc_name="enumerategrid_plugin-pdb", 
    blurb="Enumera rejillas en una imagen", 
    help="Enumera rejillas en una imagen", 
    author="Jorge Araya Navarro <[email protected]>", 
    copyright="Servants of the Secret Fire Game Studios", 
    date="2015", 
    label="Enumerar rejilla...", 
    imagetypes="*", 
    params=[ 
     (gimpfu.PF_INT32, "width", "ancho de la reja", 32), 
     (gimpfu.PF_INT32, "height", "altura de la reja", 32), 
     (gimpfu.PF_COLOR, "tcolor", "Color del texto", (1.0, 1.0, 1.0)), 
     (gimpfu.PF_SPINNER, "theight", "Tamaño del texto", 8, (1, 50, 1)), 
     (gimpfu.PF_FONT, "font", "Tipografía", "Monospace"), 
     (gimpfu.PF_SPINNER, "startfrom", "Contar desde", 0, (0, 3000, 1)) 
    ], 
    results=[], 
    function=enumerategrid, 
    menu="<Image>/Desarrollo de juegos/rejillas" 
) 

Однако, когда я хочу, чтобы запустить новый установлен плагин, я получаю эту ошибку из Gimp:

enter image description here

Похоже, Gimp не проходит текущее изображение в мой Plug- in, поэтому вместо 7. передаются 6 аргументов. Как я могу решить эту проблему?

ответ

0

Это может показаться странным, но, возможно, попробовать

def enumerategrid(image, layer ,width, height, tcolor, theight, font, startfrom)

здесь примеры могут быть полезны.

http://registry.gimp.org/node/28124

0

Следующая теперь работает на моей машине. Мой оригинальный ответ был прав о параметрах, которые вам нужно пройти.

Также обратите внимание, что мне нужно было изменить меню на ярлык.

#!/usr/bin/env python 
#https://stackoverflow.com/questions/27751506/gimp-the-current-image-is-not-passed-as-parameter-to-my-plug-in-function/27831408#27831408 

from gimpfu import * 
import os 



def enumerategrid(image, layer, width, height, tcolor, theight, font, startfrom): 

    pass 



register(
     proc_name="enumerategrid_plugin-pdb", 
     blurb="Enumera rejillas en una imagen", 
     help="Enumera rejillas en una imagen", 
     author="Jorge Araya Navarro <[email protected]>", 
     copyright="Servants of the Secret Fire Game Studios", 
     date="2015", 
     label="<Image>/Filters/Test/enumerate", 
     imagetypes="*", 
     params=[ 
      (PF_INT32, "width", "ancho de la reja", 32), 
      (PF_INT32, "height", "altura de la reja", 32), 
      (PF_COLOR, "tcolor", "Color del texto", (1.0, 1.0, 1.0)), 
      (PF_SPINNER, "theight", "Tamao del texto", 8, (1, 50, 1)), 
      (PF_FONT, "font", "Tipografia", "Monospace"), 
      (PF_SPINNER, "startfrom", "Contar desde", 0, (0, 3000, 1)), 
     ], 
     results=[], 
     function=enumerategrid) 



main() 
# to make example work, cannot use accented characters on my machine