def drawGlyphArea(self, glyph, layer=None): glyph_name = glyph.name layer_name = layer if layer is not None else glyph.layer(layer).name mask_layer_name = self._mask_layer_prefix + layer_name + self._mask_layer_suffix if self.data_samples.has_key(glyph_name) and self.data_samples[ glyph_name].has_key(layer_name): if glyph.hasLayer(mask_layer_name): mask_layer = glyph.layer(mask_layer_name) mask_layer.removeAllShapes() else: mask_layer = glyph.layer(layer_name).getMaskLayer(True) mask_layer.name += self._mask_layer_suffix left, mid, right = self.data_samples[glyph_name][layer_name] contour_left = GlyphSampler.getContour(left, False) contour_mid = GlyphSampler.getContour(mid, False) contour_right = GlyphSampler.getContour(right, False) new_shape = fl6.flShape() new_shape.addContours([contour_left, contour_mid, contour_right], True) mask_layer.addShape(new_shape) else: print 'ABORT:\t Draw Area;\t Glyph: %s; Layer: %s;\tGlyphSampler data not found!' % ( glyph_name, layer_name)
def fgInterpolator(tx, ty): tempLayer = fl6.flLayer('B:%s %s, t:%s' %(l0.name, l1.name, (tx, ty))) for shapePair in shapes: tempBlend = fl6.flShape(fgt.fgShape(shapePair[0], shapePair[1], tx, ty, 0)) tempLayer.addShape(tempBlend) return tempLayer
def process_setFilter(self, glyph, shape, layer, builder, suffix='.old'): new_container = fl6.flShape() new_container.shapeData.name = shape.shapeData.name if len(shape.shapeData.name): shape.shapeData.name += suffix #!!!! TODO: transformation copy and delete new_container.include(shape, glyph.layer(layer)) new_container.shapeBuilder = builder.clone() new_container.update() glyph.layer(layer).addShape(new_container)
def paste(self): wGlyph = self.aux.glyph if len(self.contourClipboard.keys()): for layerName, contours in self.contourClipboard.iteritems(): wLayer = wGlyph.layer(layerName) if wLayer is not None: newShape = fl6.flShape() newShape.addContours(contours, True) wLayer.addShape(newShape) self.aux.glyph.updateObject( self.aux.glyph.fl, 'Paste outline; Glyph: %s; Layers: %s' % (self.aux.glyph.fl.name, '; '.join([ item.text() for item in self.aux.lst_layers.selectedItems() ]))) self.aux.glyph.update()
def add_new_shape(layer, contours): newShape = fl6.flShape() newShape.addContours(contours, True) layer.addShape(newShape)
def getShapes(self): fgGlyphs = self.getGlyphs() return [fl6.flShape(glyph.layer[0]) for glyph in fgGlyphs]