Layer.background.paths.append(path) takes effect when the plugin is not applied

Layer.background.paths.append(path) takes effect when the plugin is not applied.
When the apply button of the plugin is pressed, there will be two overlapping paths on the background image.

Each time the filter is appleid, the shapes have to be replaced by a copy from the original layer. That is done for the foreground layer but it seems not for the background.
Normally the background is not effected, so that is not done for the background. You can check here: GlyphsSDK/ObjectWrapper/GlyphsApp/plugins.py at 8d3fcc8b0144dd75b00256a49cd7492d56be2ee8 · schriftgestalt/GlyphsSDK · GitHub to see how it is done.

I understand. Is there any way I can help add path to background in the plugin

You need to copy the def process_(self, sender): and add something like this after the Layer.setShapes_ line.

Layer.setBackground_(ShadowLayer.pyobjc_instanceMethods.background().copy())

(I typed that in Safari)

I need to add the def process_ Copy (self, sender) into my plugin code, or find the function in the local app directory and add something like this after the Layer.setShapes_ line

You add the whole `process() into your plugin.

thanks,i will have a try

Glyph2 does not seem to support:
File “plugin.py”, line 43, in process_
Layer.setShapes_(
AttributeError: ‘NSKVONotifying_GSLayer’ object has no attribute ‘setShapes_’

setPaths_?

You really need to update to glyphs3.
Yes. It is setPaths_() in glyphs2

Now it’s basically okay, but there’s one problem. If I don’t click on apply, the path will still not be recalled in background

Now there won’t be any overlap, but if I don’t apply, this path will still be added to the background

Without more information about what you are trying to do, I can’t help. Can you send me the plugin?

Yes, how can I send it to you

Send it by email to support at this domain or post a link to the file in a private message.