cleanup of EntityItem ctors and friends

This commit is contained in:
Andrew Meadows 2015-07-16 17:48:28 -07:00
parent 62fca613a6
commit 18d0cb5158
12 changed files with 7 additions and 18 deletions

View file

@ -29,7 +29,6 @@ BoxEntityItem::BoxEntityItem(const EntityItemID& entityItemID, const EntityItemP
EntityItem(entityItemID)
{
_type = EntityTypes::Box;
_created = properties.getCreated();
setProperties(properties);
}

View file

@ -85,11 +85,6 @@ EntityItem::EntityItem(const EntityItemID& entityItemID) :
_lastUpdated = now;
}
EntityItem::EntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) : EntityItem(entityItemID)
{
setProperties(properties);
}
EntityItem::~EntityItem() {
// clear out any left-over actions
EntityTree* entityTree = _element ? _element->getTree() : nullptr;
@ -1077,6 +1072,8 @@ void EntityItem::getAllTerseUpdateProperties(EntityItemProperties& properties) c
bool EntityItem::setProperties(const EntityItemProperties& properties) {
bool somethingChanged = false;
// just in case _created must be properly set before the rest we do it first
SET_ENTITY_PROPERTY_FROM_PROPERTIES(created, updateCreated);
// these affect TerseUpdate properties
SET_ENTITY_PROPERTY_FROM_PROPERTIES(simulationOwner, setSimulationOwner);
@ -1099,7 +1096,6 @@ bool EntityItem::setProperties(const EntityItemProperties& properties) {
SET_ENTITY_PROPERTY_FROM_PROPERTIES(friction, updateFriction);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(ignoreForCollisions, updateIgnoreForCollisions);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(collisionsWillMove, updateCollisionsWillMove);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(created, updateCreated);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(lifetime, updateLifetime);
// non-simulation properties below

View file

@ -119,7 +119,6 @@ public:
DONT_ALLOW_INSTANTIATION // This class can not be instantiated directly
EntityItem(const EntityItemID& entityItemID);
EntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties);
virtual ~EntityItem();
// ID and EntityItemID related methods

View file

@ -29,7 +29,7 @@ EntityItemPointer LightEntityItem::factory(const EntityItemID& entityID, const E
// our non-pure virtual subclass for now...
LightEntityItem::LightEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
EntityItem(entityItemID, properties)
EntityItem(entityItemID)
{
_type = EntityTypes::Light;

View file

@ -38,7 +38,6 @@ LineEntityItem::LineEntityItem(const EntityItemID& entityItemID, const EntityIte
_points(QVector<glm::vec3>(0))
{
_type = EntityTypes::Line;
_created = properties.getCreated();
setProperties(properties);

View file

@ -33,7 +33,7 @@ EntityItemPointer ModelEntityItem::factory(const EntityItemID& entityID, const E
}
ModelEntityItem::ModelEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
EntityItem(entityItemID, properties)
EntityItem(entityItemID)
{
_type = EntityTypes::Model;
setProperties(properties);

View file

@ -61,7 +61,7 @@ EntityItemPointer ParticleEffectEntityItem::factory(const EntityItemID& entityID
// our non-pure virtual subclass for now...
ParticleEffectEntityItem::ParticleEffectEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
EntityItem(entityItemID, properties),
EntityItem(entityItemID),
_maxParticles(DEFAULT_MAX_PARTICLES),
_lifespan(DEFAULT_LIFESPAN),
_emitRate(DEFAULT_EMIT_RATE),

View file

@ -57,7 +57,6 @@ PolyVoxEntityItem::PolyVoxEntityItem(const EntityItemID& entityItemID, const Ent
_voxelSurfaceStyle(PolyVoxEntityItem::DEFAULT_VOXEL_SURFACE_STYLE)
{
_type = EntityTypes::PolyVox;
_created = properties.getCreated();
setProperties(properties);
}

View file

@ -30,7 +30,7 @@ EntityItemPointer SphereEntityItem::factory(const EntityItemID& entityID, const
// our non-pure virtual subclass for now...
SphereEntityItem::SphereEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
EntityItem(entityItemID, properties)
EntityItem(entityItemID)
{
_type = EntityTypes::Sphere;
setProperties(properties);

View file

@ -37,7 +37,6 @@ TextEntityItem::TextEntityItem(const EntityItemID& entityItemID, const EntityIte
EntityItem(entityItemID)
{
_type = EntityTypes::Text;
_created = properties.getCreated();
setProperties(properties);
}

View file

@ -30,7 +30,6 @@ WebEntityItem::WebEntityItem(const EntityItemID& entityItemID, const EntityItemP
EntityItem(entityItemID)
{
_type = EntityTypes::Web;
_created = properties.getCreated();
setProperties(properties);
}
@ -149,4 +148,4 @@ void WebEntityItem::setSourceUrl(const QString& value) {
}
}
const QString& WebEntityItem::getSourceUrl() const { return _sourceUrl; }
const QString& WebEntityItem::getSourceUrl() const { return _sourceUrl; }

View file

@ -37,7 +37,6 @@ ZoneEntityItem::ZoneEntityItem(const EntityItemID& entityItemID, const EntityIte
EntityItem(entityItemID)
{
_type = EntityTypes::Zone;
_created = properties.getCreated();
_keyLightColor[RED_INDEX] = DEFAULT_KEYLIGHT_COLOR.red;
_keyLightColor[GREEN_INDEX] = DEFAULT_KEYLIGHT_COLOR.green;