金普:我为什么不能注册? [英] Gimp: why can't I register this?

查看:106
本文介绍了金普:我为什么不能注册?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Blender编写一个插件,以使其与Gimp同步,并且该脚本应该能够从Gimp内部启动,但是我无法注册它……为什么?

I'm writing an add-on for Blender to sync it with Gimp and this script should be able to start from within Gimp, but I can't register it... Why?

blender_gimp_sync.py:

blender_gimp_sync.py:

# -*- coding: utf-8 -*-

#!/usr/bin/env python

from gimpfu import *

def blender_gimp_sync():
    image_dir = "/home/antoni4040/Έγγραφα/Layout.png"
    image = gimp.pdb.gimp_file_load(image_dir, image_dir)
    gimp.Display(image)


register(
    "python_fu_bgsync",
    "Blender-Gimp Sync",
    "Syncronize Gimp with Blender for texturing",
    "Antonis Karvelas",
    "Antonis Karvelas",
    "2012",
    "<Image>/Image/Blender-Gimp Sync",
    "*",
    [],
    [],
    blender_gimp_sync
)   

main()

真的很奇怪...

推荐答案

您没有说要得到哪个错误-但是由于您发布了源文件,所以我想我可以猜到: GIMP期望它的插件可以被系统执行-告诉Posix(包括linux)系统应该使用特定解释器或shell执行文件的是shebang行-在您的示例中为#!/usr/bin/env python行.

You didn't say which error you are getting - but since you posted your source file I think I can guess it: GIMP expect's it's plug-ins to be exectuable by the system - and what tell's Posix (linux included) systems that a file should be executed with a particular interpreter or shell is the shebang line - the line that goes #!/usr/bin/env python in your example.

但是,此行必须是文件中的第一行-其中的#!字符应该是文件中的前两个字符.表示字符编码的行-# -*- coding: utf-8 -*-应该紧随其后-它必须是文件中的第二行,它们之间不能有空行.

This line, however, has to be the first line in your file - the #! characters in it should be the first two characters in the file. The line denoting the character encoding - # -*- coding: utf-8 -*- should come after it - it has to be the second line in the file, no blank lines between them).

最后,通过在Python文件上运行"chmod a + x",确保将脚本设置为可执行文件.

And finally, be sure to set the script as executable, by running "chmod a+x " on the Python file.

与之相关,但不是引起问题的原因,因此在GIMP中已弃用菜单路径和脚本菜单名称-正确的方法是在"date"参数之后,仅传递名称应该显示在菜单同步"中,并在调用结束时将菜单路径作为命名参数传递,例如:menu="<Image>/Image/Blender-Gimp"

related to it, but not being what is causing the problem, putting the menu path along with the script menu name is deprecated in GIMP - the correct way to do it is, after the "date" parameter, pass just the name that should show in the menu -- "Sync" - and pass the menu path as a named parameter, at the end of the call, like: menu="<Image>/Image/Blender-Gimp"

这篇关于金普:我为什么不能注册?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆