Script really slow, something changed?

I have two simple scripts, one colors glyphs and another colors layers. They use to work fine and fast, but recently the one that colors glyphs is taking an enormous amount of time. Did something changed? I checked at the API and couldn’t find anything different.

Font = Glyphs.font
baseGlyphs = []
composites = []
mixedComposites = []

for glyph in Font.glyphs:
	for layer in glyph.layers:
		componentCount = len(layer.components)
		pathsCount = len(layer.paths)	
		if componentCount == 0:
			baseGlyphs.append(layer)
		else:
			if pathsCount == 0:
				composites.append(layer)
			else:
				mixedComposites.append(layer)
				
#changes layer color						
for layer in baseGlyphs:
	layer.setColorIndex_(6)
for layer in composites:
	layer.setColorIndex_(10)
for layer in mixedComposites:
	layer.setColorIndex_(3)

Changing the glyph colors triggers now a reload of the sidebar filters. That means you need to wrap your script in Font.disableUpdateInterface() and Font.enableUpdateInterface() calls.

And you can use the python API for the colors: layer.color = 3

2 Likes

Thank you, works very well now.

1 Like