Check that the user configures a skeleton root joint

Instead of just checking that the model has a "Hips" joint.
This commit is contained in:
David Rowe 2015-03-10 20:27:31 -07:00
parent e57d63b20e
commit 3d11dde8ad

View file

@ -178,11 +178,22 @@ bool ModelUploader::zip() {
QByteArray fbxContents = fbx.readAll(); QByteArray fbxContents = fbx.readAll();
FBXGeometry geometry = readFBX(fbxContents, QVariantHash()); FBXGeometry geometry = readFBX(fbxContents, QVariantHash());
// Make sure that a skeleton model has a skeleton // make sure we have some basic mappings
if (_modelType == SKELETON_MODEL && !geometry.getJointNames().contains("Hips")) { populateBasicMapping(mapping, filename, geometry);
qDebug() << QString("[Warning] %1 does not contain a skeleton.").arg(filename);
// open the dialog to configure the rest
ModelPropertiesDialog properties(_modelType, mapping, basePath, geometry);
if (properties.exec() == QDialog::Rejected) {
return false;
}
mapping = properties.getMapping();
QString message = "Your selected skeleton model has no skeleton.\n\nThe upload will be canceled."; // Make sure that a mapping for the root joint has been specified
QVariantHash joints = mapping.value(JOINT_FIELD).toHash();
if (!joints.contains("jointRoot")) {
qDebug() << QString("[Warning] %1 root joint not configured for skeleton.").arg(filename);
QString message = "Your did not configure a root joint for your skeleton model.\n\nThe upload will be canceled.";
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setWindowTitle("Model Upload"); msgBox.setWindowTitle("Model Upload");
msgBox.setText(message); msgBox.setText(message);
@ -193,16 +204,6 @@ bool ModelUploader::zip() {
return false; return false;
} }
// make sure we have some basic mappings
populateBasicMapping(mapping, filename, geometry);
// open the dialog to configure the rest
ModelPropertiesDialog properties(_modelType, mapping, basePath, geometry);
if (properties.exec() == QDialog::Rejected) {
return false;
}
mapping = properties.getMapping();
QByteArray nameField = mapping.value(NAME_FIELD).toByteArray(); QByteArray nameField = mapping.value(NAME_FIELD).toByteArray();
QString urlBase; QString urlBase;
if (!nameField.isEmpty()) { if (!nameField.isEmpty()) {