mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 20:11:13 +02:00
Keep attachments when playing back recordings
This commit is contained in:
parent
50cc68c63e
commit
c564119edc
1 changed files with 14 additions and 1 deletions
|
@ -2255,6 +2255,7 @@ static const QString JSON_AVATAR_HEAD_MODEL = QStringLiteral("headModel");
|
||||||
static const QString JSON_AVATAR_BODY_MODEL = QStringLiteral("bodyModel");
|
static const QString JSON_AVATAR_BODY_MODEL = QStringLiteral("bodyModel");
|
||||||
static const QString JSON_AVATAR_DISPLAY_NAME = QStringLiteral("displayName");
|
static const QString JSON_AVATAR_DISPLAY_NAME = QStringLiteral("displayName");
|
||||||
// It isn't meaningful to persist sessionDisplayName.
|
// It isn't meaningful to persist sessionDisplayName.
|
||||||
|
static const QString JSON_AVATAR_ATTACHMENTS = QStringLiteral("attachments");
|
||||||
static const QString JSON_AVATAR_ENTITIES = QStringLiteral("attachedEntities");
|
static const QString JSON_AVATAR_ENTITIES = QStringLiteral("attachedEntities");
|
||||||
static const QString JSON_AVATAR_SCALE = QStringLiteral("scale");
|
static const QString JSON_AVATAR_SCALE = QStringLiteral("scale");
|
||||||
static const QString JSON_AVATAR_VERSION = QStringLiteral("version");
|
static const QString JSON_AVATAR_VERSION = QStringLiteral("version");
|
||||||
|
@ -2302,7 +2303,6 @@ QJsonObject AvatarData::toJson() const {
|
||||||
if (!getDisplayName().isEmpty()) {
|
if (!getDisplayName().isEmpty()) {
|
||||||
root[JSON_AVATAR_DISPLAY_NAME] = getDisplayName();
|
root[JSON_AVATAR_DISPLAY_NAME] = getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
_avatarEntitiesLock.withReadLock([&] {
|
_avatarEntitiesLock.withReadLock([&] {
|
||||||
if (!_avatarEntityData.empty()) {
|
if (!_avatarEntityData.empty()) {
|
||||||
QJsonArray avatarEntityJson;
|
QJsonArray avatarEntityJson;
|
||||||
|
@ -2418,6 +2418,19 @@ void AvatarData::fromJson(const QJsonObject& json, bool useFrameSkeleton) {
|
||||||
setTargetScale((float)json[JSON_AVATAR_SCALE].toDouble());
|
setTargetScale((float)json[JSON_AVATAR_SCALE].toDouble());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVector<AttachmentData> attachments;
|
||||||
|
if (json.contains(JSON_AVATAR_ATTACHMENTS) && json[JSON_AVATAR_ATTACHMENTS].isArray()) {
|
||||||
|
QJsonArray attachmentsJson = json[JSON_AVATAR_ATTACHMENTS].toArray();
|
||||||
|
for (auto attachmentJson : attachmentsJson) {
|
||||||
|
AttachmentData attachment;
|
||||||
|
attachment.fromJson(attachmentJson.toObject());
|
||||||
|
attachments.push_back(attachment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (attachments != getAttachmentData()) {
|
||||||
|
setAttachmentData(attachments);
|
||||||
|
}
|
||||||
|
|
||||||
if (json.contains(JSON_AVATAR_JOINT_ARRAY)) {
|
if (json.contains(JSON_AVATAR_JOINT_ARRAY)) {
|
||||||
if (version == (int)JsonAvatarFrameVersion::JointRotationsInRelativeFrame) {
|
if (version == (int)JsonAvatarFrameVersion::JointRotationsInRelativeFrame) {
|
||||||
// because we don't have the full joint hierarchy skeleton of the model,
|
// because we don't have the full joint hierarchy skeleton of the model,
|
||||||
|
|
Loading…
Reference in a new issue