Add node on all corresponding masters

Hi, Im currently working on large family with 12 masters. Is it possible to add node on all masters at once, without need to go thru all masters and add points manually?

thnx

We are working on this.

4 Likes

If that workaround works for you, you can use functions like Reconnect Nodes or Open Corner with the Opt key held down.

This little script splits selected segments in all masters in half. We use when we have a lot of Masters

#MenuTitle: SelectedSplit Segment in all Masters
# by Mist Zetafonts
__doc__="""
Split Selected Segment in all Masters
"""
MacroTab.title = "Split Selected Segment in all Masters"

def SplitSelSegmentsMaster(layer, nodelist):
	if(not nodelist): return False
	for P in layer.paths:
		for N in P.nodes[::-1]:
			for nodeId in nodelist:
				if N.index==nodeId:
					print("Layer: ", layer.layerId, " Node:",nodeId)
					if(not P.insertNodeWithPathTime_(N.index+0.5)):
						return False

def SplitAllMasterSelSegments():
	F = Glyphs.font
	F.disableUpdateInterface()

	glyph = Layer.parent
	Count = len(F.masters) 
	
	#FIND SEGMENT TO SPLIT in current layer
	nodelist = []
	for P in Layer.paths:
		# backward nodes
		for N in P.nodes[::-1]:
			if N.selected and N.prevNode.selected and  N.type != OFFCURVE:
				nodelist.append(N.index)
	
	#SPLIT NODE FOR EVERY MASTER
	for master in F.masters:
		SplitSelSegmentsMaster(glyph.layers[master.id],nodelist)
		
	F.enableUpdateInterface()
	return True
	
SplitAllMasterSelSegments()
3 Likes

this one is nice! thank you

any updates on this? it would be very useful for me as well.

Working on it, but not quite ready yet.

1 Like

not yet? haha.. I mean, it would be super useful on Variable Font times.
Meanwhile, I leave this early try here. Is a hardcoded one, but do the basic job:

#MenuTitle: Split Selected Segment in a value between 1-99%
__doc__="""
Split the currently selected segment at custom percentage in all masters.
Make sure to select two connected on-curve points before running.
"""

from GlyphsApp import *

def SplitSelSegmentsMaster(layer, nodelist, t):
    if not nodelist: 
        return False
    for path in layer.paths:
        for node in path.nodes[::-1]:  # backward nodes like reference
            for nodeId in nodelist:
                if node.index == nodeId:
                    print("Layer:", layer.layerId, "Node:", nodeId)
                    if not path.insertNodeWithPathTime_(node.index + t):
                        return False
    return True

def main():
    font = Glyphs.font
    if not font:
        return
    
    layer = font.selectedLayers[0]
    glyph = layer.parent
    
    # YOUR CUSTOM VALUE HERE
    percentage = 50  # CHANGE THIS to any value between 1-99

    t = percentage / 100.0  # Convert to decimal, DO NOT CHANGE THIS
    
    # FIND SEGMENT TO SPLIT in current layer (same as reference above)
    nodelist = []
    for path in layer.paths:
        # backward nodes like reference
        for node in path.nodes[::-1]:
            if (node.selected and node.prevNode and 
                node.prevNode.selected and node.type != GSOFFCURVE):
                nodelist.append(node.index)
    
    if not nodelist:
        print("Please select two connected on-curve points")
        return
    
    font.disableUpdateInterface()
    
    try:
        # SPLIT NODE FOR EVERY MASTER (same pattern as reference)
        for master in font.masters:
            SplitSelSegmentsMaster(glyph.layers[master.id], nodelist, t)
        
        print(f"Split {len(nodelist)} segment(s) at {percentage}% in {len(font.masters)} masters")
        
    except Exception as e:
        print(f"Error: {e}")
        import traceback
        traceback.print_exc()
    finally:
        font.enableUpdateInterface()

if __name__ == "__main__":
    main()