review comment

This commit is contained in:
HifiExperiments 2020-01-13 17:44:32 -08:00
parent b40a468b4c
commit c45ee33e97
5 changed files with 11 additions and 11 deletions

View file

@ -102,8 +102,8 @@ const QVector<float>& HeadData::getSummedBlendshapeCoefficients() {
void HeadData::setBlendshape(QString name, float val) {
// Check to see if the named blendshape exists, and then set its value if it does
auto it = blendshapeLookupMap.find(name);
if (it != blendshapeLookupMap.end()) {
auto it = BLENDSHAPE_LOOKUP_MAP.find(name);
if (it != BLENDSHAPE_LOOKUP_MAP.end()) {
if (_blendshapeCoefficients.size() <= it.value()) {
_blendshapeCoefficients.resize(it.value() + 1);
}
@ -128,8 +128,8 @@ void HeadData::setBlendshape(QString name, float val) {
}
int HeadData::getBlendshapeIndex(const QString& name) {
auto it = blendshapeLookupMap.find(name);
int index = it != blendshapeLookupMap.end() ? it.value() : -1;
auto it = BLENDSHAPE_LOOKUP_MAP.find(name);
int index = it != BLENDSHAPE_LOOKUP_MAP.end() ? it.value() : -1;
return index;
}
@ -148,8 +148,8 @@ static const QString JSON_AVATAR_HEAD_LOOKAT = QStringLiteral("lookAt");
QJsonObject HeadData::toJson() const {
QJsonObject headJson;
QJsonObject blendshapesJson;
for (auto name : blendshapeLookupMap.keys()) {
auto index = blendshapeLookupMap[name];
for (auto name : BLENDSHAPE_LOOKUP_MAP.keys()) {
auto index = BLENDSHAPE_LOOKUP_MAP[name];
float value = 0.0f;
if (index < _blendshapeCoefficients.size()) {
value += _blendshapeCoefficients[index];

View file

@ -769,8 +769,8 @@ void ModelEntityItem::setBlendshapeCoefficients(const QString& blendshapeCoeffic
withWriteLock([&] {
for (auto& blendshape : newCoefficientsMap.keys()) {
auto newCoefficient = newCoefficientsMap[blendshape];
auto blendshapeIter = blendshapeLookupMap.find(blendshape);
if (newCoefficient.canConvert<float>() && blendshapeIter != blendshapeLookupMap.end()) {
auto blendshapeIter = BLENDSHAPE_LOOKUP_MAP.find(blendshape);
if (newCoefficient.canConvert<float>() && blendshapeIter != BLENDSHAPE_LOOKUP_MAP.end()) {
float newCoefficientValue = newCoefficient.toFloat();
_blendshapeCoefficientsVector[blendshapeIter.value()] = newCoefficientValue;
_blendshapeCoefficientsMap[blendshape] = newCoefficientValue;

View file

@ -77,7 +77,7 @@ const char* FACESHIFT_BLENDSHAPES[] = {
""
};
QMap<QString, int> blendshapeLookupMap = [] {
const QMap<QString, int> BLENDSHAPE_LOOKUP_MAP = [] {
QMap<QString, int> toReturn;
for (int i = 0; i < (int)Blendshapes::BlendshapeCount; i++) {
toReturn[FACESHIFT_BLENDSHAPES[i]] = i;

View file

@ -19,7 +19,7 @@
/// The names of the blendshapes expected by Faceshift, terminated with an empty string.
extern const char* FACESHIFT_BLENDSHAPES[];
extern QMap<QString, int> blendshapeLookupMap;
extern const QMap<QString, int> BLENDSHAPE_LOOKUP_MAP;
enum class Blendshapes : int {
EyeBlink_L = 0,

View file

@ -113,7 +113,7 @@ private:
}
struct _HeadHelper : public HeadData {
QMap<QString,int> getBlendshapeMap() const {
return blendshapeLookupMap;
return BLENDSHAPE_LOOKUP_MAP;
}
struct States { QVector<float> base, summed, transient; };
States getBlendshapeStates() const {