mirror of
https://github.com/overte-org/overte.git
synced 2025-08-05 16:10:11 +02:00
Sum of blendshapes is used for recording
This commit is contained in:
parent
1b855f2c6b
commit
21f9594f81
1 changed files with 9 additions and 7 deletions
|
@ -132,15 +132,17 @@ QJsonObject HeadData::toJson() const {
|
||||||
QJsonObject blendshapesJson;
|
QJsonObject blendshapesJson;
|
||||||
for (auto name : blendshapeLookupMap.keys()) {
|
for (auto name : blendshapeLookupMap.keys()) {
|
||||||
auto index = blendshapeLookupMap[name];
|
auto index = blendshapeLookupMap[name];
|
||||||
if (index >= _blendshapeCoefficients.size()) {
|
float value = 0.0f;
|
||||||
continue;
|
if (index < _blendshapeCoefficients.size()) {
|
||||||
|
value += _blendshapeCoefficients[index];
|
||||||
}
|
}
|
||||||
auto value = _blendshapeCoefficients[index];
|
if (index < _transientBlendshapeCoefficients.size()) {
|
||||||
if (value == 0.0f) {
|
value += _transientBlendshapeCoefficients[index];
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
if (value != 0.0f) {
|
||||||
blendshapesJson[name] = value;
|
blendshapesJson[name] = value;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!blendshapesJson.isEmpty()) {
|
if (!blendshapesJson.isEmpty()) {
|
||||||
headJson[JSON_AVATAR_HEAD_BLENDSHAPE_COEFFICIENTS] = blendshapesJson;
|
headJson[JSON_AVATAR_HEAD_BLENDSHAPE_COEFFICIENTS] = blendshapesJson;
|
||||||
}
|
}
|
||||||
|
@ -164,8 +166,8 @@ void HeadData::fromJson(const QJsonObject& json) {
|
||||||
QJsonArray blendshapeCoefficientsJson = jsonValue.toArray();
|
QJsonArray blendshapeCoefficientsJson = jsonValue.toArray();
|
||||||
for (const auto& blendshapeCoefficient : blendshapeCoefficientsJson) {
|
for (const auto& blendshapeCoefficient : blendshapeCoefficientsJson) {
|
||||||
blendshapeCoefficients.push_back((float)blendshapeCoefficient.toDouble());
|
blendshapeCoefficients.push_back((float)blendshapeCoefficient.toDouble());
|
||||||
setBlendshapeCoefficients(blendshapeCoefficients);
|
|
||||||
}
|
}
|
||||||
|
setBlendshapeCoefficients(blendshapeCoefficients);
|
||||||
} else if (jsonValue.isObject()) {
|
} else if (jsonValue.isObject()) {
|
||||||
QJsonObject blendshapeCoefficientsJson = jsonValue.toObject();
|
QJsonObject blendshapeCoefficientsJson = jsonValue.toObject();
|
||||||
for (const QString& name : blendshapeCoefficientsJson.keys()) {
|
for (const QString& name : blendshapeCoefficientsJson.keys()) {
|
||||||
|
|
Loading…
Reference in a new issue