mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 19:04:32 +02:00
add Paste To Voxel
This commit is contained in:
parent
1d272c333a
commit
34668e8716
4 changed files with 54 additions and 15 deletions
|
@ -1603,22 +1603,11 @@ void Application::copyVoxels() {
|
|||
}
|
||||
}
|
||||
|
||||
void Application::pasteVoxels() {
|
||||
unsigned char* calculatedOctCode = NULL;
|
||||
VoxelNode* selectedNode = _voxels.getVoxelAt(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s);
|
||||
|
||||
void Application::pasteVoxelsToOctalCode(const unsigned char* octalCodeDestination) {
|
||||
// Recurse the clipboard tree, where everything is root relative, and send all the colored voxels to
|
||||
// the server as an set voxel message, this will also rebase the voxels to the new location
|
||||
SendVoxelsOperationArgs args;
|
||||
|
||||
// we only need the selected voxel to get the newBaseOctCode, which we can actually calculate from the
|
||||
// voxel size/position details. If we don't have an actual selectedNode then use the mouseVoxel to create a
|
||||
// target octalCode for where the user is pointing.
|
||||
if (selectedNode) {
|
||||
args.newBaseOctCode = selectedNode->getOctalCode();
|
||||
} else {
|
||||
args.newBaseOctCode = calculatedOctCode = pointToVoxel(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s);
|
||||
}
|
||||
args.newBaseOctCode = octalCodeDestination;
|
||||
|
||||
_sharedVoxelSystem.getTree()->recurseTreeWithOperation(sendVoxelsOperation, &args);
|
||||
|
||||
|
@ -1628,6 +1617,23 @@ void Application::pasteVoxels() {
|
|||
}
|
||||
|
||||
_voxelEditSender.releaseQueuedMessages();
|
||||
}
|
||||
|
||||
void Application::pasteVoxels() {
|
||||
unsigned char* calculatedOctCode = NULL;
|
||||
VoxelNode* selectedNode = _voxels.getVoxelAt(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s);
|
||||
|
||||
// we only need the selected voxel to get the newBaseOctCode, which we can actually calculate from the
|
||||
// voxel size/position details. If we don't have an actual selectedNode then use the mouseVoxel to create a
|
||||
// target octalCode for where the user is pointing.
|
||||
const unsigned char* octalCodeDestination;
|
||||
if (selectedNode) {
|
||||
octalCodeDestination = selectedNode->getOctalCode();
|
||||
} else {
|
||||
octalCodeDestination = calculatedOctCode = pointToVoxel(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s);
|
||||
}
|
||||
|
||||
pasteVoxelsToOctalCode(octalCodeDestination);
|
||||
|
||||
if (calculatedOctCode) {
|
||||
delete[] calculatedOctCode;
|
||||
|
|
|
@ -171,7 +171,7 @@ public:
|
|||
|
||||
glm::vec2 getViewportDimensions() const{ return glm::vec2(_glWidget->width(),_glWidget->height()); }
|
||||
NodeToJurisdictionMap& getVoxelServerJurisdictions() { return _voxelServerJurisdictions; }
|
||||
|
||||
void pasteVoxelsToOctalCode(const unsigned char* octalCodeDestination);
|
||||
|
||||
public slots:
|
||||
void sendAvatarFaceVideoMessage(int frameCount, const QByteArray& data);
|
||||
|
|
|
@ -486,7 +486,11 @@ Menu::Menu() :
|
|||
addCheckableActionToQMenuAndActionHash(voxelProtoOptionsMenu, MenuOption::DestructiveAddVoxel);
|
||||
|
||||
addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::ExtraDebugging);
|
||||
|
||||
addActionToQMenuAndActionHash(developerMenu, MenuOption::PasteToVoxel,
|
||||
Qt::CTRL | Qt::SHIFT | Qt::Key_V,
|
||||
this,
|
||||
SLOT(pasteToVoxel()));
|
||||
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
QMenu* helpMenu = addMenu("Help");
|
||||
|
@ -958,6 +962,33 @@ void Menu::goToUser() {
|
|||
sendFakeEnterEvent();
|
||||
}
|
||||
|
||||
void Menu::pasteToVoxel() {
|
||||
QInputDialog pasteToOctalCodeDialog(Application::getInstance()->getWindow());
|
||||
pasteToOctalCodeDialog.setWindowTitle("Paste to Voxel");
|
||||
pasteToOctalCodeDialog.setLabelText("Octal Code:");
|
||||
QString octalCode = "";
|
||||
pasteToOctalCodeDialog.setTextValue(octalCode);
|
||||
pasteToOctalCodeDialog.setWindowFlags(Qt::Sheet);
|
||||
pasteToOctalCodeDialog.resize(pasteToOctalCodeDialog.parentWidget()->size().width() * DIALOG_RATIO_OF_WINDOW,
|
||||
pasteToOctalCodeDialog.size().height());
|
||||
|
||||
int dialogReturn = pasteToOctalCodeDialog.exec();
|
||||
if (dialogReturn == QDialog::Accepted && !pasteToOctalCodeDialog.textValue().isEmpty()) {
|
||||
// we got an octalCode to paste to...
|
||||
QString locationToPaste = pasteToOctalCodeDialog.textValue();
|
||||
unsigned char* octalCodeDestination = hexStringToOctalCode(locationToPaste);
|
||||
|
||||
// check to see if it was a legit octcode...
|
||||
if (locationToPaste == octalCodeToHexString(octalCodeDestination)) {
|
||||
Application::getInstance()->pasteVoxelsToOctalCode(octalCodeDestination);
|
||||
} else {
|
||||
qDebug() << "problem with octcode...\n";
|
||||
}
|
||||
}
|
||||
|
||||
sendFakeEnterEvent();
|
||||
}
|
||||
|
||||
void Menu::bandwidthDetails() {
|
||||
if (! _bandwidthDialog) {
|
||||
_bandwidthDialog = new BandwidthDialog(Application::getInstance()->getGLWidget(),
|
||||
|
|
|
@ -76,6 +76,7 @@ public slots:
|
|||
void importSettings();
|
||||
void exportSettings();
|
||||
void goToUser();
|
||||
void pasteToVoxel();
|
||||
|
||||
private slots:
|
||||
void aboutApp();
|
||||
|
@ -212,6 +213,7 @@ namespace MenuOption {
|
|||
const QString Oscilloscope = "Audio Oscilloscope";
|
||||
const QString Pair = "Pair";
|
||||
const QString PasteVoxels = "Paste";
|
||||
const QString PasteToVoxel = "Paste to Voxel...";
|
||||
const QString PipelineWarnings = "Show Render Pipeline Warnings";
|
||||
const QString Preferences = "Preferences...";
|
||||
const QString RandomizeVoxelColors = "Randomize Voxel TRUE Colors";
|
||||
|
|
Loading…
Reference in a new issue