drawLayer method

the GlyphsCore framework exposes this method for tool plugins, from Headers/GlyphsToolDrawProtocol.h:68

/** Draws the foreground for the Layer.
 @param Layer      the layer
 @param Point      The current position in the edit view
 @param Active     if the layer is currentyl active
 @param Attributes Some attributes
- (void)drawLayer:(GSLayer*)Layer atPoint:(NSPoint)Point asActive:(BOOL)Active attributes:(NSDictionary*)Attributes;

By default it draws filled paths (without any nodes, anchors, notes, etc), which is totally fine. I can’t seem to implement the standard edit view, though, the one that displays nodes, anchors, notes, etc, as seen in the Select, Draw, and Erase tools. Any advice on how to display these elements within a tool plugin?

And what are the attributes that go in the Attributes param of that drawLayer method?

The node view is implemented in the GlyphsPathPlugin class. If you use it as you superclass, you just need to call [super drawLayerLayer atPoint:Point asActive:Active attributes:Attributes];

What do you try to do? Are you using python or ObjectiveC?

Ahhh that’s much closer to what I want. Thanks for pointing that out!

I’m using ObjectiveC to make a plugin that extends the Select tool a little bit. https://github.com/danielgamage/Extrude-Tool. Very buggy at the moment… but the idea is to port extrusion tools from 3d apps to the 2d vectors in Glyphs.

1 Like