History

enable -Wdouble-promotion

Seth Alves committed 11 years ago

Commit 508ae271 parent 49a68b455 files · +1844 −1740Browse files

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

Unified · Split

interface/src/ModelPropertiesDialog.cpp+26−26
@@ -33,19 +33,19 @@ _basePath(basePath), · 32 unmodified lines
3333 _geometry(geometry)
3434 {
3535 setWindowTitle("Set Model Properties");
36−
36+
3737 QFormLayout* form = new QFormLayout();
3838 setLayout(form);
39−
39+
4040 form->addRow("Name:", _name = new QLineEdit());
41−
41+
4242 form->addRow("Texture Directory:", _textureDirectory = new QPushButton());
4343 connect(_textureDirectory, SIGNAL(clicked(bool)), SLOT(chooseTextureDirectory()));
44−
44+
4545 form->addRow("Scale:", _scale = new QDoubleSpinBox());
4646 _scale->setMaximum(FLT_MAX);
4747 _scale->setSingleStep(0.01);
48−
48+
4949 if (_modelType != FSTReader::ENTITY_MODEL) {
5050 if (_modelType == FSTReader::ATTACHMENT_MODEL) {
5151 QHBoxLayout* translation = new QHBoxLayout();
@@ -57,7 +57,7 @@ _geometry(geometry) · 5 unmodified lines
5757 form->addRow("Pivot Joint:", _pivotJoint = createJointBox());
5858 connect(_pivotAboutCenter, SIGNAL(toggled(bool)), SLOT(updatePivotJoint()));
5959 _pivotAboutCenter->setChecked(true);
60−
60+
6161 } else {
6262 form->addRow("Left Eye Joint:", _leftEyeJoint = createJointBox());
6363 form->addRow("Right Eye Joint:", _rightEyeJoint = createJointBox());
@@ -69,22 +69,22 @@ _geometry(geometry) · 5 unmodified lines
6969 form->addRow("Head Joint:", _headJoint = createJointBox());
7070 form->addRow("Left Hand Joint:", _leftHandJoint = createJointBox());
7171 form->addRow("Right Hand Joint:", _rightHandJoint = createJointBox());
72−
72+
7373 form->addRow("Free Joints:", _freeJoints = new QVBoxLayout());
7474 QPushButton* newFreeJoint = new QPushButton("New Free Joint");
7575 _freeJoints->addWidget(newFreeJoint);
7676 connect(newFreeJoint, SIGNAL(clicked(bool)), SLOT(createNewFreeJoint()));
7777 }
7878 }
79−
79+
8080 QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok |
8181 QDialogButtonBox::Cancel | QDialogButtonBox::Reset);
8282 connect(buttons, SIGNAL(accepted()), SLOT(accept()));
8383 connect(buttons, SIGNAL(rejected()), SLOT(reject()));
8484 connect(buttons->button(QDialogButtonBox::Reset), SIGNAL(clicked(bool)), SLOT(reset()));
85−
85+
8686 form->addRow(buttons);
87−
87+
8888 // reset to initialize the fields
8989 reset();
9090 }
@@ -100,42 +100,42 @@ QVariantHash ModelPropertiesDialog::getMapping() const { · 9 unmodified lines
100100 mapping.insert(NAME_FIELD, _name->text());
101101 mapping.insert(TEXDIR_FIELD, _textureDirectory->text());
102102 mapping.insert(SCALE_FIELD, QString::number(_scale->value()));
103−
103+
104104 // update the joint indices
105105 QVariantHash jointIndices;
106106 for (int i = 0; i < _geometry.joints.size(); i++) {
107107 jointIndices.insert(_geometry.joints.at(i).name, QString::number(i));
108108 }
109109 mapping.insert(JOINT_INDEX_FIELD, jointIndices);
110−
110+
111111 if (_modelType != FSTReader::ENTITY_MODEL) {
112112 QVariantHash joints = mapping.value(JOINT_FIELD).toHash();
113113 if (_modelType == FSTReader::ATTACHMENT_MODEL) {
114114 glm::vec3 pivot;
115115 if (_pivotAboutCenter->isChecked()) {
116116 pivot = (_geometry.meshExtents.minimum + _geometry.meshExtents.maximum) * 0.5f;
117−
117+
118118 } else if (_pivotJoint->currentIndex() != 0) {
119119 pivot = extractTranslation(_geometry.joints.at(_pivotJoint->currentIndex() - 1).transform);
120120 }
121− mapping.insert(TRANSLATION_X_FIELD, -pivot.x * _scale->value() + _translationX->value());
122− mapping.insert(TRANSLATION_Y_FIELD, -pivot.y * _scale->value() + _translationY->value());
123− mapping.insert(TRANSLATION_Z_FIELD, -pivot.z * _scale->value() + _translationZ->value());
124−
121+ mapping.insert(TRANSLATION_X_FIELD, -pivot.x * (float)_scale->value() + (float)_translationX->value());
122+ mapping.insert(TRANSLATION_Y_FIELD, -pivot.y * (float)_scale->value() + (float)_translationY->value());
123+ mapping.insert(TRANSLATION_Z_FIELD, -pivot.z * (float)_scale->value() + (float)_translationZ->value());
124+
125125 } else {
126126 insertJointMapping(joints, "jointEyeLeft", _leftEyeJoint->currentText());
127127 insertJointMapping(joints, "jointEyeRight", _rightEyeJoint->currentText());
128128 insertJointMapping(joints, "jointNeck", _neckJoint->currentText());
129129 }
130−
131−
130+
131+
132132 if (_modelType == FSTReader::BODY_ONLY_MODEL || _modelType == FSTReader::HEAD_AND_BODY_MODEL) {
133133 insertJointMapping(joints, "jointRoot", _rootJoint->currentText());
134134 insertJointMapping(joints, "jointLean", _leanJoint->currentText());
135135 insertJointMapping(joints, "jointHead", _headJoint->currentText());
136136 insertJointMapping(joints, "jointLeftHand", _leftHandJoint->currentText());
137137 insertJointMapping(joints, "jointRightHand", _rightHandJoint->currentText());
138−
138+
139139 mapping.remove(FREE_JOINT_FIELD);
140140 for (int i = 0; i < _freeJoints->count() - 1; i++) {
141141 QComboBox* box = static_cast<QComboBox*>(_freeJoints->itemAt(i)->widget()->layout()->itemAt(0)->widget());
@@ -144,7 +144,7 @@ QVariantHash ModelPropertiesDialog::getMapping() const { · 2 unmodified lines
144144 }
145145 mapping.insert(JOINT_FIELD, joints);
146146 }
147−
147+
148148 return mapping;
149149 }
150150
@@ -156,9 +156,9 @@ void ModelPropertiesDialog::reset() { · 5 unmodified lines
156156 _name->setText(_originalMapping.value(NAME_FIELD).toString());
157157 _textureDirectory->setText(_originalMapping.value(TEXDIR_FIELD).toString());
158158 _scale->setValue(_originalMapping.value(SCALE_FIELD).toDouble());
159−
159+
160160 QVariantHash jointHash = _originalMapping.value(JOINT_FIELD).toHash();
161−
161+
162162 if (_modelType != FSTReader::ENTITY_MODEL) {
163163 if (_modelType == FSTReader::ATTACHMENT_MODEL) {
164164 _translationX->setValue(_originalMapping.value(TRANSLATION_X_FIELD).toDouble());
@@ -166,20 +166,20 @@ void ModelPropertiesDialog::reset() { · 1 unmodified line
166166 _translationZ->setValue(_originalMapping.value(TRANSLATION_Z_FIELD).toDouble());
167167 _pivotAboutCenter->setChecked(true);
168168 _pivotJoint->setCurrentIndex(0);
169−
169+
170170 } else {
171171 setJointText(_leftEyeJoint, jointHash.value("jointEyeLeft").toString());
172172 setJointText(_rightEyeJoint, jointHash.value("jointEyeRight").toString());
173173 setJointText(_neckJoint, jointHash.value("jointNeck").toString());
174174 }
175−
175+
176176 if (_modelType == FSTReader::BODY_ONLY_MODEL || _modelType == FSTReader::HEAD_AND_BODY_MODEL) {
177177 setJointText(_rootJoint, jointHash.value("jointRoot").toString());
178178 setJointText(_leanJoint, jointHash.value("jointLean").toString());
179179 setJointText(_headJoint, jointHash.value("jointHead").toString());
180180 setJointText(_leftHandJoint, jointHash.value("jointLeftHand").toString());
181181 setJointText(_rightHandJoint, jointHash.value("jointRightHand").toString());
182−
182+
183183 while (_freeJoints->count() > 1) {
184184 delete _freeJoints->itemAt(0)->widget();
185185 }

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