Can "Make Node First in all Masters" work on all compatible masters?

Would it be possible, even if masters are incompatible, to have “Make node first in all masters” to operate on all masters that are compatible with the current master?

For example, I have 10 roman masters, and 10 italic masters. The first node is wrong in all roman masters. So I would like to set the first node in all compatible masters.

Currently, nothing happens, and I need to step through all masters inidividually.

2 Likes

One up for the implementation.

I once wrote a script for that. Maybe it helps in the mean time:

# MenuTitle: Make Node First in all (Special) Layers
# -*- coding: utf-8 -*-
__doc__ = """
- Sets selected node to be the first node in all (special) layers (Masters, Smart Component Layers, Brace/Bracket Layers, ...).
- The glyph must be compatible, and all start nodes must be the same when you run the script. (But Glyphs won’t do that either if they aren’t.)
"""

import traceback

def all_required_layers(glyph):
    return [
        [
            layer.layerId
            for layer in glyph.layers
            if layer.isSpecialLayer or layer.isMasterLayer
        ]
    ]


def makeNodeFirstForAll(_layer):
    selectedNode = _layer.selNode()
    layer = selectedNode.layer
    glyph = layer.glyph()

    layerIdGroups = all_required_layers(glyph)

    nodeIndexPath = layer.indexPathOfNode_(selectedNode)
    for group in layerIdGroups:
        if layer.layerId in group:
            if glyph.mastersCompatibleForLayerIds_(list(group)):
                for layerID in group:
                    currLayer = glyph.layerForId_(layerID)
                    currNode = currLayer.nodeAtIndexPath_(nodeIndexPath)
                    currNode.makeNodeFirst()


makeNodeFirstForAll(_layer=Layer)

What’s the traceback import for?

This also doesn’t check compatibility, but is about special layers. I’m specifically asking whether all compatible masters could be treated, even if there are incompatible ones.

traceback use was removed, but you can add a print traceback.format_exc() if you need.

Script’s task is not to check for compatibility but to set the start node. Of course having them compatible is mandatory. how shall the script otherwise set the same index?

You will have to edit it to your needs to ignore the incompatible masters and find a solution what to do with those masters. It was just a hint that could get you further than nothing.

and the script checks for special layers AND master layers. It’s not too much to read and easy to edit, come on Sebastian, you can do it :wink:

Bump, could this be implemented? Pretty please? Or be put on The List™? :wink:

Thanks for the reminder. Done.

1 Like