Delete Multiple Nodes

Yes. Nodes are selected, since the script is using thisLayer = thisFont.selectedLayers[0]

thisPath.removeNodeCheckKeepShape_( thisNode )

The problem seems to be with the part within parenthesis ( thisNode ). What value goes there? If I am to remove just a single* Node with this method and type it on my own what should I input for it to work. I recon it will need an x and y value separated by a comma. (instead of the iterator that goes through all selected).

No. The variable thisPath is not assigned corruptly. it is of type ‘objc.native_selector’ and should be of type GSPath.

This is not the line where it is assigned. The assignment is the line that starts with thisPath =:

if selection:
	selectedNodes = [obj for obj in selection if type(obj)==GSNode and obj.type==35]
	if selectedNodes:
		thisGlyph.beginUndo() # begin undo grouping
		thisLayer.setSelection_( None )
		for thisNode in selectedNodes:
			thisPath = thisNode.parent
			thisPath.removeNodeCheckKeepShape_( thisNode )
		thisGlyph.endUndo()   # end undo grouping

I think I fixed it. The .parent attribute did not work in your case.

Awesome. It works : )

I am getting an error, since updating to 2.2.

The macro says the following once executed:

Traceback (most recent call last):
File “Delete Nodes and Try to Keep Shape.py”, line 13, in
selection = thisLayer.selection() # node selection in edit mode
TypeError: ‘LayerSelectionProxy’ object is not callable

This should be fixed. Please get the latest version of the script.

Ah, yes. I guess I haven’t updated the repository in a while. Thanks, Georg.

  1. Consider cloning the repository rather than downloading it manually every time.
  2. Bug reports for scripts should be opened as issues on GitHub directly.

Yes, indeed. Git Desktop is handy, that is what I meant by update repository.