Added copyTo and pasteFrom to ClipboardScriptingInterface

- Supports LocalVoxels
This commit is contained in:
Atlante45 2014-02-27 16:41:58 -08:00
parent b07081407a
commit 5986fcafae
2 changed files with 23 additions and 0 deletions

View file

@ -5,6 +5,8 @@
// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
//
#include <LocalVoxelsList.h>
#include "Application.h"
#include "ClipboardScriptingInterface.h"
@ -92,3 +94,21 @@ void ClipboardScriptingInterface::nudgeVoxel(float x, float y, float z, float s,
Application::getInstance()->nudgeVoxelsByVector(sourceVoxel, nudgeVecInTreeSpace);
}
void ClipboardScriptingInterface::copyTo(float x, float y, float z, float s,
const QString source, const QString destination) {
StrongVoxelTreePointer sourceTree = LocalVoxelsList::getInstance()->getTree(source);
StrongVoxelTreePointer destinationTree = LocalVoxelsList::getInstance()->getTree(destination);
VoxelTreeElement* destinationNode = destinationTree->getVoxelAt(x, y, z, s);
destinationTree->copyFromTreeIntoSubTree(sourceTree.data(), destinationNode);
}
void ClipboardScriptingInterface::pasteFrom(float x, float y, float z, float s,
const QString source, const QString destination) {
StrongVoxelTreePointer sourceTree = LocalVoxelsList::getInstance()->getTree(source);
StrongVoxelTreePointer destinationTree = LocalVoxelsList::getInstance()->getTree(destination);
VoxelTreeElement* sourceNode = sourceTree->getVoxelAt(x, y, z, s);
destinationTree->copySubTreeIntoNewTree(sourceNode, destinationTree.data(), true);
}

View file

@ -38,6 +38,9 @@ public slots:
void nudgeVoxel(const VoxelDetail& sourceVoxel, const glm::vec3& nudgeVec);
void nudgeVoxel(float x, float y, float z, float s, const glm::vec3& nudgeVec);
void copyTo(float x, float y, float z, float s, const QString source, const QString destination);
void pasteFrom(float x, float y, float z, float s, const QString source, const QString destination);
};
#endif // __interface__Clipboard__