History

remove Model Type dropdown and related code paths

humbletim committed 8 years ago

Commit 2cf633c1 parent b1d8a9a6 files · +76 −164Browse files

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

Unified · Split

interface/src/ModelPropertiesDialog.cpp+45−99
@@ -26,9 +26,8 @@ · 25 unmodified lines
2626 #include <OffscreenUi.h>
2727
2828
29−ModelPropertiesDialog::ModelPropertiesDialog(FSTReader::ModelType modelType, const QVariantHash& originalMapping,
29+ModelPropertiesDialog::ModelPropertiesDialog(const QVariantHash& originalMapping,
3030 const QString& basePath, const FBXGeometry& geometry) :
31−_modelType(modelType),
3231 _originalMapping(originalMapping),
3332 _basePath(basePath),
3433 _geometry(geometry)
@@ -50,36 +49,19 @@ _geometry(geometry) · 15 unmodified lines
5049 _scale->setMaximum(FLT_MAX);
5150 _scale->setSingleStep(0.01);
5251
53− if (_modelType != FSTReader::ENTITY_MODEL) {
54− if (_modelType == FSTReader::ATTACHMENT_MODEL) {
55− QHBoxLayout* translation = new QHBoxLayout();
56− form->addRow("Translation:", translation);
57− translation->addWidget(_translationX = createTranslationBox());
58− translation->addWidget(_translationY = createTranslationBox());
59− translation->addWidget(_translationZ = createTranslationBox());
60− form->addRow("Pivot About Center:", _pivotAboutCenter = new QCheckBox());
61− form->addRow("Pivot Joint:", _pivotJoint = createJointBox());
62− connect(_pivotAboutCenter, SIGNAL(toggled(bool)), SLOT(updatePivotJoint()));
63− _pivotAboutCenter->setChecked(true);
64−
65− } else {
66− form->addRow("Left Eye Joint:", _leftEyeJoint = createJointBox());
67− form->addRow("Right Eye Joint:", _rightEyeJoint = createJointBox());
68− form->addRow("Neck Joint:", _neckJoint = createJointBox());
69− }
70− if (_modelType == FSTReader::BODY_ONLY_MODEL || _modelType == FSTReader::HEAD_AND_BODY_MODEL) {
71− form->addRow("Root Joint:", _rootJoint = createJointBox());
72− form->addRow("Lean Joint:", _leanJoint = createJointBox());
73− form->addRow("Head Joint:", _headJoint = createJointBox());
74− form->addRow("Left Hand Joint:", _leftHandJoint = createJointBox());
75− form->addRow("Right Hand Joint:", _rightHandJoint = createJointBox());
76−
77− form->addRow("Free Joints:", _freeJoints = new QVBoxLayout());
78− QPushButton* newFreeJoint = new QPushButton("New Free Joint");
79− _freeJoints->addWidget(newFreeJoint);
80− connect(newFreeJoint, SIGNAL(clicked(bool)), SLOT(createNewFreeJoint()));
81− }
82− }
52+ form->addRow("Left Eye Joint:", _leftEyeJoint = createJointBox());
53+ form->addRow("Right Eye Joint:", _rightEyeJoint = createJointBox());
54+ form->addRow("Neck Joint:", _neckJoint = createJointBox());
55+ form->addRow("Root Joint:", _rootJoint = createJointBox());
56+ form->addRow("Lean Joint:", _leanJoint = createJointBox());
57+ form->addRow("Head Joint:", _headJoint = createJointBox());
58+ form->addRow("Left Hand Joint:", _leftHandJoint = createJointBox());
59+ form->addRow("Right Hand Joint:", _rightHandJoint = createJointBox());
60+
61+ form->addRow("Free Joints:", _freeJoints = new QVBoxLayout());
62+ QPushButton* newFreeJoint = new QPushButton("New Free Joint");
63+ _freeJoints->addWidget(newFreeJoint);
64+ connect(newFreeJoint, SIGNAL(clicked(bool)), SLOT(createNewFreeJoint()));
8365
8466 QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok |
8567 QDialogButtonBox::Cancel | QDialogButtonBox::Reset);
@@ -93,14 +75,9 @@ _geometry(geometry) · 7 unmodified lines
9375 reset();
9476 }
9577
96−
97−QString ModelPropertiesDialog::getType() const {
98− return FSTReader::getNameFromType(_modelType);
99−}
100−
10178 QVariantHash ModelPropertiesDialog::getMapping() const {
10279 QVariantHash mapping = _originalMapping;
103− mapping.insert(TYPE_FIELD, getType());
80+ mapping.insert(TYPE_FIELD, FSTReader::getNameFromType(FSTReader::HEAD_AND_BODY_MODEL));
10481 mapping.insert(NAME_FIELD, _name->text());
10582 mapping.insert(TEXDIR_FIELD, _textureDirectory->text());
10683 mapping.insert(SCRIPT_FIELD, _scriptDirectory->text());
@@ -113,42 +90,24 @@ QVariantHash ModelPropertiesDialog::getMapping() const { · 6 unmodified lines
11390 }
11491 mapping.insert(JOINT_INDEX_FIELD, jointIndices);
11592
116− if (_modelType != FSTReader::ENTITY_MODEL) {
117− QVariantHash joints = mapping.value(JOINT_FIELD).toHash();
118− if (_modelType == FSTReader::ATTACHMENT_MODEL) {
119− glm::vec3 pivot;
120− if (_pivotAboutCenter->isChecked()) {
121− pivot = (_geometry.meshExtents.minimum + _geometry.meshExtents.maximum) * 0.5f;
122−
123− } else if (_pivotJoint->currentIndex() != 0) {
124− pivot = extractTranslation(_geometry.joints.at(_pivotJoint->currentIndex() - 1).transform);
125− }
126− mapping.insert(TRANSLATION_X_FIELD, -pivot.x * (float)_scale->value() + (float)_translationX->value());
127− mapping.insert(TRANSLATION_Y_FIELD, -pivot.y * (float)_scale->value() + (float)_translationY->value());
128− mapping.insert(TRANSLATION_Z_FIELD, -pivot.z * (float)_scale->value() + (float)_translationZ->value());
129−
130− } else {
131− insertJointMapping(joints, "jointEyeLeft", _leftEyeJoint->currentText());
132− insertJointMapping(joints, "jointEyeRight", _rightEyeJoint->currentText());
133− insertJointMapping(joints, "jointNeck", _neckJoint->currentText());
134− }
93+ QVariantHash joints = mapping.value(JOINT_FIELD).toHash();
94+ insertJointMapping(joints, "jointEyeLeft", _leftEyeJoint->currentText());
95+ insertJointMapping(joints, "jointEyeRight", _rightEyeJoint->currentText());
96+ insertJointMapping(joints, "jointNeck", _neckJoint->currentText());
13597
13698
137− if (_modelType == FSTReader::BODY_ONLY_MODEL || _modelType == FSTReader::HEAD_AND_BODY_MODEL) {
138− insertJointMapping(joints, "jointRoot", _rootJoint->currentText());
139− insertJointMapping(joints, "jointLean", _leanJoint->currentText());
140− insertJointMapping(joints, "jointHead", _headJoint->currentText());
141− insertJointMapping(joints, "jointLeftHand", _leftHandJoint->currentText());
142− insertJointMapping(joints, "jointRightHand", _rightHandJoint->currentText());
99+ insertJointMapping(joints, "jointRoot", _rootJoint->currentText());
100+ insertJointMapping(joints, "jointLean", _leanJoint->currentText());
101+ insertJointMapping(joints, "jointHead", _headJoint->currentText());
102+ insertJointMapping(joints, "jointLeftHand", _leftHandJoint->currentText());
103+ insertJointMapping(joints, "jointRightHand", _rightHandJoint->currentText());
143104
144− mapping.remove(FREE_JOINT_FIELD);
145− for (int i = 0; i < _freeJoints->count() - 1; i++) {
146− QComboBox* box = static_cast<QComboBox*>(_freeJoints->itemAt(i)->widget()->layout()->itemAt(0)->widget());
147− mapping.insertMulti(FREE_JOINT_FIELD, box->currentText());
148− }
149− }
150− mapping.insert(JOINT_FIELD, joints);
105+ mapping.remove(FREE_JOINT_FIELD);
106+ for (int i = 0; i < _freeJoints->count() - 1; i++) {
107+ QComboBox* box = static_cast<QComboBox*>(_freeJoints->itemAt(i)->widget()->layout()->itemAt(0)->widget());
108+ mapping.insertMulti(FREE_JOINT_FIELD, box->currentText());
151109 }
110+ mapping.insert(JOINT_FIELD, joints);
152111
153112 return mapping;
154113 }
@@ -165,36 +124,23 @@ void ModelPropertiesDialog::reset() { · 10 unmodified lines
165124
166125 QVariantHash jointHash = _originalMapping.value(JOINT_FIELD).toHash();
167126
168− if (_modelType != FSTReader::ENTITY_MODEL) {
169− if (_modelType == FSTReader::ATTACHMENT_MODEL) {
170− _translationX->setValue(_originalMapping.value(TRANSLATION_X_FIELD).toDouble());
171− _translationY->setValue(_originalMapping.value(TRANSLATION_Y_FIELD).toDouble());
172− _translationZ->setValue(_originalMapping.value(TRANSLATION_Z_FIELD).toDouble());
173− _pivotAboutCenter->setChecked(true);
174− _pivotJoint->setCurrentIndex(0);
175−
176− } else {
177− setJointText(_leftEyeJoint, jointHash.value("jointEyeLeft").toString());
178− setJointText(_rightEyeJoint, jointHash.value("jointEyeRight").toString());
179− setJointText(_neckJoint, jointHash.value("jointNeck").toString());
180− }
127+ setJointText(_leftEyeJoint, jointHash.value("jointEyeLeft").toString());
128+ setJointText(_rightEyeJoint, jointHash.value("jointEyeRight").toString());
129+ setJointText(_neckJoint, jointHash.value("jointNeck").toString());
130+
131+ setJointText(_rootJoint, jointHash.value("jointRoot").toString());
132+ setJointText(_leanJoint, jointHash.value("jointLean").toString());
133+ setJointText(_headJoint, jointHash.value("jointHead").toString());
134+ setJointText(_leftHandJoint, jointHash.value("jointLeftHand").toString());
135+ setJointText(_rightHandJoint, jointHash.value("jointRightHand").toString());
181136
182− if (_modelType == FSTReader::BODY_ONLY_MODEL || _modelType == FSTReader::HEAD_AND_BODY_MODEL) {
183− setJointText(_rootJoint, jointHash.value("jointRoot").toString());
184− setJointText(_leanJoint, jointHash.value("jointLean").toString());
185− setJointText(_headJoint, jointHash.value("jointHead").toString());
186− setJointText(_leftHandJoint, jointHash.value("jointLeftHand").toString());
187− setJointText(_rightHandJoint, jointHash.value("jointRightHand").toString());
188−
189− while (_freeJoints->count() > 1) {
190− delete _freeJoints->itemAt(0)->widget();
191− }
192− foreach (const QVariant& joint, _originalMapping.values(FREE_JOINT_FIELD)) {
193− QString jointName = joint.toString();
194− if (_geometry.jointIndices.contains(jointName)) {
195− createNewFreeJoint(jointName);
196− }
197− }
137+ while (_freeJoints->count() > 1) {
138+ delete _freeJoints->itemAt(0)->widget();
139+ }
140+ foreach (const QVariant& joint, _originalMapping.values(FREE_JOINT_FIELD)) {
141+ QString jointName = joint.toString();
142+ if (_geometry.jointIndices.contains(jointName)) {
143+ createNewFreeJoint(jointName);
198144 }
199145 }
200146 }