History

Added copyTo and pasteFrom to ClipboardScriptingInterface - Supports LocalVoxels

Atlante45 committed 12 years ago

Commit 5986fca1 parent b0708142 files · +23 −0Browse files

Showing the changes to interface/src/ClipboardScriptingInterface.cpp (1 of 2 files). Show all

Unified · Split

interface/src/ClipboardScriptingInterface.cpp+20−0
@@ -5,6 +5,8 @@ · 4 unmodified lines
5// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.5// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
6//6//
7 7
8#include <LocalVoxelsList.h>
9
8#include "Application.h"10#include "Application.h"
9#include "ClipboardScriptingInterface.h"11#include "ClipboardScriptingInterface.h"
10 12
@@ -92,3 +94,21 @@ void ClipboardScriptingInterface::nudgeVoxel(float x, float y, float z, float s, · 81 unmodified lines
92 Application::getInstance()->nudgeVoxelsByVector(sourceVoxel, nudgeVecInTreeSpace);94 Application::getInstance()->nudgeVoxelsByVector(sourceVoxel, nudgeVecInTreeSpace);
93}95}
94 96
97void ClipboardScriptingInterface::copyTo(float x, float y, float z, float s,
98 const QString source, const QString destination) {
99 StrongVoxelTreePointer sourceTree = LocalVoxelsList::getInstance()->getTree(source);
100 StrongVoxelTreePointer destinationTree = LocalVoxelsList::getInstance()->getTree(destination);
101
102 VoxelTreeElement* destinationNode = destinationTree->getVoxelAt(x, y, z, s);
103 destinationTree->copyFromTreeIntoSubTree(sourceTree.data(), destinationNode);
104
105}
106
107void ClipboardScriptingInterface::pasteFrom(float x, float y, float z, float s,
108 const QString source, const QString destination) {
109 StrongVoxelTreePointer sourceTree = LocalVoxelsList::getInstance()->getTree(source);
110 StrongVoxelTreePointer destinationTree = LocalVoxelsList::getInstance()->getTree(destination);
111
112 VoxelTreeElement* sourceNode = sourceTree->getVoxelAt(x, y, z, s);
113 destinationTree->copySubTreeIntoNewTree(sourceNode, destinationTree.data(), true);
114}