mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 04:03:35 +02:00
Merge pull request #1261 from ZappoMan/paste_to_octalcode
add Paste To Voxel
This commit is contained in:
commit
82649a9a49
4 changed files with 54 additions and 15 deletions
|
@ -1603,22 +1603,11 @@ void Application::copyVoxels() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::pasteVoxels() {
|
void Application::pasteVoxelsToOctalCode(const unsigned char* octalCodeDestination) {
|
||||||
unsigned char* calculatedOctCode = NULL;
|
|
||||||
VoxelNode* selectedNode = _voxels.getVoxelAt(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s);
|
|
||||||
|
|
||||||
// Recurse the clipboard tree, where everything is root relative, and send all the colored voxels to
|
// 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
|
// the server as an set voxel message, this will also rebase the voxels to the new location
|
||||||
SendVoxelsOperationArgs args;
|
SendVoxelsOperationArgs args;
|
||||||
|
args.newBaseOctCode = octalCodeDestination;
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
_sharedVoxelSystem.getTree()->recurseTreeWithOperation(sendVoxelsOperation, &args);
|
_sharedVoxelSystem.getTree()->recurseTreeWithOperation(sendVoxelsOperation, &args);
|
||||||
|
|
||||||
|
@ -1628,6 +1617,23 @@ void Application::pasteVoxels() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_voxelEditSender.releaseQueuedMessages();
|
_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) {
|
if (calculatedOctCode) {
|
||||||
delete[] calculatedOctCode;
|
delete[] calculatedOctCode;
|
||||||
|
|
|
@ -171,7 +171,7 @@ public:
|
||||||
|
|
||||||
glm::vec2 getViewportDimensions() const{ return glm::vec2(_glWidget->width(),_glWidget->height()); }
|
glm::vec2 getViewportDimensions() const{ return glm::vec2(_glWidget->width(),_glWidget->height()); }
|
||||||
NodeToJurisdictionMap& getVoxelServerJurisdictions() { return _voxelServerJurisdictions; }
|
NodeToJurisdictionMap& getVoxelServerJurisdictions() { return _voxelServerJurisdictions; }
|
||||||
|
void pasteVoxelsToOctalCode(const unsigned char* octalCodeDestination);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void sendAvatarFaceVideoMessage(int frameCount, const QByteArray& data);
|
void sendAvatarFaceVideoMessage(int frameCount, const QByteArray& data);
|
||||||
|
|
|
@ -486,7 +486,11 @@ Menu::Menu() :
|
||||||
addCheckableActionToQMenuAndActionHash(voxelProtoOptionsMenu, MenuOption::DestructiveAddVoxel);
|
addCheckableActionToQMenuAndActionHash(voxelProtoOptionsMenu, MenuOption::DestructiveAddVoxel);
|
||||||
|
|
||||||
addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::ExtraDebugging);
|
addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::ExtraDebugging);
|
||||||
|
addActionToQMenuAndActionHash(developerMenu, MenuOption::PasteToVoxel,
|
||||||
|
Qt::CTRL | Qt::SHIFT | Qt::Key_V,
|
||||||
|
this,
|
||||||
|
SLOT(pasteToVoxel()));
|
||||||
|
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
QMenu* helpMenu = addMenu("Help");
|
QMenu* helpMenu = addMenu("Help");
|
||||||
|
@ -958,6 +962,33 @@ void Menu::goToUser() {
|
||||||
sendFakeEnterEvent();
|
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() {
|
void Menu::bandwidthDetails() {
|
||||||
if (! _bandwidthDialog) {
|
if (! _bandwidthDialog) {
|
||||||
_bandwidthDialog = new BandwidthDialog(Application::getInstance()->getGLWidget(),
|
_bandwidthDialog = new BandwidthDialog(Application::getInstance()->getGLWidget(),
|
||||||
|
|
|
@ -76,6 +76,7 @@ public slots:
|
||||||
void importSettings();
|
void importSettings();
|
||||||
void exportSettings();
|
void exportSettings();
|
||||||
void goToUser();
|
void goToUser();
|
||||||
|
void pasteToVoxel();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void aboutApp();
|
void aboutApp();
|
||||||
|
@ -212,6 +213,7 @@ namespace MenuOption {
|
||||||
const QString Oscilloscope = "Audio Oscilloscope";
|
const QString Oscilloscope = "Audio Oscilloscope";
|
||||||
const QString Pair = "Pair";
|
const QString Pair = "Pair";
|
||||||
const QString PasteVoxels = "Paste";
|
const QString PasteVoxels = "Paste";
|
||||||
|
const QString PasteToVoxel = "Paste to Voxel...";
|
||||||
const QString PipelineWarnings = "Show Render Pipeline Warnings";
|
const QString PipelineWarnings = "Show Render Pipeline Warnings";
|
||||||
const QString Preferences = "Preferences...";
|
const QString Preferences = "Preferences...";
|
||||||
const QString RandomizeVoxelColors = "Randomize Voxel TRUE Colors";
|
const QString RandomizeVoxelColors = "Randomize Voxel TRUE Colors";
|
||||||
|
|
Loading…
Reference in a new issue