Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Troubleshooting Python plugin to load an XCF file
#3
(03-19-2021, 07:39 AM)Ofnuts Wrote:
  • The outer parentheses are not necessary (this is script-fu syntax....)
  • If you want to use your script via the registration, then it's called as pdb.python_fu_open_xcf("your file") (your script is added to the PDB, using the name specified as the first argument of the registration (a.k.a. "the "atom")). You can check it registered properly using the PDB function browser in the Python-fu console) 


Thanks for the command line syntax tips. That was helpful. When I try to run the plugin to open the XCF I get this message:

batch command experienced an execution error:
Error: eval: unbound variable: pdb.python_fu_open_xcf 

My plugin is not showing up in the PDB so there must be something wrong with it. I tried updating my code slightly, as shown below, to define drawable and to add the dummy parameter of 0 as suggested by the PDB, but that doesn't help and I get the same message.  

Code:
#!/usr/bin/env python
#
# Script to open .XCF file

from gimpfu import *

def open_xcf(file):
   image = pdb.gimp_xcf_load(0, file, file)
   drawable = pdb.gimp_image_get_active_layer(image)

register(
   "python_fu_open_xcf",
   "Add image to layer",
   "Add image to layer and flatten.",
   "TCB",
   "TCB",
   "2021",
   "<Image>/Filters/Tim/Open XCF",
   "*",
   [
       (PF_FILE, "file", "XCF file to open", ""),
   ],
   [],
   open_xcf)

main()
Reply


Messages In This Thread
RE: Troubleshooting Python plugin to load an XCF file - by TimorousMe - 03-19-2021, 01:15 PM

Forum Jump: