History

Rename HFMGeometry to HFMModel and adjust related variables

sabrina-shanman committed 8 years ago

Commit cbca77b1 parent 643026a46 files · +550 −550Browse files

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

Unified · Split

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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t