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
33_geometry(geometry)33_geometry(geometry)
34{34{
35 setWindowTitle("Set Model Properties");35 setWindowTitle("Set Model Properties");
36 36
37 QFormLayout* form = new QFormLayout();37 QFormLayout* form = new QFormLayout();
38 setLayout(form);38 setLayout(form);
39 39
40 form->addRow("Name:", _name = new QLineEdit());40 form->addRow("Name:", _name = new QLineEdit());
41 41
42 form->addRow("Texture Directory:", _textureDirectory = new QPushButton());42 form->addRow("Texture Directory:", _textureDirectory = new QPushButton());
43 connect(_textureDirectory, SIGNAL(clicked(bool)), SLOT(chooseTextureDirectory()));43 connect(_textureDirectory, SIGNAL(clicked(bool)), SLOT(chooseTextureDirectory()));
44 44
45 form->addRow("Scale:", _scale = new QDoubleSpinBox());45 form->addRow("Scale:", _scale = new QDoubleSpinBox());
46 _scale->setMaximum(FLT_MAX);46 _scale->setMaximum(FLT_MAX);
47 _scale->setSingleStep(0.01);47 _scale->setSingleStep(0.01);
48 48
49 if (_modelType != FSTReader::ENTITY_MODEL) {49 if (_modelType != FSTReader::ENTITY_MODEL) {
50 if (_modelType == FSTReader::ATTACHMENT_MODEL) {50 if (_modelType == FSTReader::ATTACHMENT_MODEL) {
51 QHBoxLayout* translation = new QHBoxLayout();51 QHBoxLayout* translation = new QHBoxLayout();
@@ -57,7 +57,7 @@ _geometry(geometry) · 5 unmodified lines
57 form->addRow("Pivot Joint:", _pivotJoint = createJointBox());57 form->addRow("Pivot Joint:", _pivotJoint = createJointBox());
58 connect(_pivotAboutCenter, SIGNAL(toggled(bool)), SLOT(updatePivotJoint()));58 connect(_pivotAboutCenter, SIGNAL(toggled(bool)), SLOT(updatePivotJoint()));
59 _pivotAboutCenter->setChecked(true);59 _pivotAboutCenter->setChecked(true);
60 60
61 } else {61 } else {
62 form->addRow("Left Eye Joint:", _leftEyeJoint = createJointBox());62 form->addRow("Left Eye Joint:", _leftEyeJoint = createJointBox());
63 form->addRow("Right Eye Joint:", _rightEyeJoint = createJointBox());63 form->addRow("Right Eye Joint:", _rightEyeJoint = createJointBox());
@@ -69,22 +69,22 @@ _geometry(geometry) · 5 unmodified lines
69 form->addRow("Head Joint:", _headJoint = createJointBox());69 form->addRow("Head Joint:", _headJoint = createJointBox());
70 form->addRow("Left Hand Joint:", _leftHandJoint = createJointBox());70 form->addRow("Left Hand Joint:", _leftHandJoint = createJointBox());
71 form->addRow("Right Hand Joint:", _rightHandJoint = createJointBox());71 form->addRow("Right Hand Joint:", _rightHandJoint = createJointBox());
72 72
73 form->addRow("Free Joints:", _freeJoints = new QVBoxLayout());73 form->addRow("Free Joints:", _freeJoints = new QVBoxLayout());
74 QPushButton* newFreeJoint = new QPushButton("New Free Joint");74 QPushButton* newFreeJoint = new QPushButton("New Free Joint");
75 _freeJoints->addWidget(newFreeJoint);75 _freeJoints->addWidget(newFreeJoint);
76 connect(newFreeJoint, SIGNAL(clicked(bool)), SLOT(createNewFreeJoint()));76 connect(newFreeJoint, SIGNAL(clicked(bool)), SLOT(createNewFreeJoint()));
77 }77 }
78 }78 }
79 79
80 QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok |80 QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok |
81 QDialogButtonBox::Cancel | QDialogButtonBox::Reset);81 QDialogButtonBox::Cancel | QDialogButtonBox::Reset);
82 connect(buttons, SIGNAL(accepted()), SLOT(accept()));82 connect(buttons, SIGNAL(accepted()), SLOT(accept()));
83 connect(buttons, SIGNAL(rejected()), SLOT(reject()));83 connect(buttons, SIGNAL(rejected()), SLOT(reject()));
84 connect(buttons->button(QDialogButtonBox::Reset), SIGNAL(clicked(bool)), SLOT(reset()));84 connect(buttons->button(QDialogButtonBox::Reset), SIGNAL(clicked(bool)), SLOT(reset()));
85 85
86 form->addRow(buttons);86 form->addRow(buttons);
87 87
88 // reset to initialize the fields88 // reset to initialize the fields
89 reset();89 reset();
90}90}
@@ -100,42 +100,42 @@ QVariantHash ModelPropertiesDialog::getMapping() const { · 9 unmodified lines
100 mapping.insert(NAME_FIELD, _name->text());100 mapping.insert(NAME_FIELD, _name->text());
101 mapping.insert(TEXDIR_FIELD, _textureDirectory->text());101 mapping.insert(TEXDIR_FIELD, _textureDirectory->text());
102 mapping.insert(SCALE_FIELD, QString::number(_scale->value()));102 mapping.insert(SCALE_FIELD, QString::number(_scale->value()));
103 103
104 // update the joint indices104 // update the joint indices
105 QVariantHash jointIndices;105 QVariantHash jointIndices;
106 for (int i = 0; i < _geometry.joints.size(); i++) {106 for (int i = 0; i < _geometry.joints.size(); i++) {
107 jointIndices.insert(_geometry.joints.at(i).name, QString::number(i));107 jointIndices.insert(_geometry.joints.at(i).name, QString::number(i));
108 }108 }
109 mapping.insert(JOINT_INDEX_FIELD, jointIndices);109 mapping.insert(JOINT_INDEX_FIELD, jointIndices);
110 110
111 if (_modelType != FSTReader::ENTITY_MODEL) {111 if (_modelType != FSTReader::ENTITY_MODEL) {
112 QVariantHash joints = mapping.value(JOINT_FIELD).toHash();112 QVariantHash joints = mapping.value(JOINT_FIELD).toHash();
113 if (_modelType == FSTReader::ATTACHMENT_MODEL) {113 if (_modelType == FSTReader::ATTACHMENT_MODEL) {
114 glm::vec3 pivot;114 glm::vec3 pivot;
115 if (_pivotAboutCenter->isChecked()) {115 if (_pivotAboutCenter->isChecked()) {
116 pivot = (_geometry.meshExtents.minimum + _geometry.meshExtents.maximum) * 0.5f;116 pivot = (_geometry.meshExtents.minimum + _geometry.meshExtents.maximum) * 0.5f;
117 117
118 } else if (_pivotJoint->currentIndex() != 0) {118 } else if (_pivotJoint->currentIndex() != 0) {
119 pivot = extractTranslation(_geometry.joints.at(_pivotJoint->currentIndex() - 1).transform);119 pivot = extractTranslation(_geometry.joints.at(_pivotJoint->currentIndex() - 1).transform);
120 }120 }
121 mapping.insert(TRANSLATION_X_FIELD, -pivot.x * _scale->value() + _translationX->value());121 mapping.insert(TRANSLATION_X_FIELD, -pivot.x * (float)_scale->value() + (float)_translationX->value());
122 mapping.insert(TRANSLATION_Y_FIELD, -pivot.y * _scale->value() + _translationY->value());122 mapping.insert(TRANSLATION_Y_FIELD, -pivot.y * (float)_scale->value() + (float)_translationY->value());
123 mapping.insert(TRANSLATION_Z_FIELD, -pivot.z * _scale->value() + _translationZ->value());123 mapping.insert(TRANSLATION_Z_FIELD, -pivot.z * (float)_scale->value() + (float)_translationZ->value());
124 124
125 } else {125 } else {
126 insertJointMapping(joints, "jointEyeLeft", _leftEyeJoint->currentText());126 insertJointMapping(joints, "jointEyeLeft", _leftEyeJoint->currentText());
127 insertJointMapping(joints, "jointEyeRight", _rightEyeJoint->currentText());127 insertJointMapping(joints, "jointEyeRight", _rightEyeJoint->currentText());
128 insertJointMapping(joints, "jointNeck", _neckJoint->currentText());128 insertJointMapping(joints, "jointNeck", _neckJoint->currentText());
129 }129 }
130 130
131 131
132 if (_modelType == FSTReader::BODY_ONLY_MODEL || _modelType == FSTReader::HEAD_AND_BODY_MODEL) {132 if (_modelType == FSTReader::BODY_ONLY_MODEL || _modelType == FSTReader::HEAD_AND_BODY_MODEL) {
133 insertJointMapping(joints, "jointRoot", _rootJoint->currentText());133 insertJointMapping(joints, "jointRoot", _rootJoint->currentText());
134 insertJointMapping(joints, "jointLean", _leanJoint->currentText());134 insertJointMapping(joints, "jointLean", _leanJoint->currentText());
135 insertJointMapping(joints, "jointHead", _headJoint->currentText());135 insertJointMapping(joints, "jointHead", _headJoint->currentText());
136 insertJointMapping(joints, "jointLeftHand", _leftHandJoint->currentText());136 insertJointMapping(joints, "jointLeftHand", _leftHandJoint->currentText());
137 insertJointMapping(joints, "jointRightHand", _rightHandJoint->currentText());137 insertJointMapping(joints, "jointRightHand", _rightHandJoint->currentText());
138 138
139 mapping.remove(FREE_JOINT_FIELD);139 mapping.remove(FREE_JOINT_FIELD);
140 for (int i = 0; i < _freeJoints->count() - 1; i++) {140 for (int i = 0; i < _freeJoints->count() - 1; i++) {
141 QComboBox* box = static_cast<QComboBox*>(_freeJoints->itemAt(i)->widget()->layout()->itemAt(0)->widget());141 QComboBox* box = static_cast<QComboBox*>(_freeJoints->itemAt(i)->widget()->layout()->itemAt(0)->widget());
@@ -144,7 +144,7 @@ QVariantHash ModelPropertiesDialog::getMapping() const { · 2 unmodified lines
144 }144 }
145 mapping.insert(JOINT_FIELD, joints);145 mapping.insert(JOINT_FIELD, joints);
146 }146 }
147 147
148 return mapping;148 return mapping;
149}149}
150 150
@@ -156,9 +156,9 @@ void ModelPropertiesDialog::reset() { · 5 unmodified lines
156 _name->setText(_originalMapping.value(NAME_FIELD).toString());156 _name->setText(_originalMapping.value(NAME_FIELD).toString());
157 _textureDirectory->setText(_originalMapping.value(TEXDIR_FIELD).toString());157 _textureDirectory->setText(_originalMapping.value(TEXDIR_FIELD).toString());
158 _scale->setValue(_originalMapping.value(SCALE_FIELD).toDouble());158 _scale->setValue(_originalMapping.value(SCALE_FIELD).toDouble());
159 159
160 QVariantHash jointHash = _originalMapping.value(JOINT_FIELD).toHash();160 QVariantHash jointHash = _originalMapping.value(JOINT_FIELD).toHash();
161 161
162 if (_modelType != FSTReader::ENTITY_MODEL) {162 if (_modelType != FSTReader::ENTITY_MODEL) {
163 if (_modelType == FSTReader::ATTACHMENT_MODEL) {163 if (_modelType == FSTReader::ATTACHMENT_MODEL) {
164 _translationX->setValue(_originalMapping.value(TRANSLATION_X_FIELD).toDouble());164 _translationX->setValue(_originalMapping.value(TRANSLATION_X_FIELD).toDouble());
@@ -166,20 +166,20 @@ void ModelPropertiesDialog::reset() { · 1 unmodified line
166 _translationZ->setValue(_originalMapping.value(TRANSLATION_Z_FIELD).toDouble());166 _translationZ->setValue(_originalMapping.value(TRANSLATION_Z_FIELD).toDouble());
167 _pivotAboutCenter->setChecked(true);167 _pivotAboutCenter->setChecked(true);
168 _pivotJoint->setCurrentIndex(0);168 _pivotJoint->setCurrentIndex(0);
169 169
170 } else {170 } else {
171 setJointText(_leftEyeJoint, jointHash.value("jointEyeLeft").toString());171 setJointText(_leftEyeJoint, jointHash.value("jointEyeLeft").toString());
172 setJointText(_rightEyeJoint, jointHash.value("jointEyeRight").toString());172 setJointText(_rightEyeJoint, jointHash.value("jointEyeRight").toString());
173 setJointText(_neckJoint, jointHash.value("jointNeck").toString());173 setJointText(_neckJoint, jointHash.value("jointNeck").toString());
174 }174 }
175 175
176 if (_modelType == FSTReader::BODY_ONLY_MODEL || _modelType == FSTReader::HEAD_AND_BODY_MODEL) {176 if (_modelType == FSTReader::BODY_ONLY_MODEL || _modelType == FSTReader::HEAD_AND_BODY_MODEL) {
177 setJointText(_rootJoint, jointHash.value("jointRoot").toString());177 setJointText(_rootJoint, jointHash.value("jointRoot").toString());
178 setJointText(_leanJoint, jointHash.value("jointLean").toString());178 setJointText(_leanJoint, jointHash.value("jointLean").toString());
179 setJointText(_headJoint, jointHash.value("jointHead").toString());179 setJointText(_headJoint, jointHash.value("jointHead").toString());
180 setJointText(_leftHandJoint, jointHash.value("jointLeftHand").toString());180 setJointText(_leftHandJoint, jointHash.value("jointLeftHand").toString());
181 setJointText(_rightHandJoint, jointHash.value("jointRightHand").toString());181 setJointText(_rightHandJoint, jointHash.value("jointRightHand").toString());
182 182
183 while (_freeJoints->count() > 1) {183 while (_freeJoints->count() > 1) {
184 delete _freeJoints->itemAt(0)->widget();184 delete _freeJoints->itemAt(0)->widget();
185 }185 }

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