fix materials not disappearing on deletion in certain cases

This commit is contained in:
SamGondelman 2018-04-06 15:18:21 -07:00
parent 1d76dea9f6
commit 5503c7909a
2 changed files with 5 additions and 6 deletions

View file

@ -27,6 +27,10 @@ MaterialEntityItem::MaterialEntityItem(const EntityItemID& entityItemID) : Entit
_type = EntityTypes::Material;
}
MaterialEntityItem::~MaterialEntityItem() {
removeMaterial();
}
EntityItemProperties MaterialEntityItem::getProperties(EntityPropertyFlags desiredProperties) const {
EntityItemProperties properties = EntityItem::getProperties(desiredProperties); // get the properties from our base class
COPY_ENTITY_PROPERTY_TO_PROPERTIES(materialURL, getMaterialURL);
@ -328,11 +332,6 @@ void MaterialEntityItem::postParentFixup() {
applyMaterial();
}
void MaterialEntityItem::preDelete() {
EntityItem::preDelete();
removeMaterial();
}
void MaterialEntityItem::update(const quint64& now) {
if (_retryApply) {
applyMaterial();

View file

@ -21,6 +21,7 @@ public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
MaterialEntityItem(const EntityItemID& entityItemID);
~MaterialEntityItem();
ALLOW_INSTANTIATION // This class can be instantiated
@ -84,7 +85,6 @@ public:
void removeMaterial();
void postParentFixup() override;
void preDelete() override;
private:
// URL for this material. Currently, only JSON format is supported. Set to "userData" to use the user data to live edit a material.