Showing the changes to interface/src/ModelPropertiesDialog.cpp (1 of 11 files). Show all
Unified · Split
| @@ -43,6 +43,9 @@ _geometry(geometry) · 42 unmodified lines | ||
| 43 | 43 | form->addRow("Texture Directory:", _textureDirectory = new QPushButton()); |
| 44 | 44 | connect(_textureDirectory, SIGNAL(clicked(bool)), SLOT(chooseTextureDirectory())); |
| 45 | 45 | |
| 46 | + form->addRow("Script Directory:", _scriptDirectory = new QPushButton()); | |
| 47 | + connect(_scriptDirectory, SIGNAL(clicked(bool)), SLOT(chooseScriptDirectory())); | |
| 48 | + | |
| 46 | 49 | form->addRow("Scale:", _scale = new QDoubleSpinBox()); |
| 47 | 50 | _scale->setMaximum(FLT_MAX); |
| 48 | 51 | _scale->setSingleStep(0.01); |
| @@ -100,6 +103,7 @@ QVariantHash ModelPropertiesDialog::getMapping() const { · 51 unmodified lines | ||
| 100 | 103 | mapping.insert(TYPE_FIELD, getType()); |
| 101 | 104 | mapping.insert(NAME_FIELD, _name->text()); |
| 102 | 105 | mapping.insert(TEXDIR_FIELD, _textureDirectory->text()); |
| 106 | + mapping.insert(SCRIPT_FIELD, _scriptDirectory->text()); | |
| 103 | 107 | mapping.insert(SCALE_FIELD, QString::number(_scale->value())); |
| 104 | 108 | |
| 105 | 109 | // update the joint indices |
| @@ -157,6 +161,7 @@ void ModelPropertiesDialog::reset() { · 51 unmodified lines | ||
| 157 | 161 | _name->setText(_originalMapping.value(NAME_FIELD).toString()); |
| 158 | 162 | _textureDirectory->setText(_originalMapping.value(TEXDIR_FIELD).toString()); |
| 159 | 163 | _scale->setValue(_originalMapping.value(SCALE_FIELD).toDouble()); |
| 164 | + _scriptDirectory->setText(_originalMapping.value(SCRIPT_FIELD).toString()); | |
| 160 | 165 | |
| 161 | 166 | QVariantHash jointHash = _originalMapping.value(JOINT_FIELD).toHash(); |
| 162 | 167 | |
| @@ -207,6 +212,20 @@ void ModelPropertiesDialog::chooseTextureDirectory() { · 44 unmodified lines | ||
| 207 | 212 | _textureDirectory->setText(directory.length() == _basePath.length() ? "." : directory.mid(_basePath.length() + 1)); |
| 208 | 213 | } |
| 209 | 214 | |
| 215 | +void ModelPropertiesDialog::chooseScriptDirectory() { | |
| 216 | + QString directory = QFileDialog::getExistingDirectory(this, "Choose Script Directory", | |
| 217 | + _basePath + "/" + _scriptDirectory->text()); | |
| 218 | + if (directory.isEmpty()) { | |
| 219 | + return; | |
| 220 | + } | |
| 221 | + if (!directory.startsWith(_basePath)) { | |
| 222 | + OffscreenUi::asyncWarning(NULL, "Invalid script directory", "Script directory must be child of base path."); | |
| 223 | + return; | |
| 224 | + } | |
| 225 | + _scriptDirectory->setText(directory.length() == _basePath.length() ? "." : directory.mid(_basePath.length() + 1)); | |
| 226 | +} | |
| 227 | + | |
| 228 | + | |
| 210 | 229 | void ModelPropertiesDialog::updatePivotJoint() { |
| 211 | 230 | _pivotJoint->setEnabled(!_pivotAboutCenter->isChecked()); |
| 212 | 231 | } |