Showing the changes to interface/src/scripting/ClipboardScriptingInterface.cpp (1 of 9 files). Show all
Unified · Split
| @@ -87,6 +87,37 @@ bool ClipboardScriptingInterface::importVoxels() { · 86 unmodified lines | |||
| 87 | return Application::getInstance()->getImportSucceded(); | 87 | return Application::getInstance()->getImportSucceded(); |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | bool ClipboardScriptingInterface::importVoxels(const QString& filename) { | ||
| 91 | qDebug() << "Importing ... "; | ||
| 92 | |||
| 93 | VoxelImporter* importer = Application::getInstance()->getVoxelImporter(); | ||
| 94 | |||
| 95 | if (!importer->validImportFile(filename)) { | ||
| 96 | return false; | ||
| 97 | } | ||
| 98 | |||
| 99 | QEventLoop loop; | ||
| 100 | connect(importer, SIGNAL(importDone()), &loop, SLOT(quit())); | ||
| 101 | importer->import(filename); | ||
| 102 | loop.exec(); | ||
| 103 | |||
| 104 | return true; | ||
| 105 | } | ||
| 106 | |||
| 107 | bool ClipboardScriptingInterface::importVoxels(const QString& filename, float x, float y, float z, float s) { | ||
| 108 | bool success = importVoxels(filename); | ||
| 109 | |||
| 110 | if (success) { | ||
| 111 | pasteVoxel(x, y, z, s); | ||
| 112 | } | ||
| 113 | |||
| 114 | return success; | ||
| 115 | } | ||
| 116 | |||
| 117 | bool ClipboardScriptingInterface::importVoxels(const QString& filename, const VoxelDetail& destinationVoxel) { | ||
| 118 | return importVoxels(filename, destinationVoxel.x, destinationVoxel.y, destinationVoxel.z, destinationVoxel.s); | ||
| 119 | } | ||
| 120 | |||
| 90 | void ClipboardScriptingInterface::nudgeVoxel(const VoxelDetail& sourceVoxel, const glm::vec3& nudgeVec) { | 121 | void ClipboardScriptingInterface::nudgeVoxel(const VoxelDetail& sourceVoxel, const glm::vec3& nudgeVec) { |
| 91 | nudgeVoxel(sourceVoxel.x, sourceVoxel.y, sourceVoxel.z, sourceVoxel.s, nudgeVec); | 122 | nudgeVoxel(sourceVoxel.x, sourceVoxel.y, sourceVoxel.z, sourceVoxel.s, nudgeVec); |
| 92 | } | 123 | } |