layer combos without children are erased
This commit is contained in:
parent
8fe23edc1f
commit
e357a7f4a2
6 changed files with 13 additions and 0 deletions
|
@ -27,6 +27,7 @@ class AtlasLayerCombo {
|
|||
virtual void setup(const ComboIdentifier & identifier,
|
||||
AtlasLayerComboSettings settings) = 0;
|
||||
virtual void update() = 0;
|
||||
virtual bool hasChildren() = 0;
|
||||
virtual void careForChild(shared_ptr <Layer> layer) = 0;
|
||||
virtual void abandonChild(shared_ptr <Layer> layer) = 0;
|
||||
virtual const ComboIdentifier & getIdentifier() const = 0;
|
||||
|
|
|
@ -139,6 +139,9 @@ const ComboIdentifier & GPUFontAtlasLayerCombo::getIdentifier() const {
|
|||
void GPUFontAtlasLayerCombo::setVFlip(VFlipState vFlipState){
|
||||
vFlip = vFlipState;
|
||||
}
|
||||
bool GPUFontAtlasLayerCombo::hasChildren(){
|
||||
return layers.size() > 0;
|
||||
}
|
||||
const vector <shared_ptr <GPUFontLayer> > & GPUFontAtlasLayerCombo::getLayers(){
|
||||
return layers;
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ class GPUFontAtlasLayerCombo : public AtlasLayerCombo {
|
|||
void abandonChild(shared_ptr <Layer> layer) override;
|
||||
const ComboIdentifier & getIdentifier() const override;
|
||||
void setVFlip(VFlipState vFlipState) override;
|
||||
bool hasChildren() override;
|
||||
|
||||
const vector <shared_ptr <GPUFontLayer> > & getLayers();
|
||||
void draw();
|
||||
|
|
|
@ -20,6 +20,9 @@ void LayerComposition::update(){
|
|||
if(l.second->wantsNewMom()){
|
||||
const auto momIdentifier = l.second->getMomsComboIdentifier();
|
||||
atlasLayerCombos[momIdentifier]->abandonChild(l.second);
|
||||
if(!atlasLayerCombos[momIdentifier]->hasChildren()){
|
||||
atlasLayerCombos.erase(momIdentifier);
|
||||
}
|
||||
ComboIdentifier idealMom{
|
||||
l.second->getProps().fontPath,
|
||||
momIdentifier.type
|
||||
|
|
|
@ -74,6 +74,10 @@ void MsdfAtlasLayerCombo::setVFlip(VFlipState vFlipState){
|
|||
}
|
||||
}
|
||||
|
||||
bool MsdfAtlasLayerCombo::hasChildren(){
|
||||
return layers.size() > 0;
|
||||
}
|
||||
|
||||
const ofImage & MsdfAtlasLayerCombo::getAtlasImage(){
|
||||
return atlas->getAtlasImage();
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ class MsdfAtlasLayerCombo : public AtlasLayerCombo {
|
|||
void abandonChild(shared_ptr <Layer> layer) override;
|
||||
const ComboIdentifier & getIdentifier() const override;
|
||||
void setVFlip(VFlipState vFlipState) override;
|
||||
bool hasChildren() override;
|
||||
const ofImage & getAtlasImage();
|
||||
string getAtlasImagePath();
|
||||
shared_ptr <Layer> getLayer(); // TODO: is this used
|
||||
|
|
Loading…
Reference in a new issue