mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
MyAvatar.setAvatarEntityData() works
This commit is contained in:
parent
cbda905e3b
commit
a4be4fb6c0
7 changed files with 21 additions and 19 deletions
assignment-client/src/avatars
interface/src/avatar
libraries
|
@ -252,7 +252,8 @@ void ScriptableAvatar::setHasAudioEnabledFaceMovement(bool hasAudioEnabledFaceMo
|
|||
_headData->setHasAudioEnabledFaceMovement(hasAudioEnabledFaceMovement);
|
||||
}
|
||||
|
||||
void ScriptableAvatar::updateAvatarEntity(const QUuid& id, const QScriptValue& data) {
|
||||
void ScriptableAvatar::updateAvatarEntity(const QUuid& id, const QByteArray& data) {
|
||||
/* TODO: fix this
|
||||
if (data.isNull()) {
|
||||
// interpret this as a DELETE
|
||||
std::map<QUuid, EntityItemPointer>::iterator itr = _entities.find(id);
|
||||
|
@ -299,4 +300,5 @@ void ScriptableAvatar::updateAvatarEntity(const QUuid& id, const QScriptValue& d
|
|||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -185,7 +185,7 @@ public:
|
|||
bool getHasProceduralEyeFaceMovement() const override { return _headData->getHasProceduralEyeFaceMovement(); }
|
||||
void setHasAudioEnabledFaceMovement(bool hasAudioEnabledFaceMovement);
|
||||
bool getHasAudioEnabledFaceMovement() const override { return _headData->getHasAudioEnabledFaceMovement(); }
|
||||
void updateAvatarEntity(const QUuid& id, const QScriptValue& data) override;
|
||||
void updateAvatarEntity(const QUuid& id, const QByteArray& data) override;
|
||||
|
||||
public slots:
|
||||
void update(float deltatime);
|
||||
|
|
|
@ -1772,16 +1772,23 @@ void MyAvatar::setAvatarEntityData(const AvatarEntityMap& avatarEntityData) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!avatarEntityData.empty() && !_cachedAvatarEntityBlobs.empty()) {
|
||||
_needToSaveAvatarEntitySettings = true;
|
||||
}
|
||||
_avatarEntitiesLock.withWriteLock([&] {
|
||||
// find new and updated IDs
|
||||
AvatarEntityMap::const_iterator constItr = avatarEntityData.begin();
|
||||
std::vector<QUuid> blobsToCache;
|
||||
blobsToCache.reserve(avatarEntityData.size());
|
||||
while (constItr != avatarEntityData.end()) {
|
||||
QUuid id = constItr.key();
|
||||
if (_cachedAvatarEntityBlobs.find(id) == _cachedAvatarEntityBlobs.end()) {
|
||||
_entitiesToAdd.push_back(id);
|
||||
blobsToCache.push_back(id);
|
||||
} else {
|
||||
_entitiesToUpdate.push_back(id);
|
||||
}
|
||||
++constItr;
|
||||
}
|
||||
// find and erase deleted IDs from _cachedAvatarEntityBlobs
|
||||
std::vector<QUuid> deletedIDs;
|
||||
|
@ -1795,6 +1802,12 @@ void MyAvatar::setAvatarEntityData(const AvatarEntityMap& avatarEntityData) {
|
|||
++itr;
|
||||
}
|
||||
}
|
||||
// now that we've 'deleted' unknown ids, copy over the new ones
|
||||
constItr = avatarEntityData.begin();
|
||||
while (constItr != avatarEntityData.end()) {
|
||||
_cachedAvatarEntityBlobs.insert(constItr.key(), constItr.value());
|
||||
++constItr;
|
||||
}
|
||||
// erase deleted IDs from _packedAvatarEntityData
|
||||
for (const auto& id : deletedIDs) {
|
||||
itr = _packedAvatarEntityData.find(id);
|
||||
|
@ -2296,10 +2309,6 @@ void MyAvatar::clearJointsData() {
|
|||
_skeletonModel->getRig().clearJointStates();
|
||||
}
|
||||
|
||||
void MyAvatar::updateAvatarEntity(const QUuid& id, const QScriptValue& data) {
|
||||
// TODO: implement this
|
||||
}
|
||||
|
||||
void MyAvatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
|
||||
_skeletonModelChangeCount++;
|
||||
int skeletonModelChangeCount = _skeletonModelChangeCount;
|
||||
|
|
|
@ -851,8 +851,6 @@ public:
|
|||
virtual void clearJointData(const QString& name) override;
|
||||
virtual void clearJointsData() override;
|
||||
|
||||
void updateAvatarEntity(const QUuid& id, const QScriptValue& data) override;
|
||||
|
||||
/**jsdoc
|
||||
* @function MyAvatar.pinJoint
|
||||
* @param {number} index
|
||||
|
|
|
@ -235,8 +235,6 @@ public:
|
|||
void updateDisplayNameAlpha(bool showDisplayName);
|
||||
virtual void setSessionDisplayName(const QString& sessionDisplayName) override { }; // no-op
|
||||
|
||||
virtual void updateAvatarEntity(const QUuid& entityID, const QScriptValue& entityData) override { }; // no-op
|
||||
|
||||
virtual int parseDataFromBuffer(const QByteArray& buffer) override;
|
||||
|
||||
static void renderJointConnectingCone(gpu::Batch& batch, glm::vec3 position1, glm::vec3 position2,
|
||||
|
|
|
@ -2561,7 +2561,7 @@ void AvatarData::fromJson(const QJsonObject& json, bool useFrameSkeleton) {
|
|||
QVariantMap entityData = attachmentJson.toObject().toVariantMap();
|
||||
QUuid id = entityData.value("id").toUuid();
|
||||
QByteArray data = QByteArray::fromBase64(entityData.value("properties").toByteArray());
|
||||
updateAvatarEntityData(id, data);
|
||||
updateAvatarEntity(id, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2764,11 +2764,7 @@ void AvatarData::storeAvatarEntityDataPayload(const QUuid& entityID, const QByte
|
|||
}
|
||||
}
|
||||
|
||||
void AvatarData::updateAvatarEntity(const QUuid& id, const QScriptValue& scriptValue) {
|
||||
// overridden where needed
|
||||
}
|
||||
|
||||
void AvatarData::updateAvatarEntityData(const QUuid& id, const QByteArray& data) {
|
||||
void AvatarData::updateAvatarEntity(const QUuid& entityID, const QByteArray& entityData) {
|
||||
// overridden where needed
|
||||
// NOTE: expects 'data' to be an unfortunately-formatted-binary-blob
|
||||
}
|
||||
|
|
|
@ -960,10 +960,9 @@ public:
|
|||
/**jsdoc
|
||||
* @function MyAvatar.updateAvatarEntity
|
||||
* @param {Uuid} entityID
|
||||
* @param {object} entityData
|
||||
* @param {string} entityData
|
||||
*/
|
||||
Q_INVOKABLE virtual void updateAvatarEntity(const QUuid& id, const QScriptValue& scriptValue);
|
||||
virtual void updateAvatarEntityData(const QUuid& id, const QByteArray& data);
|
||||
Q_INVOKABLE virtual void updateAvatarEntity(const QUuid& entityID, const QByteArray& entityData);
|
||||
|
||||
/**jsdoc
|
||||
* @function MyAvatar.clearAvatarEntity
|
||||
|
|
Loading…
Reference in a new issue