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 | form->addRow("Texture Directory:", _textureDirectory = new QPushButton()); | 43 | form->addRow("Texture Directory:", _textureDirectory = new QPushButton()); |
| 44 | connect(_textureDirectory, SIGNAL(clicked(bool)), SLOT(chooseTextureDirectory())); | 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 | form->addRow("Scale:", _scale = new QDoubleSpinBox()); | 49 | form->addRow("Scale:", _scale = new QDoubleSpinBox()); |
| 47 | _scale->setMaximum(FLT_MAX); | 50 | _scale->setMaximum(FLT_MAX); |
| 48 | _scale->setSingleStep(0.01); | 51 | _scale->setSingleStep(0.01); |
| @@ -100,6 +103,7 @@ QVariantHash ModelPropertiesDialog::getMapping() const { · 51 unmodified lines | |||
| 100 | mapping.insert(TYPE_FIELD, getType()); | 103 | mapping.insert(TYPE_FIELD, getType()); |
| 101 | mapping.insert(NAME_FIELD, _name->text()); | 104 | mapping.insert(NAME_FIELD, _name->text()); |
| 102 | mapping.insert(TEXDIR_FIELD, _textureDirectory->text()); | 105 | mapping.insert(TEXDIR_FIELD, _textureDirectory->text()); |
| 106 | mapping.insert(SCRIPT_FIELD, _scriptDirectory->text()); | ||
| 103 | mapping.insert(SCALE_FIELD, QString::number(_scale->value())); | 107 | mapping.insert(SCALE_FIELD, QString::number(_scale->value())); |
| 104 | 108 | ||
| 105 | // update the joint indices | 109 | // update the joint indices |
| @@ -157,6 +161,7 @@ void ModelPropertiesDialog::reset() { · 51 unmodified lines | |||
| 157 | _name->setText(_originalMapping.value(NAME_FIELD).toString()); | 161 | _name->setText(_originalMapping.value(NAME_FIELD).toString()); |
| 158 | _textureDirectory->setText(_originalMapping.value(TEXDIR_FIELD).toString()); | 162 | _textureDirectory->setText(_originalMapping.value(TEXDIR_FIELD).toString()); |
| 159 | _scale->setValue(_originalMapping.value(SCALE_FIELD).toDouble()); | 163 | _scale->setValue(_originalMapping.value(SCALE_FIELD).toDouble()); |
| 164 | _scriptDirectory->setText(_originalMapping.value(SCRIPT_FIELD).toString()); | ||
| 160 | 165 | ||
| 161 | QVariantHash jointHash = _originalMapping.value(JOINT_FIELD).toHash(); | 166 | QVariantHash jointHash = _originalMapping.value(JOINT_FIELD).toHash(); |
| 162 | 167 | ||
| @@ -207,6 +212,20 @@ void ModelPropertiesDialog::chooseTextureDirectory() { · 44 unmodified lines | |||
| 207 | _textureDirectory->setText(directory.length() == _basePath.length() ? "." : directory.mid(_basePath.length() + 1)); | 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 | void ModelPropertiesDialog::updatePivotJoint() { | 229 | void ModelPropertiesDialog::updatePivotJoint() { |
| 211 | _pivotJoint->setEnabled(!_pivotAboutCenter->isChecked()); | 230 | _pivotJoint->setEnabled(!_pivotAboutCenter->isChecked()); |
| 212 | } | 231 | } |