mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-07 04:53:28 +02:00
Merge pull request #14004 from hyperlogic/feature/anim-stat-improvements
Small Improvements to Anim Stats
This commit is contained in:
commit
d520152a95
5 changed files with 87 additions and 29 deletions
|
@ -48,35 +48,11 @@ Item {
|
|||
spacing: 4; x: 4; y: 4;
|
||||
|
||||
StatText {
|
||||
text: "State Machines:---------------------------------------------------------------------------"
|
||||
text: root.positionText
|
||||
}
|
||||
ListView {
|
||||
width: firstCol.width
|
||||
height: root.animStateMachines.length * 15
|
||||
visible: root.animStateMchines.length > 0;
|
||||
model: root.animStateMachines
|
||||
delegate: StatText {
|
||||
text: {
|
||||
return modelData;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: secondCol.width + 8
|
||||
height: secondCol.height + 8
|
||||
color: root.bgColor;
|
||||
|
||||
Column {
|
||||
id: secondCol
|
||||
spacing: 4; x: 4; y: 4;
|
||||
|
||||
StatText {
|
||||
text: "Anim Vars:--------------------------------------------------------------------------------"
|
||||
}
|
||||
|
||||
ListView {
|
||||
width: secondCol.width
|
||||
height: root.animVars.length * 15
|
||||
|
@ -104,6 +80,36 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: secondCol.width + 8
|
||||
height: secondCol.height + 8
|
||||
color: root.bgColor;
|
||||
|
||||
Column {
|
||||
id: secondCol
|
||||
spacing: 4; x: 4; y: 4;
|
||||
|
||||
StatText {
|
||||
text: root.rotationText
|
||||
}
|
||||
StatText {
|
||||
text: "State Machines:---------------------------------------------------------------------------"
|
||||
}
|
||||
ListView {
|
||||
width: firstCol.width
|
||||
height: root.animStateMachines.length * 15
|
||||
visible: root.animStateMachines.length > 0;
|
||||
model: root.animStateMachines
|
||||
delegate: StatText {
|
||||
text: {
|
||||
return modelData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: thirdCol.width + 8
|
||||
height: thirdCol.height + 8
|
||||
|
@ -113,10 +119,12 @@ Item {
|
|||
id: thirdCol
|
||||
spacing: 4; x: 4; y: 4;
|
||||
|
||||
StatText {
|
||||
text: root.velocityText
|
||||
}
|
||||
StatText {
|
||||
text: "Alpha Values:--------------------------------------------------------------------------"
|
||||
}
|
||||
|
||||
ListView {
|
||||
width: thirdCol.width
|
||||
height: root.animAlphaValues.length * 15
|
||||
|
|
|
@ -42,6 +42,29 @@ void AnimStats::updateStats(bool force) {
|
|||
auto myAvatar = avatarManager->getMyAvatar();
|
||||
auto debugAlphaMap = myAvatar->getSkeletonModel()->getRig().getDebugAlphaMap();
|
||||
|
||||
glm::vec3 position = myAvatar->getWorldPosition();
|
||||
glm::quat rotation = myAvatar->getWorldOrientation();
|
||||
glm::vec3 velocity = myAvatar->getWorldVelocity();
|
||||
|
||||
_positionText = QString("Position: (%1, %2, %3)").
|
||||
arg(QString::number(position.x, 'f', 2)).
|
||||
arg(QString::number(position.y, 'f', 2)).
|
||||
arg(QString::number(position.z, 'f', 2));
|
||||
emit positionTextChanged();
|
||||
|
||||
glm::vec3 eulerRotation = safeEulerAngles(rotation);
|
||||
_rotationText = QString("Heading: %1").
|
||||
arg(QString::number(glm::degrees(eulerRotation.y), 'f', 2));
|
||||
emit rotationTextChanged();
|
||||
|
||||
// transform velocity into rig coordinate frame. z forward.
|
||||
glm::vec3 localVelocity = Quaternions::Y_180 * glm::inverse(rotation) * velocity;
|
||||
_velocityText = QString("Local Vel: (%1, %2, %3)").
|
||||
arg(QString::number(localVelocity.x, 'f', 2)).
|
||||
arg(QString::number(localVelocity.y, 'f', 2)).
|
||||
arg(QString::number(localVelocity.z, 'f', 2));
|
||||
emit velocityTextChanged();
|
||||
|
||||
// update animation debug alpha values
|
||||
QStringList newAnimAlphaValues;
|
||||
qint64 now = usecTimestampNow();
|
||||
|
|
|
@ -19,6 +19,9 @@ class AnimStats : public QQuickItem {
|
|||
Q_PROPERTY(QStringList animAlphaValues READ animAlphaValues NOTIFY animAlphaValuesChanged)
|
||||
Q_PROPERTY(QStringList animVars READ animVars NOTIFY animVarsChanged)
|
||||
Q_PROPERTY(QStringList animStateMachines READ animStateMachines NOTIFY animStateMachinesChanged)
|
||||
Q_PROPERTY(QString positionText READ positionText NOTIFY positionTextChanged)
|
||||
Q_PROPERTY(QString rotationText READ rotationText NOTIFY rotationTextChanged)
|
||||
Q_PROPERTY(QString velocityText READ velocityText NOTIFY velocityTextChanged)
|
||||
|
||||
public:
|
||||
static AnimStats* getInstance();
|
||||
|
@ -27,9 +30,13 @@ public:
|
|||
|
||||
void updateStats(bool force = false);
|
||||
|
||||
QStringList animAlphaValues() { return _animAlphaValues; }
|
||||
QStringList animVars() { return _animVarsList; }
|
||||
QStringList animStateMachines() { return _animStateMachines; }
|
||||
QStringList animAlphaValues() const { return _animAlphaValues; }
|
||||
QStringList animVars() const { return _animVarsList; }
|
||||
QStringList animStateMachines() const { return _animStateMachines; }
|
||||
|
||||
QString positionText() const { return _positionText; }
|
||||
QString rotationText() const { return _rotationText; }
|
||||
QString velocityText() const { return _velocityText; }
|
||||
|
||||
public slots:
|
||||
void forceUpdateStats() { updateStats(true); }
|
||||
|
@ -39,6 +46,9 @@ signals:
|
|||
void animAlphaValuesChanged();
|
||||
void animVarsChanged();
|
||||
void animStateMachinesChanged();
|
||||
void positionTextChanged();
|
||||
void rotationTextChanged();
|
||||
void velocityTextChanged();
|
||||
|
||||
private:
|
||||
QStringList _animAlphaValues;
|
||||
|
@ -50,6 +60,10 @@ private:
|
|||
std::map<QString, qint64> _animVarChangedTimers; // last time animVar value has changed.
|
||||
|
||||
QStringList _animStateMachines;
|
||||
|
||||
QString _positionText;
|
||||
QString _rotationText;
|
||||
QString _velocityText;
|
||||
};
|
||||
|
||||
#endif // hifi_AnimStats_h
|
||||
|
|
|
@ -88,6 +88,10 @@ const AnimPoseVec& AnimStateMachine::evaluate(const AnimVariantMap& animVars, co
|
|||
processOutputJoints(triggersOut);
|
||||
|
||||
context.addStateMachineInfo(_id, _currentState->getID(), _previousState->getID(), _duringInterp, _alpha);
|
||||
if (_duringInterp) {
|
||||
// hack: add previoius state to debug alpha map, with parens around it's name.
|
||||
context.setDebugAlpha(QString("(%1)").arg(_previousState->getID()), 1.0f - _alpha, AnimNodeType::Clip);
|
||||
}
|
||||
|
||||
return _poses;
|
||||
}
|
||||
|
|
|
@ -140,14 +140,19 @@ std::map<QString, QString> AnimVariantMap::toDebugMap() const {
|
|||
result[pair.first] = QString::number(pair.second.getFloat(), 'f', 3);
|
||||
break;
|
||||
case AnimVariant::Type::Vec3: {
|
||||
// To prevent filling up debug stats, don't show vec3 values
|
||||
/*
|
||||
glm::vec3 value = pair.second.getVec3();
|
||||
result[pair.first] = QString("(%1, %2, %3)").
|
||||
arg(QString::number(value.x, 'f', 3)).
|
||||
arg(QString::number(value.y, 'f', 3)).
|
||||
arg(QString::number(value.z, 'f', 3));
|
||||
*/
|
||||
break;
|
||||
}
|
||||
case AnimVariant::Type::Quat: {
|
||||
// To prevent filling up the anim stats, don't show quat values
|
||||
/*
|
||||
glm::quat value = pair.second.getQuat();
|
||||
result[pair.first] = QString("(%1, %2, %3, %4)").
|
||||
arg(QString::number(value.x, 'f', 3)).
|
||||
|
@ -155,10 +160,14 @@ std::map<QString, QString> AnimVariantMap::toDebugMap() const {
|
|||
arg(QString::number(value.z, 'f', 3)).
|
||||
arg(QString::number(value.w, 'f', 3));
|
||||
break;
|
||||
*/
|
||||
}
|
||||
case AnimVariant::Type::String:
|
||||
// To prevent filling up anim stats, don't show string values
|
||||
/*
|
||||
result[pair.first] = pair.second.getString();
|
||||
break;
|
||||
*/
|
||||
default:
|
||||
assert(("invalid AnimVariant::Type", false));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue