New paste behaviour
Showing the changes to interface/src/Application.cpp (1 of 4 files). Show all
Unified · Split
| @@ -495,6 +495,11 @@ void Application::keyPressEvent(QKeyEvent* event) { · 494 unmodified lines | |||
| 495 | 495 | ||
| 496 | bool isShifted = event->modifiers().testFlag(Qt::ShiftModifier); | 496 | bool isShifted = event->modifiers().testFlag(Qt::ShiftModifier); |
| 497 | switch (event->key()) { | 497 | switch (event->key()) { |
| 498 | case Qt::Key_Shift: | ||
| 499 | if (Menu::getInstance()->isOptionChecked(MenuOption::VoxelSelectMode)) { | ||
| 500 | _pasteMode = true; | ||
| 501 | } | ||
| 502 | break; | ||
| 498 | case Qt::Key_BracketLeft: | 503 | case Qt::Key_BracketLeft: |
| 499 | case Qt::Key_BracketRight: | 504 | case Qt::Key_BracketRight: |
| 500 | case Qt::Key_BraceLeft: | 505 | case Qt::Key_BraceLeft: |
| @@ -726,6 +731,9 @@ void Application::keyReleaseEvent(QKeyEvent* event) { · 225 unmodified lines | |||
| 726 | } | 731 | } |
| 727 | 732 | ||
| 728 | switch (event->key()) { | 733 | switch (event->key()) { |
| 734 | case Qt::Key_Shift: | ||
| 735 | _pasteMode = false; | ||
| 736 | break; | ||
| 729 | case Qt::Key_E: | 737 | case Qt::Key_E: |
| 730 | _myAvatar.setDriveKeys(UP, 0); | 738 | _myAvatar.setDriveKeys(UP, 0); |
| 731 | break; | 739 | break; |
| @@ -1201,22 +1209,17 @@ void Application::exportVoxels() { · 469 unmodified lines | |||
| 1201 | } | 1209 | } |
| 1202 | 1210 | ||
| 1203 | void Application::importVoxels() { | 1211 | void Application::importVoxels() { |
| 1204 | _pasteMode = false; | ||
| 1205 | |||
| 1206 | if (_voxelImporter.exec()) { | 1212 | if (_voxelImporter.exec()) { |
| 1207 | qDebug("[DEBUG] Import succedded.\n"); | 1213 | qDebug("[DEBUG] Import succedded.\n"); |
| 1208 | 1214 | ||
| 1209 | if (_voxelImporter.getimportIntoClipboard()) { | 1215 | if (_voxelImporter.getImportIntoClipboard()) { |
| 1210 | _clipboard.killLocalVoxels(); | 1216 | _clipboard.killLocalVoxels(); |
| 1211 | _voxelImporter.getVoxelSystem()->copySubTreeIntoNewTree( | 1217 | _voxelImporter.getVoxelSystem()->copySubTreeIntoNewTree( |
| 1212 | _voxelImporter.getVoxelSystem()->getVoxelAt(0, 0, 0, 1), | 1218 | _voxelImporter.getVoxelSystem()->getVoxelAt(0, 0, 0, 1), |
| 1213 | &_clipboard, | 1219 | &_clipboard, |
| 1214 | true); | 1220 | true); |
| 1215 | } else { | 1221 | _voxelImporter.reset(); |
| 1216 | _pasteMode = true; | ||
| 1217 | } | 1222 | } |
| 1218 | |||
| 1219 | |||
| 1220 | } else { | 1223 | } else { |
| 1221 | qDebug("[DEBUG] Import failed.\n"); | 1224 | qDebug("[DEBUG] Import failed.\n"); |
| 1222 | } | 1225 | } |
| @@ -1239,12 +1242,6 @@ void Application::copyVoxels() { · 16 unmodified lines | |||
| 1239 | // then copy onto it | 1242 | // then copy onto it |
| 1240 | _voxels.copySubTreeIntoNewTree(selectedNode, &_clipboard, true); | 1243 | _voxels.copySubTreeIntoNewTree(selectedNode, &_clipboard, true); |
| 1241 | } | 1244 | } |
| 1242 | |||
| 1243 | _pasteMode = false; | ||
| 1244 | } | ||
| 1245 | |||
| 1246 | void Application::togglePasteMode() { | ||
| 1247 | _pasteMode = !_pasteMode; | ||
| 1248 | } | 1245 | } |
| 1249 | 1246 | ||
| 1250 | void Application::pasteVoxels() { | 1247 | void Application::pasteVoxels() { |