History

Merge remote-tracking branch 'upstream/master' into fb18302-deprecated-package-model

humbletim committed 7 years ago

Commit 21030fb2 parents 2cf633c ef3acae1046 files · +28471 −18165Browse files

Showing the changes to interface/src/ModelPackager.cpp (1 of 1046 files). Show all

Unified · Split

interface/src/ModelPackager.cpp+21−21
@@ -85,7 +85,7 @@ bool ModelPackager::loadModel() { · 84 unmodified lines
8585 qWarning() << QString("ModelPackager::loadModel(): Could not open FST file %1").arg(_modelFile.filePath());
8686 return false;
8787 }
88− qCDebug(interfaceapp) << "Reading FST file : " << _modelFile.filePath();
88+ qCDebug(interfaceapp) << "Reading FST file";
8989 _mapping = FSTReader::readMapping(fst.readAll());
9090 fst.close();
9191
@@ -101,19 +101,19 @@ bool ModelPackager::loadModel() { · 9 unmodified lines
101101 QString("ModelPackager::loadModel()"),
102102 QString("Could not open FBX file %1").arg(_fbxInfo.filePath()),
103103 QMessageBox::Ok);
104− qWarning() << QString("ModelPackager::loadModel(): Could not open FBX file %1").arg(_fbxInfo.filePath());
104+ qWarning() << "ModelPackager::loadModel(): Could not open FBX file";
105105 return false;
106106 }
107107 try {
108108 qCDebug(interfaceapp) << "Reading FBX file : " << _fbxInfo.filePath();
109109 QByteArray fbxContents = fbx.readAll();
110110
111− _geometry.reset(readFBX(fbxContents, QVariantHash(), _fbxInfo.filePath()));
111+ _hfmModel.reset(readFBX(fbxContents, QVariantHash(), _fbxInfo.filePath()));
112112
113113 // make sure we have some basic mappings
114− populateBasicMapping(_mapping, _fbxInfo.filePath(), *_geometry);
114+ populateBasicMapping(_mapping, _fbxInfo.filePath(), *_hfmModel);
115115 } catch (const QString& error) {
116− qCDebug(interfaceapp) << "Error reading " << _fbxInfo.filePath() << ": " << error;
116+ qCDebug(interfaceapp) << "Error reading: " << error;
117117 return false;
118118 }
119119 return true;
@@ -121,7 +121,7 @@ bool ModelPackager::loadModel() { · 1 unmodified line
121121
122122 bool ModelPackager::editProperties() {
123123 // open the dialog to configure the rest
124− ModelPropertiesDialog properties(_mapping, _modelFile.path(), *_geometry);
124+ ModelPropertiesDialog properties(_mapping, _modelFile.path(), *_hfmModel);
125125 if (properties.exec() == QDialog::Rejected) {
126126 return false;
127127 }
@@ -130,7 +130,7 @@ bool ModelPackager::editProperties() { · 2 unmodified lines
130130 // Make sure that a mapping for the root joint has been specified
131131 QVariantHash joints = _mapping.value(JOINT_FIELD).toHash();
132132 if (!joints.contains("jointRoot")) {
133− qWarning() << QString("%1 root joint not configured for skeleton.").arg(_modelFile.fileName());
133+ qWarning() << "root joint not configured for skeleton.";
134134
135135 QString message = "Your did not configure a root joint for your skeleton model.\n\nPackaging will be canceled.";
136136 QMessageBox msgBox;
@@ -232,16 +232,16 @@ bool ModelPackager::zipModel() { · 95 unmodified lines
232232 return true;
233233 }
234234
235−void ModelPackager::populateBasicMapping(QVariantHash& mapping, QString filename, const FBXGeometry& geometry) {
235+void ModelPackager::populateBasicMapping(QVariantHash& mapping, QString filename, const hfm::Model& hfmModel) {
236236
237237 // mixamo files - in the event that a mixamo file was edited by some other tool, it's likely the applicationName will
238238 // be rewritten, so we detect the existence of several different blendshapes which indicate we're likely a mixamo file
239− bool likelyMixamoFile = geometry.applicationName == "mixamo.com" ||
240− (geometry.blendshapeChannelNames.contains("BrowsDown_Right") &&
241− geometry.blendshapeChannelNames.contains("MouthOpen") &&
242− geometry.blendshapeChannelNames.contains("Blink_Left") &&
243− geometry.blendshapeChannelNames.contains("Blink_Right") &&
244− geometry.blendshapeChannelNames.contains("Squint_Right"));
239+ bool likelyMixamoFile = hfmModel.applicationName == "mixamo.com" ||
240+ (hfmModel.blendshapeChannelNames.contains("BrowsDown_Right") &&
241+ hfmModel.blendshapeChannelNames.contains("MouthOpen") &&
242+ hfmModel.blendshapeChannelNames.contains("Blink_Left") &&
243+ hfmModel.blendshapeChannelNames.contains("Blink_Right") &&
244+ hfmModel.blendshapeChannelNames.contains("Squint_Right"));
245245
246246 if (!mapping.contains(NAME_FIELD)) {
247247 mapping.insert(NAME_FIELD, QFileInfo(filename).baseName());
@@ -263,15 +263,15 @@ void ModelPackager::populateBasicMapping(QVariantHash& mapping, QString filename · 15 unmodified lines
263263 }
264264 QVariantHash joints = mapping.value(JOINT_FIELD).toHash();
265265 if (!joints.contains("jointEyeLeft")) {
266− joints.insert("jointEyeLeft", geometry.jointIndices.contains("jointEyeLeft") ? "jointEyeLeft" :
267− (geometry.jointIndices.contains("EyeLeft") ? "EyeLeft" : "LeftEye"));
266+ joints.insert("jointEyeLeft", hfmModel.jointIndices.contains("jointEyeLeft") ? "jointEyeLeft" :
267+ (hfmModel.jointIndices.contains("EyeLeft") ? "EyeLeft" : "LeftEye"));
268268 }
269269 if (!joints.contains("jointEyeRight")) {
270− joints.insert("jointEyeRight", geometry.jointIndices.contains("jointEyeRight") ? "jointEyeRight" :
271− geometry.jointIndices.contains("EyeRight") ? "EyeRight" : "RightEye");
270+ joints.insert("jointEyeRight", hfmModel.jointIndices.contains("jointEyeRight") ? "jointEyeRight" :
271+ hfmModel.jointIndices.contains("EyeRight") ? "EyeRight" : "RightEye");
272272 }
273273 if (!joints.contains("jointNeck")) {
274− joints.insert("jointNeck", geometry.jointIndices.contains("jointNeck") ? "jointNeck" : "Neck");
274+ joints.insert("jointNeck", hfmModel.jointIndices.contains("jointNeck") ? "jointNeck" : "Neck");
275275 }
276276
277277 if (!joints.contains("jointRoot")) {
@@ -289,7 +289,7 @@ void ModelPackager::populateBasicMapping(QVariantHash& mapping, QString filename · 11 unmodified lines
289289
290290 if (!joints.contains("jointHead")) {
291291 const char* topName = likelyMixamoFile ? "HeadTop_End" : "HeadEnd";
292− joints.insert("jointHead", geometry.jointIndices.contains(topName) ? topName : "Head");
292+ joints.insert("jointHead", hfmModel.jointIndices.contains(topName) ? topName : "Head");
293293 }
294294
295295 mapping.insert(JOINT_FIELD, joints);
@@ -361,7 +361,7 @@ void ModelPackager::populateBasicMapping(QVariantHash& mapping, QString filename · 65 unmodified lines
361361
362362 void ModelPackager::listTextures() {
363363 _textures.clear();
364− foreach (const FBXMaterial mat, _geometry->materials) {
364+ foreach (const HFMMaterial mat, _hfmModel->materials) {
365365 if (!mat.albedoTexture.filename.isEmpty() && mat.albedoTexture.content.isEmpty() &&
366366 !_textures.contains(mat.albedoTexture.filename)) {
367367 _textures << mat.albedoTexture.filename;