diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 2b75763875..8c36d4a867 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3138,6 +3138,9 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { glPopMatrix(); } + + // give external parties a change to hook in + emit renderingInWorldInterface(); } } diff --git a/interface/src/Application.h b/interface/src/Application.h index ae2638c230..7ecbb69084 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -210,6 +210,11 @@ public: void skipVersion(QString latestVersion); +signals: + + /// Fired when we're rendering in-world interface elements; allows external parties to hook in. + void renderingInWorldInterface(); + public slots: void domainChanged(const QString& domainHostname); void nodeKilled(SharedNodePointer node); diff --git a/interface/src/ui/MetavoxelEditorDialog.cpp b/interface/src/ui/MetavoxelEditorDialog.cpp index 1a1cac3adf..b21cfb0840 100644 --- a/interface/src/ui/MetavoxelEditorDialog.cpp +++ b/interface/src/ui/MetavoxelEditorDialog.cpp @@ -5,7 +5,9 @@ // Created by Andrzej Kapolka on 1/21/14. // Copyright (c) 2014 High Fidelity, Inc. All rights reserved. +#include #include +#include #include #include #include @@ -18,6 +20,10 @@ #include "Application.h" #include "MetavoxelEditorDialog.h" +enum GridPlane { + GRID_PLANE_XY, GRID_PLANE_XZ, GRID_PLANE_YZ +}; + MetavoxelEditorDialog::MetavoxelEditorDialog() : QDialog(Application::getInstance()->getGLWidget()) { @@ -41,6 +47,26 @@ MetavoxelEditorDialog::MetavoxelEditorDialog() : attributeLayout->addWidget(newAttribute); connect(newAttribute, SIGNAL(clicked()), SLOT(createNewAttribute())); + QFormLayout* formLayout = new QFormLayout(); + topLayout->addLayout(formLayout); + + formLayout->addRow("Grid Plane:", _gridPlane = new QComboBox()); + _gridPlane->addItem("X/Y"); + _gridPlane->addItem("X/Z"); + _gridPlane->addItem("Y/Z"); + _gridPlane->setCurrentIndex(GRID_PLANE_XZ); + + formLayout->addRow("Grid Spacing:", _gridSpacing = new QDoubleSpinBox()); + _gridSpacing->setValue(0.1); + _gridSpacing->setMaximum(FLT_MAX); + _gridSpacing->setSingleStep(0.01); + connect(_gridSpacing, SIGNAL(valueChanged(double)), SLOT(updateGridPosition())); + + formLayout->addRow("Grid Position:", _gridPosition = new QDoubleSpinBox()); + _gridPosition->setSingleStep(0.1); + _gridPosition->setMinimum(-FLT_MAX); + _gridPosition->setMaximum(FLT_MAX); + _value = new QGroupBox(); _value->setTitle("Value"); topLayout->addWidget(_value); @@ -50,6 +76,8 @@ MetavoxelEditorDialog::MetavoxelEditorDialog() : updateAttributes(); + connect(Application::getInstance(), SIGNAL(renderingInWorldInterface()), SLOT(render())); + show(); } @@ -100,6 +128,19 @@ void MetavoxelEditorDialog::createNewAttribute() { updateAttributes(nameText); } +void MetavoxelEditorDialog::updateGridPosition() { + // make sure our grid position matches our grid spacing + double step = _gridSpacing->value(); + if (step > 0.0) { + _gridPosition->setSingleStep(step); + _gridPosition->setValue(step * floor(_gridPosition->value() / step)); + } +} + +void MetavoxelEditorDialog::render() { + +} + void MetavoxelEditorDialog::updateAttributes(const QString& select) { // remember the selection in order to preserve it QString selected = select.isNull() ? getSelectedAttribute() : select; diff --git a/interface/src/ui/MetavoxelEditorDialog.h b/interface/src/ui/MetavoxelEditorDialog.h index 15eaac7801..530a858a94 100644 --- a/interface/src/ui/MetavoxelEditorDialog.h +++ b/interface/src/ui/MetavoxelEditorDialog.h @@ -11,6 +11,8 @@ #include +class QComboBox; +class QDoubleSpinBox; class QGroupBox; class QListWidget; @@ -26,6 +28,9 @@ private slots: void updateValueEditor(); void createNewAttribute(); + void updateGridPosition(); + + void render(); private: @@ -33,6 +38,9 @@ private: QString getSelectedAttribute() const; QListWidget* _attributes; + QComboBox* _gridPlane; + QDoubleSpinBox* _gridSpacing; + QDoubleSpinBox* _gridPosition; QGroupBox* _value; };