More work on the editor.

This commit is contained in:
Andrzej Kapolka 2014-01-21 17:20:12 -08:00
parent 5b4447d0b9
commit 230b66680f
4 changed files with 57 additions and 0 deletions

View file

@ -3138,6 +3138,9 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) {
glPopMatrix(); glPopMatrix();
} }
// give external parties a change to hook in
emit renderingInWorldInterface();
} }
} }

View file

@ -210,6 +210,11 @@ public:
void skipVersion(QString latestVersion); void skipVersion(QString latestVersion);
signals:
/// Fired when we're rendering in-world interface elements; allows external parties to hook in.
void renderingInWorldInterface();
public slots: public slots:
void domainChanged(const QString& domainHostname); void domainChanged(const QString& domainHostname);
void nodeKilled(SharedNodePointer node); void nodeKilled(SharedNodePointer node);

View file

@ -5,7 +5,9 @@
// Created by Andrzej Kapolka on 1/21/14. // Created by Andrzej Kapolka on 1/21/14.
// Copyright (c) 2014 High Fidelity, Inc. All rights reserved. // Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
#include <QComboBox>
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QDoubleSpinBox>
#include <QFormLayout> #include <QFormLayout>
#include <QGroupBox> #include <QGroupBox>
#include <QLineEdit> #include <QLineEdit>
@ -18,6 +20,10 @@
#include "Application.h" #include "Application.h"
#include "MetavoxelEditorDialog.h" #include "MetavoxelEditorDialog.h"
enum GridPlane {
GRID_PLANE_XY, GRID_PLANE_XZ, GRID_PLANE_YZ
};
MetavoxelEditorDialog::MetavoxelEditorDialog() : MetavoxelEditorDialog::MetavoxelEditorDialog() :
QDialog(Application::getInstance()->getGLWidget()) { QDialog(Application::getInstance()->getGLWidget()) {
@ -41,6 +47,26 @@ MetavoxelEditorDialog::MetavoxelEditorDialog() :
attributeLayout->addWidget(newAttribute); attributeLayout->addWidget(newAttribute);
connect(newAttribute, SIGNAL(clicked()), SLOT(createNewAttribute())); 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 = new QGroupBox();
_value->setTitle("Value"); _value->setTitle("Value");
topLayout->addWidget(_value); topLayout->addWidget(_value);
@ -50,6 +76,8 @@ MetavoxelEditorDialog::MetavoxelEditorDialog() :
updateAttributes(); updateAttributes();
connect(Application::getInstance(), SIGNAL(renderingInWorldInterface()), SLOT(render()));
show(); show();
} }
@ -100,6 +128,19 @@ void MetavoxelEditorDialog::createNewAttribute() {
updateAttributes(nameText); 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) { void MetavoxelEditorDialog::updateAttributes(const QString& select) {
// remember the selection in order to preserve it // remember the selection in order to preserve it
QString selected = select.isNull() ? getSelectedAttribute() : select; QString selected = select.isNull() ? getSelectedAttribute() : select;

View file

@ -11,6 +11,8 @@
#include <QDialog> #include <QDialog>
class QComboBox;
class QDoubleSpinBox;
class QGroupBox; class QGroupBox;
class QListWidget; class QListWidget;
@ -26,6 +28,9 @@ private slots:
void updateValueEditor(); void updateValueEditor();
void createNewAttribute(); void createNewAttribute();
void updateGridPosition();
void render();
private: private:
@ -33,6 +38,9 @@ private:
QString getSelectedAttribute() const; QString getSelectedAttribute() const;
QListWidget* _attributes; QListWidget* _attributes;
QComboBox* _gridPlane;
QDoubleSpinBox* _gridSpacing;
QDoubleSpinBox* _gridPosition;
QGroupBox* _value; QGroupBox* _value;
}; };