Skip to content

Commit f99835b

Browse files
committed
+ Add correct angle value conversion (for Rotation Z axis)
1 parent 61152a8 commit f99835b

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

W3MayaAnimUtil/W3MayaAnimUtil.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,7 @@ bool W3MayaAnimUtil::applyMotionToBone(QJsonValueRef ref) {
244244
QVector<int> framePoints;
245245
framePoints.append(1);
246246
upn(i, 0, deltaTimes.size() - 1) {
247-
int delta = static_cast<uint8_t>(deltaTimes[i]);
248-
if (delta <= 0) {
249-
addLog(QString("!!!!!! NEGATIVE! [%1] = %2, dtimes = %3").arg(i).arg(delta).arg(QString(deltaTimes)) );
250-
}
251-
framePoints.append( framePoints.back() + delta );
247+
framePoints.append( framePoints.back() + static_cast<uint8_t>(deltaTimes[i]) );
252248
}
253249

254250
QVector<double> motionX, motionY, motionZ, motionRotZ;
@@ -293,7 +289,7 @@ bool W3MayaAnimUtil::applyMotionToBone(QJsonValueRef ref) {
293289
anyFlag = false;
294290
break;
295291
}
296-
motionRotZ.append( framesObj[i].toDouble() );
292+
motionRotZ.append( framesObj[i].toDouble() * 360.0 / mW3AngleKoefficient );
297293
++i;
298294
}
299295
}
@@ -471,7 +467,7 @@ bool W3MayaAnimUtil::extractMotionFromBone(QJsonValueRef ref) {
471467
motionZ.append( posArray[frame].toObject().value("z").toDouble() );
472468
}
473469
upn(frame, 0, rotFrames - 1) {
474-
motionRotZ.append( rotArray[frame].toObject().value("Z").toDouble() );
470+
motionRotZ.append( rotArray[frame].toObject().value("Z").toDouble() * mW3AngleKoefficient / 360.0 );
475471
}
476472

477473
if (rotFrames == 1) {

W3MayaAnimUtil/W3MayaAnimUtil.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class W3MayaAnimUtil : public QMainWindow
3737
const double mFps = 30.0;
3838
const int mBoneIndex = 94;
3939
const double mReductionSensitivity = 1e-4; // 10^-4
40+
const double mW3AngleKoefficient = 8.07; // picked up experimentally, real value is in [8.05 - 8.10]
4041
bool animSet;
4142
bool hasChanges = false;
4243
QFile jsonFile;

W3MayaAnimUtil_windows_x64.zip

-138 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)