script doesn’t seem to work on G4
any tips to go about fixing it ?
Works for me. Do you get an error message?
The script needs to be updated to explicitly import GSNode, OFFCURVE, ONCURVE and some other constants, if I remember correctly. This is an annoying new behaviour in G4.
You should get an error message about an unknown name. At the top of the script, add:
from GlyphsApp import GSNode, GSAnchor, OFFCURVE, CURVE
There might be more.
Yes! I am getting this error:
Traceback (most recent call last):
File “Adopt Background.py”, line 99
subpaths = subpaths( selection )
File “Adopt Background.py”, line 58, in subpaths
selection.append( GSNode() )
^^^^^^
NameError: name ‘GSNode’ is not defined
I included your snippet at the top but I still get an error:
Traceback (most recent call last):
File “Adopt Background.py”, line 2
ImportError: cannot import name ‘ONCURVE’ from ‘GlyphsApp’ (/Applications/Glyphs 4.app/Contents/Scripts/GlyphsApp/init.py). Did you mean: ‘CURVE’?
Then put CURVE instead.
that worked ! thanks
The explicit import requirement is annoying, I know. But when it is done, it helps tremendously with code checkers like flake8 or pyright. The advantage of being able to automatically check the code outweighs the cost. And you can do that in the Scripting Window. Check etc popup next to the clean button. There you can set it up and control it.