Merge branch 'vircadia:master' into tell-accountmanager-url-changed

This commit is contained in:
ksuprynowicz 2022-01-18 21:36:50 +01:00 committed by GitHub
commit bf48bf01c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 14 deletions

View file

@ -298,7 +298,7 @@ void ModelPackager::populateBasicMapping(QVariantHash& mapping, QString filename
// If there are no blendshape mappings, and we detect that this is likely a mixamo file, // If there are no blendshape mappings, and we detect that this is likely a mixamo file,
// then we can add the default mixamo to blendshape mappings. // then we can add the default mixamo to blendshape mappings.
if (!mapping.contains(BLENDSHAPE_FIELD) && likelyMixamoFile) { if (!mapping.contains(BLENDSHAPE_FIELD) && likelyMixamoFile) {
QVariantHash blendshapes; hifi::VariantMultiHash blendshapes;
blendshapes.insert("BrowsD_L", QVariantList() << "BrowsDown_Left" << 1.0); blendshapes.insert("BrowsD_L", QVariantList() << "BrowsDown_Left" << 1.0);
blendshapes.insert("BrowsD_R", QVariantList() << "BrowsDown_Right" << 1.0); blendshapes.insert("BrowsD_R", QVariantList() << "BrowsDown_Right" << 1.0);
blendshapes.insert("BrowsU_C", QVariantList() << "BrowsUp_Left" << 1.0); blendshapes.insert("BrowsU_C", QVariantList() << "BrowsUp_Left" << 1.0);

View file

@ -86,7 +86,7 @@ FST* FST::createFSTFromModel(const QString& fstPath, const QString& modelFilePat
// If there are no blendshape mappings, and we detect that this is likely a mixamo file, // If there are no blendshape mappings, and we detect that this is likely a mixamo file,
// then we can add the default mixamo to blendshape mappings. // then we can add the default mixamo to blendshape mappings.
if (likelyMixamoFile) { if (likelyMixamoFile) {
QVariantHash blendshapes; hifi::VariantMultiHash blendshapes;
blendshapes.insert("BrowsD_L", QVariantList() << "BrowsDown_Left" << 1.0); blendshapes.insert("BrowsD_L", QVariantList() << "BrowsDown_Left" << 1.0);
blendshapes.insert("BrowsD_R", QVariantList() << "BrowsDown_Right" << 1.0); blendshapes.insert("BrowsD_R", QVariantList() << "BrowsDown_Right" << 1.0);
blendshapes.insert("BrowsU_C", QVariantList() << "BrowsUp_Left" << 1.0); blendshapes.insert("BrowsU_C", QVariantList() << "BrowsUp_Left" << 1.0);

View file

@ -20,8 +20,8 @@
#include <NetworkingConstants.h> #include <NetworkingConstants.h>
#include <SharedUtil.h> #include <SharedUtil.h>
QVariantHash FSTReader::parseMapping(QIODevice* device) { hifi::VariantMultiHash FSTReader::parseMapping(QIODevice* device) {
QVariantHash properties; hifi::VariantMultiHash properties;
QByteArray line; QByteArray line;
while (!(line = device->readLine()).isEmpty()) { while (!(line = device->readLine()).isEmpty()) {
@ -76,7 +76,7 @@ static void splitBlendshapes(hifi::VariantMultiHash& bs, const QString& key, con
} }
// convert legacy blendshapes to arkit blendshapes // convert legacy blendshapes to arkit blendshapes
static void fixUpLegacyBlendshapes(QVariantHash & properties) { static void fixUpLegacyBlendshapes(hifi::VariantMultiHash & properties) {
hifi::VariantMultiHash bs = properties.value("bs").toHash(); hifi::VariantMultiHash bs = properties.value("bs").toHash();
// These blendshapes have no ARKit equivalent, so we remove them. // These blendshapes have no ARKit equivalent, so we remove them.
@ -95,10 +95,10 @@ static void fixUpLegacyBlendshapes(QVariantHash & properties) {
properties.insert("bs", bs); properties.insert("bs", bs);
} }
QVariantHash FSTReader::readMapping(const QByteArray& data) { hifi::VariantMultiHash FSTReader::readMapping(const QByteArray& data) {
QBuffer buffer(const_cast<QByteArray*>(&data)); QBuffer buffer(const_cast<QByteArray*>(&data));
buffer.open(QIODevice::ReadOnly); buffer.open(QIODevice::ReadOnly);
QVariantHash mapping = FSTReader::parseMapping(&buffer); hifi::VariantMultiHash mapping = FSTReader::parseMapping(&buffer);
fixUpLegacyBlendshapes(mapping); fixUpLegacyBlendshapes(mapping);
return mapping; return mapping;
} }
@ -182,17 +182,17 @@ FSTReader::ModelType FSTReader::getTypeFromName(const QString& name) {
return _namesToTypes[name]; return _namesToTypes[name];
} }
FSTReader::ModelType FSTReader::predictModelType(const QVariantHash& mapping) { FSTReader::ModelType FSTReader::predictModelType(const hifi::VariantMultiHash& mapping) {
QVariantHash joints; QVariantHash joints;
if (mapping.contains("joint") && mapping["joint"].type() == QVariant::Hash) { if (mapping.contains("joint") && mapping.value("joint").type() == QVariant::Hash) {
joints = mapping["joint"].toHash(); joints = mapping.value("joint").toHash();
} }
// if the mapping includes the type hint... then we trust the mapping // if the mapping includes the type hint... then we trust the mapping
if (mapping.contains(TYPE_FIELD)) { if (mapping.contains(TYPE_FIELD)) {
return FSTReader::getTypeFromName(mapping[TYPE_FIELD].toString()); return FSTReader::getTypeFromName(mapping.value(TYPE_FIELD).toString());
} }
// check for blendshapes // check for blendshapes

View file

@ -48,13 +48,13 @@ public:
}; };
/// Reads an FST mapping from the supplied data. /// Reads an FST mapping from the supplied data.
static QVariantHash readMapping(const QByteArray& data); static hifi::VariantMultiHash readMapping(const QByteArray& data);
/// Writes an FST mapping to a byte array. /// Writes an FST mapping to a byte array.
static QByteArray writeMapping(const hifi::VariantMultiHash& mapping); static QByteArray writeMapping(const hifi::VariantMultiHash& mapping);
/// Predicts the type of model by examining the mapping /// Predicts the type of model by examining the mapping
static ModelType predictModelType(const QVariantHash& mapping); static ModelType predictModelType(const hifi::VariantMultiHash& mapping);
static QVector<QString> getScripts(const QUrl& fstUrl, const hifi::VariantMultiHash& mapping = QVariantHash()); static QVector<QString> getScripts(const QUrl& fstUrl, const hifi::VariantMultiHash& mapping = QVariantHash());
@ -64,7 +64,7 @@ public:
private: private:
static void writeVariant(QBuffer& buffer, QVariantHash::const_iterator& it); static void writeVariant(QBuffer& buffer, QVariantHash::const_iterator& it);
static QVariantHash parseMapping(QIODevice* device); static hifi::VariantMultiHash parseMapping(QIODevice* device);
static QHash<FSTReader::ModelType, QString> _typesToNames; static QHash<FSTReader::ModelType, QString> _typesToNames;
static QHash<QString, FSTReader::ModelType> _namesToTypes; static QHash<QString, FSTReader::ModelType> _namesToTypes;