Showing the changes to interface/src/ModelPackager.cpp (1 of 46 files). Show all
Unified · Split
| @@ -109,10 +109,10 @@ bool ModelPackager::loadModel() { · 108 unmodified lines | ||
| 109 | 109 | qCDebug(interfaceapp) << "Reading FBX file : " << _fbxInfo.filePath(); |
| 110 | 110 | QByteArray fbxContents = fbx.readAll(); |
| 111 | 111 | |
| 112 | − _geometry.reset(readFBX(fbxContents, QVariantHash(), _fbxInfo.filePath())); | |
| 112 | + _model.reset(readFBX(fbxContents, QVariantHash(), _fbxInfo.filePath())); | |
| 113 | 113 | |
| 114 | 114 | // make sure we have some basic mappings |
| 115 | − populateBasicMapping(_mapping, _fbxInfo.filePath(), *_geometry); | |
| 115 | + populateBasicMapping(_mapping, _fbxInfo.filePath(), *_model); | |
| 116 | 116 | } catch (const QString& error) { |
| 117 | 117 | qCDebug(interfaceapp) << "Error reading " << _fbxInfo.filePath() << ": " << error; |
| 118 | 118 | return false; |
| @@ -122,7 +122,7 @@ bool ModelPackager::loadModel() { · 3 unmodified lines | ||
| 122 | 122 | |
| 123 | 123 | bool ModelPackager::editProperties() { |
| 124 | 124 | // open the dialog to configure the rest |
| 125 | − ModelPropertiesDialog properties(_modelType, _mapping, _modelFile.path(), *_geometry); | |
| 125 | + ModelPropertiesDialog properties(_modelType, _mapping, _modelFile.path(), *_model); | |
| 126 | 126 | if (properties.exec() == QDialog::Rejected) { |
| 127 | 127 | return false; |
| 128 | 128 | } |
| @@ -235,18 +235,18 @@ bool ModelPackager::zipModel() { · 106 unmodified lines | ||
| 235 | 235 | return true; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | −void ModelPackager::populateBasicMapping(QVariantHash& mapping, QString filename, const HFMGeometry& geometry) { | |
| 238 | +void ModelPackager::populateBasicMapping(QVariantHash& mapping, QString filename, const HFMModel& model) { | |
| 239 | 239 | |
| 240 | 240 | bool isBodyType = _modelType == FSTReader::BODY_ONLY_MODEL || _modelType == FSTReader::HEAD_AND_BODY_MODEL; |
| 241 | 241 | |
| 242 | 242 | // mixamo files - in the event that a mixamo file was edited by some other tool, it's likely the applicationName will |
| 243 | 243 | // be rewritten, so we detect the existence of several different blendshapes which indicate we're likely a mixamo file |
| 244 | − bool likelyMixamoFile = geometry.applicationName == "mixamo.com" || | |
| 245 | − (geometry.blendshapeChannelNames.contains("BrowsDown_Right") && | |
| 246 | − geometry.blendshapeChannelNames.contains("MouthOpen") && | |
| 247 | − geometry.blendshapeChannelNames.contains("Blink_Left") && | |
| 248 | − geometry.blendshapeChannelNames.contains("Blink_Right") && | |
| 249 | − geometry.blendshapeChannelNames.contains("Squint_Right")); | |
| 244 | + bool likelyMixamoFile = model.applicationName == "mixamo.com" || | |
| 245 | + (model.blendshapeChannelNames.contains("BrowsDown_Right") && | |
| 246 | + model.blendshapeChannelNames.contains("MouthOpen") && | |
| 247 | + model.blendshapeChannelNames.contains("Blink_Left") && | |
| 248 | + model.blendshapeChannelNames.contains("Blink_Right") && | |
| 249 | + model.blendshapeChannelNames.contains("Squint_Right")); | |
| 250 | 250 | |
| 251 | 251 | if (!mapping.contains(NAME_FIELD)) { |
| 252 | 252 | mapping.insert(NAME_FIELD, QFileInfo(filename).baseName()); |
| @@ -268,15 +268,15 @@ void ModelPackager::populateBasicMapping(QVariantHash& mapping, QString filename · 15 unmodified lines | ||
| 268 | 268 | } |
| 269 | 269 | QVariantHash joints = mapping.value(JOINT_FIELD).toHash(); |
| 270 | 270 | if (!joints.contains("jointEyeLeft")) { |
| 271 | − joints.insert("jointEyeLeft", geometry.jointIndices.contains("jointEyeLeft") ? "jointEyeLeft" : | |
| 272 | − (geometry.jointIndices.contains("EyeLeft") ? "EyeLeft" : "LeftEye")); | |
| 271 | + joints.insert("jointEyeLeft", model.jointIndices.contains("jointEyeLeft") ? "jointEyeLeft" : | |
| 272 | + (model.jointIndices.contains("EyeLeft") ? "EyeLeft" : "LeftEye")); | |
| 273 | 273 | } |
| 274 | 274 | if (!joints.contains("jointEyeRight")) { |
| 275 | − joints.insert("jointEyeRight", geometry.jointIndices.contains("jointEyeRight") ? "jointEyeRight" : | |
| 276 | − geometry.jointIndices.contains("EyeRight") ? "EyeRight" : "RightEye"); | |
| 275 | + joints.insert("jointEyeRight", model.jointIndices.contains("jointEyeRight") ? "jointEyeRight" : | |
| 276 | + model.jointIndices.contains("EyeRight") ? "EyeRight" : "RightEye"); | |
| 277 | 277 | } |
| 278 | 278 | if (!joints.contains("jointNeck")) { |
| 279 | − joints.insert("jointNeck", geometry.jointIndices.contains("jointNeck") ? "jointNeck" : "Neck"); | |
| 279 | + joints.insert("jointNeck", model.jointIndices.contains("jointNeck") ? "jointNeck" : "Neck"); | |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | if (isBodyType) { |
| @@ -296,7 +296,7 @@ void ModelPackager::populateBasicMapping(QVariantHash& mapping, QString filename · 13 unmodified lines | ||
| 296 | 296 | |
| 297 | 297 | if (!joints.contains("jointHead")) { |
| 298 | 298 | const char* topName = likelyMixamoFile ? "HeadTop_End" : "HeadEnd"; |
| 299 | − joints.insert("jointHead", geometry.jointIndices.contains(topName) ? topName : "Head"); | |
| 299 | + joints.insert("jointHead", model.jointIndices.contains(topName) ? topName : "Head"); | |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | mapping.insert(JOINT_FIELD, joints); |
| @@ -370,7 +370,7 @@ void ModelPackager::populateBasicMapping(QVariantHash& mapping, QString filename · 67 unmodified lines | ||
| 370 | 370 | |
| 371 | 371 | void ModelPackager::listTextures() { |
| 372 | 372 | _textures.clear(); |
| 373 | − foreach (const HFMMaterial mat, _geometry->materials) { | |
| 373 | + foreach (const HFMMaterial mat, _model->materials) { | |
| 374 | 374 | if (!mat.albedoTexture.filename.isEmpty() && mat.albedoTexture.content.isEmpty() && |
| 375 | 375 | !_textures.contains(mat.albedoTexture.filename)) { |
| 376 | 376 | _textures << mat.albedoTexture.filename; |