mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:50:00 +02:00
Revert "Make entity properties be undefined after entity is unloaded"
This commit is contained in:
parent
18375f42bd
commit
1ef01d670d
4 changed files with 30 additions and 25 deletions
|
@ -1515,6 +1515,7 @@ SelectionDisplay = (function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
that.updateRotationHandles();
|
that.updateRotationHandles();
|
||||||
|
that.highlightSelectable();
|
||||||
|
|
||||||
var rotation, dimensions, position, registrationPoint;
|
var rotation, dimensions, position, registrationPoint;
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,22 @@ KeyLightPropertyGroup EntityItemProperties::_staticKeyLight;
|
||||||
EntityPropertyList PROP_LAST_ITEM = (EntityPropertyList)(PROP_AFTER_LAST_ITEM - 1);
|
EntityPropertyList PROP_LAST_ITEM = (EntityPropertyList)(PROP_AFTER_LAST_ITEM - 1);
|
||||||
|
|
||||||
EntityItemProperties::EntityItemProperties(EntityPropertyFlags desiredProperties) :
|
EntityItemProperties::EntityItemProperties(EntityPropertyFlags desiredProperties) :
|
||||||
_desiredProperties(desiredProperties) //,
|
|
||||||
|
_id(UNKNOWN_ENTITY_ID),
|
||||||
|
_idSet(false),
|
||||||
|
_lastEdited(0),
|
||||||
|
_type(EntityTypes::Unknown),
|
||||||
|
|
||||||
|
_glowLevel(0.0f),
|
||||||
|
_localRenderAlpha(1.0f),
|
||||||
|
|
||||||
|
_glowLevelChanged(false),
|
||||||
|
_localRenderAlphaChanged(false),
|
||||||
|
|
||||||
|
_defaultSettings(true),
|
||||||
|
_naturalDimensions(1.0f, 1.0f, 1.0f),
|
||||||
|
_naturalPosition(0.0f, 0.0f, 0.0f),
|
||||||
|
_desiredProperties(desiredProperties)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,11 +321,6 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
||||||
QScriptValue properties = engine->newObject();
|
QScriptValue properties = engine->newObject();
|
||||||
EntityItemProperties defaultEntityProperties;
|
EntityItemProperties defaultEntityProperties;
|
||||||
|
|
||||||
if (!_entityFound) {
|
|
||||||
// Return without setting any default property values so that properties are reported in JavaScript as undefined.
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_idSet) {
|
if (_idSet) {
|
||||||
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_ALWAYS(id, _id.toString());
|
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_ALWAYS(id, _id.toString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -272,36 +272,32 @@ public:
|
||||||
void setJointRotationsDirty() { _jointRotationsSetChanged = true; _jointRotationsChanged = true; }
|
void setJointRotationsDirty() { _jointRotationsSetChanged = true; _jointRotationsChanged = true; }
|
||||||
void setJointTranslationsDirty() { _jointTranslationsSetChanged = true; _jointTranslationsChanged = true; }
|
void setJointTranslationsDirty() { _jointTranslationsSetChanged = true; _jointTranslationsChanged = true; }
|
||||||
|
|
||||||
void setEntityFound() { _entityFound = true; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QString getCollisionMaskAsString() const;
|
QString getCollisionMaskAsString() const;
|
||||||
void setCollisionMaskFromString(const QString& maskString);
|
void setCollisionMaskFromString(const QString& maskString);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QUuid _id { UNKNOWN_ENTITY_ID };
|
QUuid _id;
|
||||||
bool _idSet { false };
|
bool _idSet;
|
||||||
quint64 _lastEdited { 0 };
|
quint64 _lastEdited;
|
||||||
EntityTypes::EntityType _type { EntityTypes::Unknown };
|
EntityTypes::EntityType _type;
|
||||||
void setType(const QString& typeName) { _type = EntityTypes::getEntityTypeFromName(typeName); }
|
void setType(const QString& typeName) { _type = EntityTypes::getEntityTypeFromName(typeName); }
|
||||||
|
|
||||||
float _glowLevel { 0.0f };
|
float _glowLevel;
|
||||||
float _localRenderAlpha { 1.0f };
|
float _localRenderAlpha;
|
||||||
bool _glowLevelChanged { false };
|
bool _glowLevelChanged;
|
||||||
bool _localRenderAlphaChanged { false };
|
bool _localRenderAlphaChanged;
|
||||||
bool _defaultSettings { true };
|
bool _defaultSettings;
|
||||||
bool _dimensionsInitialized { true }; // Only false if creating an entity locally with no dimensions properties
|
bool _dimensionsInitialized = true; // Only false if creating an entity localy with no dimensions properties
|
||||||
|
|
||||||
// NOTE: The following are pseudo client only properties. They are only used in clients which can access
|
// NOTE: The following are pseudo client only properties. They are only used in clients which can access
|
||||||
// properties of model geometry. But these properties are not serialized like other properties.
|
// properties of model geometry. But these properties are not serialized like other properties.
|
||||||
QVector<SittingPoint> _sittingPoints;
|
QVector<SittingPoint> _sittingPoints;
|
||||||
QStringList _textureNames;
|
QStringList _textureNames;
|
||||||
glm::vec3 _naturalDimensions { 1.0f, 1.0f, 1.0f };
|
glm::vec3 _naturalDimensions;
|
||||||
glm::vec3 _naturalPosition { 0.0f, 0.0f, 0.0f };
|
glm::vec3 _naturalPosition;
|
||||||
|
|
||||||
EntityPropertyFlags _desiredProperties; // if set will narrow scopes of copy/to/from to just these properties
|
EntityPropertyFlags _desiredProperties; // if set will narrow scopes of copy/to/from to just these properties
|
||||||
|
|
||||||
bool _entityFound { false };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(EntityItemProperties);
|
Q_DECLARE_METATYPE(EntityItemProperties);
|
||||||
|
|
|
@ -202,13 +202,11 @@ EntityItemProperties EntityScriptingInterface::getEntityProperties(QUuid identit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
results = convertLocationToScriptSemantics(results);
|
|
||||||
results.setEntityFound();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return results;
|
return convertLocationToScriptSemantics(results);
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& scriptSideProperties) {
|
QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& scriptSideProperties) {
|
||||||
|
|
Loading…
Reference in a new issue