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