mirror of
https://github.com/overte-org/overte.git
synced 2025-07-22 17:54:15 +02:00
reverted special property case, parentJointName is now only parsed from the JSON import
This commit is contained in:
parent
3c37bf8acd
commit
84ec9890ca
12 changed files with 25 additions and 51 deletions
|
@ -1183,6 +1183,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
_entityEditSender.setServerJurisdictions(&_entityServerJurisdictions);
|
||||
_entityEditSender.setMyAvatar(myAvatar.get());
|
||||
|
||||
// The entity octree will have to know about MyAvatar for the parentJointName import
|
||||
getEntities()->getTree()->setMyAvatar(myAvatar.get());
|
||||
_entityClipboard->setMyAvatar(myAvatar.get());
|
||||
|
||||
// For now we're going to set the PPS for outbound packets to be super high, this is
|
||||
// probably not the right long term solution. But for now, we're going to do this to
|
||||
// allow you to move an entity around in your hand
|
||||
|
|
|
@ -522,7 +522,7 @@ public:
|
|||
Q_INVOKABLE virtual void clearJointsData();
|
||||
|
||||
/// Returns the index of the joint with the specified name, or -1 if not found/unknown.
|
||||
Q_INVOKABLE virtual int getJointIndex(const QString& name) const override;
|
||||
Q_INVOKABLE virtual int getJointIndex(const QString& name) const;
|
||||
|
||||
Q_INVOKABLE virtual QStringList getJointNames() const;
|
||||
|
||||
|
@ -669,6 +669,7 @@ public slots:
|
|||
emit sessionUUIDChanged();
|
||||
}
|
||||
}
|
||||
|
||||
virtual glm::quat getAbsoluteJointRotationInObjectFrame(int index) const override;
|
||||
virtual glm::vec3 getAbsoluteJointTranslationInObjectFrame(int index) const override;
|
||||
virtual bool setAbsoluteJointRotationInObjectFrame(int index, const glm::quat& rotation) override { return false; }
|
||||
|
|
|
@ -121,7 +121,6 @@ EntityPropertyFlags EntityItem::getEntityProperties(EncodeBitstreamParams& param
|
|||
requestedProperties += PROP_ACTION_DATA;
|
||||
requestedProperties += PROP_PARENT_ID;
|
||||
requestedProperties += PROP_PARENT_JOINT_INDEX;
|
||||
requestedProperties += PROP_PARENT_JOINT_NAME;
|
||||
requestedProperties += PROP_QUERY_AA_CUBE;
|
||||
|
||||
requestedProperties += PROP_CLIENT_ONLY;
|
||||
|
@ -288,7 +287,6 @@ OctreeElement::AppendState EntityItem::appendEntityData(OctreePacketData* packet
|
|||
APPEND_ENTITY_PROPERTY(PROP_PARENT_ID, actualParentID);
|
||||
|
||||
APPEND_ENTITY_PROPERTY(PROP_PARENT_JOINT_INDEX, getParentJointIndex());
|
||||
APPEND_ENTITY_PROPERTY(PROP_PARENT_JOINT_NAME, getParentJointName());
|
||||
APPEND_ENTITY_PROPERTY(PROP_QUERY_AA_CUBE, getQueryAACube());
|
||||
APPEND_ENTITY_PROPERTY(PROP_LAST_EDITED_BY, getLastEditedBy());
|
||||
|
||||
|
@ -833,7 +831,6 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
|||
overwriteLocalData = overwriteLocalData && !weOwnSimulation;
|
||||
READ_ENTITY_PROPERTY(PROP_PARENT_ID, QUuid, updateParentID);
|
||||
READ_ENTITY_PROPERTY(PROP_PARENT_JOINT_INDEX, quint16, setParentJointIndex);
|
||||
READ_ENTITY_PROPERTY(PROP_PARENT_JOINT_NAME, QString, setParentJointName);
|
||||
overwriteLocalData = oldOverwrite;
|
||||
}
|
||||
|
||||
|
@ -1265,7 +1262,6 @@ EntityItemProperties EntityItem::getProperties(EntityPropertyFlags desiredProper
|
|||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(actionData, getDynamicData);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(parentID, getParentID);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(parentJointIndex, getParentJointIndex);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(parentJointName, getParentJointName);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(queryAACube, getQueryAACube);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(localPosition, getLocalPosition);
|
||||
COPY_ENTITY_PROPERTY_TO_PROPERTIES(localRotation, getLocalOrientation);
|
||||
|
@ -1373,7 +1369,6 @@ bool EntityItem::setProperties(const EntityItemProperties& properties) {
|
|||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(actionData, setDynamicData);
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(parentID, updateParentID);
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(parentJointIndex, setParentJointIndex);
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(parentJointName, setParentJointName);
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(queryAACube, setQueryAACube);
|
||||
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(clientOnly, setClientOnly);
|
||||
|
|
|
@ -359,7 +359,6 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
|
|||
CHECK_PROPERTY_CHANGE(PROP_Z_P_NEIGHBOR_ID, zPNeighborID);
|
||||
CHECK_PROPERTY_CHANGE(PROP_PARENT_ID, parentID);
|
||||
CHECK_PROPERTY_CHANGE(PROP_PARENT_JOINT_INDEX, parentJointIndex);
|
||||
CHECK_PROPERTY_CHANGE(PROP_PARENT_JOINT_NAME, parentJointName);
|
||||
CHECK_PROPERTY_CHANGE(PROP_JOINT_ROTATIONS_SET, jointRotationsSet);
|
||||
CHECK_PROPERTY_CHANGE(PROP_JOINT_ROTATIONS, jointRotations);
|
||||
CHECK_PROPERTY_CHANGE(PROP_JOINT_TRANSLATIONS_SET, jointTranslationsSet);
|
||||
|
@ -625,7 +624,6 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
|
|||
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_PARENT_ID, parentID);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_PARENT_JOINT_INDEX, parentJointIndex);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_PARENT_JOINT_NAME, parentJointName);
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_QUERY_AA_CUBE, queryAACube);
|
||||
|
||||
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_POSITION, localPosition);
|
||||
|
@ -802,7 +800,6 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
|
|||
|
||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(parentID, QUuid, setParentID);
|
||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(parentJointIndex, quint16, setParentJointIndex);
|
||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(parentJointName, QString, setParentJointName);
|
||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(queryAACube, AACube, setQueryAACube);
|
||||
|
||||
COPY_PROPERTY_FROM_QSCRIPTVALUE(localPosition, glmVec3, setLocalPosition);
|
||||
|
@ -1129,7 +1126,6 @@ void EntityItemProperties::entityPropertyFlagsFromScriptValue(const QScriptValue
|
|||
|
||||
ADD_PROPERTY_TO_MAP(PROP_PARENT_ID, ParentID, parentID, QUuid);
|
||||
ADD_PROPERTY_TO_MAP(PROP_PARENT_JOINT_INDEX, ParentJointIndex, parentJointIndex, uint16_t);
|
||||
ADD_PROPERTY_TO_MAP(PROP_PARENT_JOINT_NAME, ParentJointName, parentJointName, QString);
|
||||
|
||||
ADD_PROPERTY_TO_MAP(PROP_LOCAL_POSITION, LocalPosition, localPosition, glm::vec3);
|
||||
ADD_PROPERTY_TO_MAP(PROP_LOCAL_ROTATION, LocalRotation, localRotation, glm::quat);
|
||||
|
@ -1339,7 +1335,6 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy
|
|||
APPEND_ENTITY_PROPERTY(PROP_DESCRIPTION, properties.getDescription());
|
||||
APPEND_ENTITY_PROPERTY(PROP_PARENT_ID, properties.getParentID());
|
||||
APPEND_ENTITY_PROPERTY(PROP_PARENT_JOINT_INDEX, properties.getParentJointIndex());
|
||||
APPEND_ENTITY_PROPERTY(PROP_PARENT_JOINT_NAME, properties.getParentJointName());
|
||||
APPEND_ENTITY_PROPERTY(PROP_QUERY_AA_CUBE, properties.getQueryAACube());
|
||||
|
||||
if (properties.getType() == EntityTypes::Web) {
|
||||
|
@ -2047,7 +2042,6 @@ void EntityItemProperties::markAllChanged() {
|
|||
|
||||
_parentIDChanged = true;
|
||||
_parentJointIndexChanged = true;
|
||||
_parentJointNameChanged = true;
|
||||
|
||||
_jointRotationsSetChanged = true;
|
||||
_jointRotationsChanged = true;
|
||||
|
@ -2407,9 +2401,6 @@ QList<QString> EntityItemProperties::listChangedProperties() {
|
|||
if (parentJointIndexChanged()) {
|
||||
out += "parentJointIndex";
|
||||
}
|
||||
if (parentJointNameChanged()) {
|
||||
out += "parentJointName";
|
||||
}
|
||||
if (jointRotationsSetChanged()) {
|
||||
out += "jointRotationsSet";
|
||||
}
|
||||
|
|
|
@ -206,7 +206,6 @@ public:
|
|||
DEFINE_PROPERTY_REF(PROP_Z_P_NEIGHBOR_ID, ZPNeighborID, zPNeighborID, EntityItemID, UNKNOWN_ENTITY_ID);
|
||||
DEFINE_PROPERTY_REF(PROP_PARENT_ID, ParentID, parentID, QUuid, UNKNOWN_ENTITY_ID);
|
||||
DEFINE_PROPERTY_REF(PROP_PARENT_JOINT_INDEX, ParentJointIndex, parentJointIndex, quint16, -1);
|
||||
DEFINE_PROPERTY_REF(PROP_PARENT_JOINT_NAME, ParentJointName, parentJointName, QString, "");
|
||||
DEFINE_PROPERTY_REF(PROP_QUERY_AA_CUBE, QueryAACube, queryAACube, AACube, AACube());
|
||||
DEFINE_PROPERTY_REF(PROP_SHAPE, Shape, shape, QString, "Sphere");
|
||||
|
||||
|
@ -496,7 +495,6 @@ inline QDebug operator<<(QDebug debug, const EntityItemProperties& properties) {
|
|||
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, ParentID, parentID, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, ParentJointIndex, parentJointIndex, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, ParentJointName, parentJointName, "");
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, QueryAACube, queryAACube, "");
|
||||
|
||||
DEBUG_PROPERTY_IF_CHANGED(debug, properties, JointRotationsSet, jointRotationsSet, "");
|
||||
|
|
|
@ -219,8 +219,6 @@ enum EntityPropertyList {
|
|||
PROP_HAZE_KEYLIGHT_RANGE,
|
||||
PROP_HAZE_KEYLIGHT_ALTITUDE,
|
||||
|
||||
PROP_PARENT_JOINT_NAME,
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// ATTENTION: add new properties to end of list just ABOVE this line
|
||||
PROP_AFTER_LAST_ITEM,
|
||||
|
|
|
@ -2276,6 +2276,17 @@ bool EntityTree::readFromMap(QVariantMap& map) {
|
|||
foreach (QVariant entityVariant, entitiesQList) {
|
||||
// QVariantMap --> QScriptValue --> EntityItemProperties --> Entity
|
||||
QVariantMap entityMap = entityVariant.toMap();
|
||||
|
||||
// handle parentJointName for wearables
|
||||
if (_myAvatar && entityMap.contains("parentJointName") && entityMap.contains("parentID") &&
|
||||
QUuid(entityMap["parentID"].toString()) == AVATAR_SELF_ID) {
|
||||
|
||||
entityMap["parentJointIndex"] = _myAvatar->getJointIndex(entityMap["parentJointName"].toString());
|
||||
|
||||
qCDebug(entities) << "Found parentJointName " << entityMap["parentJointName"].toString() <<
|
||||
" mapped it to parentJointIndex " << entityMap["parentJointIndex"].toInt();
|
||||
}
|
||||
|
||||
QScriptValue entityScriptValue = variantMapToScriptValue(entityMap, scriptEngine);
|
||||
EntityItemProperties properties;
|
||||
EntityItemPropertiesFromScriptValueIgnoreReadOnly(entityScriptValue, properties);
|
||||
|
|
|
@ -278,6 +278,8 @@ public:
|
|||
QByteArray computeEncryptedNonce(const QString& certID, const QString ownerKey);
|
||||
bool verifyDecryptedNonce(const QString& certID, const QString& decryptedNonce, EntityItemID& id);
|
||||
|
||||
void setMyAvatar(AvatarData* myAvatar) { _myAvatar = myAvatar; }
|
||||
|
||||
signals:
|
||||
void deletingEntity(const EntityItemID& entityID);
|
||||
void deletingEntityPointer(EntityItem* entityID);
|
||||
|
@ -383,6 +385,8 @@ private:
|
|||
void sendChallengeOwnershipPacket(const QString& certID, const QString& ownerKey, const EntityItemID& entityItemID, const SharedNodePointer& senderNode);
|
||||
void sendChallengeOwnershipRequestPacket(const QByteArray& certID, const QByteArray& encryptedText, const QByteArray& nodeToChallenge, const SharedNodePointer& senderNode);
|
||||
void validatePop(const QString& certID, const EntityItemID& entityItemID, const SharedNodePointer& senderNode, bool isRetryingValidation);
|
||||
|
||||
AvatarData* _myAvatar{ nullptr };
|
||||
};
|
||||
|
||||
#endif // hifi_EntityTree_h
|
||||
|
|
|
@ -30,7 +30,7 @@ PacketVersion versionForPacketType(PacketType packetType) {
|
|||
case PacketType::EntityEdit:
|
||||
case PacketType::EntityData:
|
||||
case PacketType::EntityPhysics:
|
||||
return static_cast<PacketVersion>(EntityVersion::ParentJointName);
|
||||
return static_cast<PacketVersion>(EntityVersion::HazeEffect);
|
||||
|
||||
case PacketType::EntityQuery:
|
||||
return static_cast<PacketVersion>(EntityQueryPacketVersion::JSONFilterWithFamilyTree);
|
||||
|
|
|
@ -199,8 +199,7 @@ QDebug operator<<(QDebug debug, const PacketType& type);
|
|||
enum class EntityVersion : PacketVersion {
|
||||
StrokeColorProperty = 77,
|
||||
HasDynamicOwnershipTests,
|
||||
HazeEffect,
|
||||
ParentJointName
|
||||
HazeEffect
|
||||
};
|
||||
|
||||
enum class EntityScriptCallMethodVersion : PacketVersion {
|
||||
|
|
|
@ -77,18 +77,6 @@ void SpatiallyNestable::setParentID(const QUuid& parentID) {
|
|||
getParentPointer(success);
|
||||
}
|
||||
|
||||
quint16 SpatiallyNestable::getParentJointIndex() const {
|
||||
if (_parentJointName.isEmpty()) {
|
||||
return _parentJointIndex;
|
||||
}
|
||||
bool success = false;
|
||||
SpatiallyNestablePointer parent = getParentPointer(success);
|
||||
if (success && parent) {
|
||||
return parent->getJointIndex(_parentJointName);
|
||||
}
|
||||
return _parentJointIndex;
|
||||
}
|
||||
|
||||
Transform SpatiallyNestable::getParentTransform(bool& success, int depth) const {
|
||||
Transform result;
|
||||
SpatiallyNestablePointer parent = getParentPointer(success);
|
||||
|
@ -96,7 +84,7 @@ Transform SpatiallyNestable::getParentTransform(bool& success, int depth) const
|
|||
return result;
|
||||
}
|
||||
if (parent) {
|
||||
result = parent->getTransform(getParentJointIndex(), success, depth + 1);
|
||||
result = parent->getTransform(_parentJointIndex, success, depth + 1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -175,14 +163,6 @@ void SpatiallyNestable::setParentJointIndex(quint16 parentJointIndex) {
|
|||
_parentJointIndex = parentJointIndex;
|
||||
}
|
||||
|
||||
void SpatiallyNestable::setParentJointName(const QString& parentJointName) {
|
||||
_parentJointName = parentJointName;
|
||||
}
|
||||
|
||||
QString SpatiallyNestable::getParentJointName() const {
|
||||
return _parentJointName;
|
||||
}
|
||||
|
||||
glm::vec3 SpatiallyNestable::worldToLocal(const glm::vec3& position,
|
||||
const QUuid& parentID, int parentJointIndex,
|
||||
bool& success) {
|
||||
|
|
|
@ -47,12 +47,9 @@ public:
|
|||
virtual const QUuid getParentID() const;
|
||||
virtual void setParentID(const QUuid& parentID);
|
||||
|
||||
virtual quint16 getParentJointIndex() const;
|
||||
virtual quint16 getParentJointIndex() const { return _parentJointIndex; }
|
||||
virtual void setParentJointIndex(quint16 parentJointIndex);
|
||||
|
||||
virtual QString getParentJointName() const;
|
||||
virtual void setParentJointName(const QString& parentJointName);
|
||||
|
||||
static glm::vec3 worldToLocal(const glm::vec3& position, const QUuid& parentID, int parentJointIndex, bool& success);
|
||||
static glm::quat worldToLocal(const glm::quat& orientation, const QUuid& parentID, int parentJointIndex, bool& success);
|
||||
static glm::vec3 worldToLocalVelocity(const glm::vec3& velocity, const QUuid& parentID,
|
||||
|
@ -165,9 +162,6 @@ public:
|
|||
virtual bool setLocalJointRotation(int index, const glm::quat& rotation) { return false; }
|
||||
virtual bool setLocalJointTranslation(int index, const glm::vec3& translation) { return false; }
|
||||
|
||||
virtual int getJointIndex(const QString& jointName) const { return -1; }
|
||||
virtual QString getJointName(int jointIndex) const { return ""; }
|
||||
|
||||
SpatiallyNestablePointer getThisPointer() const;
|
||||
|
||||
using ChildLambda = std::function<void(const SpatiallyNestablePointer&)>;
|
||||
|
@ -230,7 +224,6 @@ protected:
|
|||
private:
|
||||
QUuid _parentID; // what is this thing's transform relative to?
|
||||
quint16 _parentJointIndex { INVALID_JOINT_INDEX }; // which joint of the parent is this relative to?
|
||||
QString _parentJointName;
|
||||
|
||||
mutable ReadWriteLockable _transformLock;
|
||||
mutable ReadWriteLockable _idLock;
|
||||
|
|
Loading…
Reference in a new issue