mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 08:21:24 +02:00
Added erase buttons, initialize color editor on creation.
This commit is contained in:
parent
70847ff3f9
commit
5d2f6b98e2
3 changed files with 27 additions and 2 deletions
|
@ -1344,8 +1344,14 @@ VoxelMaterialBoxTool::VoxelMaterialBoxTool(MetavoxelEditor* editor) :
|
||||||
form->addRow(gridLayout);
|
form->addRow(gridLayout);
|
||||||
_snapToGrid->setChecked(true);
|
_snapToGrid->setChecked(true);
|
||||||
|
|
||||||
form->addRow("Color:", _color = new QColorEditor(this));
|
QHBoxLayout* colorLayout = new QHBoxLayout();
|
||||||
|
form->addRow("Color:", colorLayout);
|
||||||
|
colorLayout->addWidget(_color = new QColorEditor(this), 1);
|
||||||
connect(_color, &QColorEditor::colorChanged, this, &VoxelMaterialBoxTool::clearTexture);
|
connect(_color, &QColorEditor::colorChanged, this, &VoxelMaterialBoxTool::clearTexture);
|
||||||
|
QPushButton* eraseButton = new QPushButton("Erase");
|
||||||
|
colorLayout->addWidget(eraseButton);
|
||||||
|
connect(eraseButton, &QPushButton::clicked, this, &VoxelMaterialBoxTool::clearColor);
|
||||||
|
|
||||||
form->addRow(_materialEditor = new SharedObjectEditor(&MaterialObject::staticMetaObject, false));
|
form->addRow(_materialEditor = new SharedObjectEditor(&MaterialObject::staticMetaObject, false));
|
||||||
connect(_materialEditor, &SharedObjectEditor::objectChanged, this, &VoxelMaterialBoxTool::updateTexture);
|
connect(_materialEditor, &SharedObjectEditor::objectChanged, this, &VoxelMaterialBoxTool::updateTexture);
|
||||||
}
|
}
|
||||||
|
@ -1376,6 +1382,11 @@ void VoxelMaterialBoxTool::applyValue(const glm::vec3& minimum, const glm::vec3&
|
||||||
Application::getInstance()->getMetavoxels()->applyEdit(message, true);
|
Application::getInstance()->getMetavoxels()->applyEdit(message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VoxelMaterialBoxTool::clearColor() {
|
||||||
|
_color->setColor(QColor(0, 0, 0, 0));
|
||||||
|
clearTexture();
|
||||||
|
}
|
||||||
|
|
||||||
void VoxelMaterialBoxTool::clearTexture() {
|
void VoxelMaterialBoxTool::clearTexture() {
|
||||||
_materialEditor->setObject(new MaterialObject());
|
_materialEditor->setObject(new MaterialObject());
|
||||||
}
|
}
|
||||||
|
@ -1465,8 +1476,14 @@ bool SphereTool::eventFilter(QObject* watched, QEvent* event) {
|
||||||
VoxelMaterialSphereTool::VoxelMaterialSphereTool(MetavoxelEditor* editor) :
|
VoxelMaterialSphereTool::VoxelMaterialSphereTool(MetavoxelEditor* editor) :
|
||||||
SphereTool(editor, "Set Voxel Material (Sphere)") {
|
SphereTool(editor, "Set Voxel Material (Sphere)") {
|
||||||
|
|
||||||
_form->addRow("Color:", _color = new QColorEditor(this));
|
QHBoxLayout* colorLayout = new QHBoxLayout();
|
||||||
|
_form->addRow("Color:", colorLayout);
|
||||||
|
colorLayout->addWidget(_color = new QColorEditor(this), 1);
|
||||||
connect(_color, &QColorEditor::colorChanged, this, &VoxelMaterialSphereTool::clearTexture);
|
connect(_color, &QColorEditor::colorChanged, this, &VoxelMaterialSphereTool::clearTexture);
|
||||||
|
QPushButton* eraseButton = new QPushButton("Erase");
|
||||||
|
colorLayout->addWidget(eraseButton);
|
||||||
|
connect(eraseButton, &QPushButton::clicked, this, &VoxelMaterialSphereTool::clearColor);
|
||||||
|
|
||||||
_form->addRow(_materialEditor = new SharedObjectEditor(&MaterialObject::staticMetaObject, false));
|
_form->addRow(_materialEditor = new SharedObjectEditor(&MaterialObject::staticMetaObject, false));
|
||||||
connect(_materialEditor, &SharedObjectEditor::objectChanged, this, &VoxelMaterialSphereTool::updateTexture);
|
connect(_materialEditor, &SharedObjectEditor::objectChanged, this, &VoxelMaterialSphereTool::updateTexture);
|
||||||
}
|
}
|
||||||
|
@ -1493,6 +1510,11 @@ void VoxelMaterialSphereTool::applyValue(const glm::vec3& position, float radius
|
||||||
Application::getInstance()->getMetavoxels()->applyEdit(message, true);
|
Application::getInstance()->getMetavoxels()->applyEdit(message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VoxelMaterialSphereTool::clearColor() {
|
||||||
|
_color->setColor(QColor(0, 0, 0, 0));
|
||||||
|
clearTexture();
|
||||||
|
}
|
||||||
|
|
||||||
void VoxelMaterialSphereTool::clearTexture() {
|
void VoxelMaterialSphereTool::clearTexture() {
|
||||||
_materialEditor->setObject(new MaterialObject());
|
_materialEditor->setObject(new MaterialObject());
|
||||||
}
|
}
|
||||||
|
|
|
@ -422,6 +422,7 @@ protected:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
|
void clearColor();
|
||||||
void clearTexture();
|
void clearTexture();
|
||||||
void updateTexture();
|
void updateTexture();
|
||||||
void textureLoaded();
|
void textureLoaded();
|
||||||
|
@ -476,6 +477,7 @@ protected:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
|
void clearColor();
|
||||||
void clearTexture();
|
void clearTexture();
|
||||||
void updateTexture();
|
void updateTexture();
|
||||||
void textureLoaded();
|
void textureLoaded();
|
||||||
|
|
|
@ -490,6 +490,7 @@ QColorEditor::QColorEditor(QWidget* parent) : QWidget(parent) {
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
layout->addWidget(_button = new QPushButton());
|
layout->addWidget(_button = new QPushButton());
|
||||||
connect(_button, SIGNAL(clicked()), SLOT(selectColor()));
|
connect(_button, SIGNAL(clicked()), SLOT(selectColor()));
|
||||||
|
setColor(QColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QColorEditor::setColor(const QColor& color) {
|
void QColorEditor::setColor(const QColor& color) {
|
||||||
|
|
Loading…
Reference in a new issue