mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 07:47:30 +02:00
review comment
This commit is contained in:
parent
b40a468b4c
commit
c45ee33e97
5 changed files with 11 additions and 11 deletions
|
@ -102,8 +102,8 @@ const QVector<float>& HeadData::getSummedBlendshapeCoefficients() {
|
||||||
void HeadData::setBlendshape(QString name, float val) {
|
void HeadData::setBlendshape(QString name, float val) {
|
||||||
|
|
||||||
// Check to see if the named blendshape exists, and then set its value if it does
|
// Check to see if the named blendshape exists, and then set its value if it does
|
||||||
auto it = blendshapeLookupMap.find(name);
|
auto it = BLENDSHAPE_LOOKUP_MAP.find(name);
|
||||||
if (it != blendshapeLookupMap.end()) {
|
if (it != BLENDSHAPE_LOOKUP_MAP.end()) {
|
||||||
if (_blendshapeCoefficients.size() <= it.value()) {
|
if (_blendshapeCoefficients.size() <= it.value()) {
|
||||||
_blendshapeCoefficients.resize(it.value() + 1);
|
_blendshapeCoefficients.resize(it.value() + 1);
|
||||||
}
|
}
|
||||||
|
@ -128,8 +128,8 @@ void HeadData::setBlendshape(QString name, float val) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int HeadData::getBlendshapeIndex(const QString& name) {
|
int HeadData::getBlendshapeIndex(const QString& name) {
|
||||||
auto it = blendshapeLookupMap.find(name);
|
auto it = BLENDSHAPE_LOOKUP_MAP.find(name);
|
||||||
int index = it != blendshapeLookupMap.end() ? it.value() : -1;
|
int index = it != BLENDSHAPE_LOOKUP_MAP.end() ? it.value() : -1;
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,8 +148,8 @@ static const QString JSON_AVATAR_HEAD_LOOKAT = QStringLiteral("lookAt");
|
||||||
QJsonObject HeadData::toJson() const {
|
QJsonObject HeadData::toJson() const {
|
||||||
QJsonObject headJson;
|
QJsonObject headJson;
|
||||||
QJsonObject blendshapesJson;
|
QJsonObject blendshapesJson;
|
||||||
for (auto name : blendshapeLookupMap.keys()) {
|
for (auto name : BLENDSHAPE_LOOKUP_MAP.keys()) {
|
||||||
auto index = blendshapeLookupMap[name];
|
auto index = BLENDSHAPE_LOOKUP_MAP[name];
|
||||||
float value = 0.0f;
|
float value = 0.0f;
|
||||||
if (index < _blendshapeCoefficients.size()) {
|
if (index < _blendshapeCoefficients.size()) {
|
||||||
value += _blendshapeCoefficients[index];
|
value += _blendshapeCoefficients[index];
|
||||||
|
|
|
@ -769,8 +769,8 @@ void ModelEntityItem::setBlendshapeCoefficients(const QString& blendshapeCoeffic
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
for (auto& blendshape : newCoefficientsMap.keys()) {
|
for (auto& blendshape : newCoefficientsMap.keys()) {
|
||||||
auto newCoefficient = newCoefficientsMap[blendshape];
|
auto newCoefficient = newCoefficientsMap[blendshape];
|
||||||
auto blendshapeIter = blendshapeLookupMap.find(blendshape);
|
auto blendshapeIter = BLENDSHAPE_LOOKUP_MAP.find(blendshape);
|
||||||
if (newCoefficient.canConvert<float>() && blendshapeIter != blendshapeLookupMap.end()) {
|
if (newCoefficient.canConvert<float>() && blendshapeIter != BLENDSHAPE_LOOKUP_MAP.end()) {
|
||||||
float newCoefficientValue = newCoefficient.toFloat();
|
float newCoefficientValue = newCoefficient.toFloat();
|
||||||
_blendshapeCoefficientsVector[blendshapeIter.value()] = newCoefficientValue;
|
_blendshapeCoefficientsVector[blendshapeIter.value()] = newCoefficientValue;
|
||||||
_blendshapeCoefficientsMap[blendshape] = newCoefficientValue;
|
_blendshapeCoefficientsMap[blendshape] = newCoefficientValue;
|
||||||
|
|
|
@ -77,7 +77,7 @@ const char* FACESHIFT_BLENDSHAPES[] = {
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
|
|
||||||
QMap<QString, int> blendshapeLookupMap = [] {
|
const QMap<QString, int> BLENDSHAPE_LOOKUP_MAP = [] {
|
||||||
QMap<QString, int> toReturn;
|
QMap<QString, int> toReturn;
|
||||||
for (int i = 0; i < (int)Blendshapes::BlendshapeCount; i++) {
|
for (int i = 0; i < (int)Blendshapes::BlendshapeCount; i++) {
|
||||||
toReturn[FACESHIFT_BLENDSHAPES[i]] = i;
|
toReturn[FACESHIFT_BLENDSHAPES[i]] = i;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
/// The names of the blendshapes expected by Faceshift, terminated with an empty string.
|
/// The names of the blendshapes expected by Faceshift, terminated with an empty string.
|
||||||
extern const char* FACESHIFT_BLENDSHAPES[];
|
extern const char* FACESHIFT_BLENDSHAPES[];
|
||||||
extern QMap<QString, int> blendshapeLookupMap;
|
extern const QMap<QString, int> BLENDSHAPE_LOOKUP_MAP;
|
||||||
|
|
||||||
enum class Blendshapes : int {
|
enum class Blendshapes : int {
|
||||||
EyeBlink_L = 0,
|
EyeBlink_L = 0,
|
||||||
|
|
|
@ -113,7 +113,7 @@ private:
|
||||||
}
|
}
|
||||||
struct _HeadHelper : public HeadData {
|
struct _HeadHelper : public HeadData {
|
||||||
QMap<QString,int> getBlendshapeMap() const {
|
QMap<QString,int> getBlendshapeMap() const {
|
||||||
return blendshapeLookupMap;
|
return BLENDSHAPE_LOOKUP_MAP;
|
||||||
}
|
}
|
||||||
struct States { QVector<float> base, summed, transient; };
|
struct States { QVector<float> base, summed, transient; };
|
||||||
States getBlendshapeStates() const {
|
States getBlendshapeStates() const {
|
||||||
|
|
Loading…
Reference in a new issue