Node.selected not working?

Could it be that node.selected is not (yet) working?

I tried the sample code given in the documentation …

# access all selected nodes
for path in layer.paths:
        for node in path.nodes: # (or path.anchors etc.)
                print node.selected

… and only get falses.

FWIW, a quick workaround that works for me:

selection = [ node for node in layer.selection if type( node ) is GSNode ]
1 Like

The later will be much faster. The node.selected works for me but maybe I fixed something in my version.

Btw, layer.selection is sorted by selection order?

For a list of selected nodes in their natural order (based on the paths), this works:

selection = [ node for path in layer.paths for node in path.nodes if node in layer.selection ]
1 Like