version 1.3.0

new QGLViewSettings structure for all view parameters
API for load/save it, automatic sync with ViewEditor
some clean
This commit is contained in:
2023-09-05 20:16:49 +03:00
parent 56a50715e2
commit 1ed6f12498
11 changed files with 164 additions and 143 deletions

View File

@@ -43,10 +43,29 @@ ViewEditor::ViewEditor(QWidget * parent): QWidget(parent) {
void ViewEditor::assignQGLView(QGLView * v) {
if (view) {
disconnect(view, nullptr, this, nullptr);
disconnect(view->scene(), nullptr, this, nullptr);
}
view = v;
if (!view) return;
active = false;
connect(view, &QGLView::settingsLoaded, this, &ViewEditor::setup);
connect(view->scene(), &Scene::presetChanged, this, [this](int p) { ui->labelPreset->setNum(p); });
setup();
}
void ViewEditor::changeEvent(QEvent * e) {
QWidget::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange: ui->retranslateUi(this); break;
default: break;
}
}
void ViewEditor::setup() {
active = false;
ui->labelPreset->setNum(view->scene()->preset());
ui->spinFOV->setValue(view->FOV());
ui->spinDepthStart->setValue(view->depthStart());
@@ -56,6 +75,8 @@ void ViewEditor::assignQGLView(QGLView * v) {
ui->spinSelectionHaloFill->setValue(view->selectionHaloFillAlpha());
ui->colorHoverHalo->setColor(view->hoverHaloColor());
ui->colorSelectionHalo->setColor(view->selectionHaloColor());
ui->spinViewGamma->setValue(view->gamma());
ui->checkAutoExposure->setChecked(view->autoExposure());
ui->checkFXAA->setChecked(view->FXAA());
ui->checkCameraOrbit->setChecked(view->isCameraOrbit());
ui->checkCameraLight->setCheckState((Qt::CheckState)view->cameraLightMode());
@@ -85,15 +106,6 @@ void ViewEditor::assignQGLView(QGLView * v) {
}
void ViewEditor::changeEvent(QEvent * e) {
QWidget::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange: ui->retranslateUi(this); break;
default: break;
}
}
void ViewEditor::on_spinFOV_valueChanged(double val) {
if (!view || !active) return;
view->setFOV(val);

View File

@@ -43,6 +43,7 @@ protected:
bool active = true;
private slots:
void setup();
void on_spinFOV_valueChanged(double val);
void on_spinDepthStart_valueChanged(double val);
void on_spinViewGamma_valueChanged(double val);