11#include " MainQt.h"
22#include " App.h"
33#include " nodegraph/NodeGraphDock.hpp"
4- #include " runtime/RenderSettingsController.hpp"
54#include " util/UiTheme.hpp"
65#include " VulkanWindow.hpp"
76
87#include < QAction>
98#include < QApplication>
10- #include < QCheckBox>
119#include < QCloseEvent>
12- #include < QComboBox>
13- #include < QDoubleSpinBox>
1410#include < QFileDialog>
1511#include < QHBoxLayout>
16- #include < QLabel>
1712#include < QMenu>
1813#include < QMenuBar>
1914#include < QMessageBox>
@@ -38,7 +33,6 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) {
3833 setStyleSheet (QString::fromStdString (ui::splitterStyleSheet ()));
3934
4035 createMenuBar ();
41- createDockWidget ();
4236 createNodeGraphDock ();
4337
4438 QWidget* centralHost = new QWidget (this );
@@ -71,16 +65,9 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) {
7165 viewportHost->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
7266 mainSplitter->addWidget (viewportHost);
7367
74- if (controlsPanel) {
75- controlsPanel->setMinimumWidth (160 );
76- controlsPanel->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Expanding);
77- mainSplitter->addWidget (controlsPanel);
78- }
79-
8068 mainSplitter->setStretchFactor (0 , 0 );
8169 mainSplitter->setStretchFactor (1 , 1 );
82- mainSplitter->setStretchFactor (2 , 0 );
83- mainSplitter->setSizes ({320 , 880 , 220 });
70+ mainSplitter->setSizes ({320 , 1100 });
8471
8572 setCentralWidget (centralHost);
8673 connect (mainSplitter, &QSplitter::splitterMoved, this , [this ](int , int ) {
@@ -114,7 +101,6 @@ void MainWindow::setApp(App* application) {
114101 if (viewportWindow) {
115102 viewportWindow->setApp (app);
116103 }
117- settingsController = app ? app->getSettingsController () : nullptr ;
118104 if (nodeGraphDock) {
119105 boundRuntimeQuery = app ? app->runtimeQuery () : nullptr ;
120106 nodeGraphDock->setRuntimeQuery (boundRuntimeQuery);
@@ -176,12 +162,6 @@ void MainWindow::createMenuBar() {
176162
177163 QMenu* viewMenu = menuBar->addMenu (" &View" );
178164
179- remeshOverlayAction = new QAction (" &Remesh Overlay" , this );
180- remeshOverlayAction->setCheckable (true );
181- remeshOverlayAction->setShortcut (Qt::Key_C);
182- connect (remeshOverlayAction, &QAction::triggered, this , &MainWindow::onIntrinsicToggled);
183- viewMenu->addAction (remeshOverlayAction);
184-
185165 nodeGraphAction = new QAction (" Node &Graph" , this );
186166 nodeGraphAction->setCheckable (true );
187167 nodeGraphAction->setChecked (true );
@@ -191,98 +171,6 @@ void MainWindow::createMenuBar() {
191171 viewMenu->addAction (nodeGraphAction);
192172}
193173
194- void MainWindow::createDockWidget () {
195- controlsPanel = new QWidget (this );
196- controlsPanel->setObjectName (" ControlsPanel" );
197- QVBoxLayout* layout = new QVBoxLayout ();
198- layout->setContentsMargins (8 , 8 , 8 , 8 );
199- layout->setSpacing (6 );
200-
201- QLabel* viewLabel = new QLabel (" <b>View Options</b>" );
202- layout->addWidget (viewLabel);
203-
204- wireframeModeCombo = new QComboBox ();
205- wireframeModeCombo->addItem (" Normal" );
206- wireframeModeCombo->addItem (" Wireframe" );
207- wireframeModeCombo->addItem (" Shaded Wire" );
208- wireframeModeCombo->setCurrentIndex (0 );
209- connect (wireframeModeCombo, QOverload<int >::of (&QComboBox::currentIndexChanged),
210- this , &MainWindow::onWireframeModeChanged);
211- layout->addWidget (wireframeModeCombo);
212-
213- intrinsicCheck = new QCheckBox (" Remesh Overlay (Ctrl+C)" );
214- connect (intrinsicCheck, &QCheckBox::toggled, this , &MainWindow::onIntrinsicToggled);
215- layout->addWidget (intrinsicCheck);
216-
217- heatOverlayCheck = new QCheckBox (" Heat Overlay (Ctrl+V)" );
218- connect (heatOverlayCheck, &QCheckBox::toggled, this , &MainWindow::onHeatOverlayToggled);
219- layout->addWidget (heatOverlayCheck);
220-
221- intrinsicNormalsCheck = new QCheckBox (" Normal Vectors" );
222- connect (intrinsicNormalsCheck, &QCheckBox::toggled, this , &MainWindow::onIntrinsicNormalsToggled);
223- layout->addWidget (intrinsicNormalsCheck);
224-
225- intrinsicVertexNormalsCheck = new QCheckBox (" Vertex Normals" );
226- connect (intrinsicVertexNormalsCheck, &QCheckBox::toggled, this , &MainWindow::onIntrinsicVertexNormalsToggled);
227- layout->addWidget (intrinsicVertexNormalsCheck);
228-
229- QHBoxLayout* normalLengthLayout = new QHBoxLayout ();
230- QLabel* normalLengthLabel = new QLabel (" Normal Length:" );
231- normalLengthLayout->addWidget (normalLengthLabel);
232-
233- normalLengthSpinBox = new QDoubleSpinBox ();
234- normalLengthSpinBox->setMinimum (0.001 );
235- normalLengthSpinBox->setMaximum (10.0 );
236- normalLengthSpinBox->setValue (0.05 );
237- normalLengthSpinBox->setSingleStep (0.01 );
238- normalLengthSpinBox->setDecimals (3 );
239- normalLengthSpinBox->setToolTip (" Length of normal vectors for visualization" );
240- connect (normalLengthSpinBox, QOverload<double >::of (&QDoubleSpinBox::valueChanged),
241- this , &MainWindow::onNormalLengthChanged);
242- normalLengthLayout->addWidget (normalLengthSpinBox);
243- normalLengthLayout->addStretch ();
244- layout->addLayout (normalLengthLayout);
245-
246- QHBoxLayout* panSensLayout = new QHBoxLayout ();
247- QLabel* panSensLabel = new QLabel (" Pan Sensitivity:" );
248- panSensLayout->addWidget (panSensLabel);
249-
250- panSensitivitySpinBox = new QDoubleSpinBox ();
251- panSensitivitySpinBox->setMinimum (0.0 );
252- panSensitivitySpinBox->setMaximum (10.0 );
253- panSensitivitySpinBox->setValue (1.0 );
254- panSensitivitySpinBox->setSingleStep (0.1 );
255- panSensitivitySpinBox->setDecimals (2 );
256- panSensitivitySpinBox->setToolTip (" Sensitivity of camera panning (Default: 1.0)" );
257- connect (panSensitivitySpinBox, QOverload<double >::of (&QDoubleSpinBox::valueChanged),
258- this , &MainWindow::onPanSensitivityChanged);
259- panSensLayout->addWidget (panSensitivitySpinBox);
260- panSensLayout->addStretch ();
261- layout->addLayout (panSensLayout);
262-
263- layout->addSpacing (10 );
264-
265- surfelsCheck = new QCheckBox (" Show Surfels" );
266- connect (surfelsCheck, &QCheckBox::toggled, this , &MainWindow::onSurfelsToggled);
267- layout->addWidget (surfelsCheck);
268-
269- voronoiCheck = new QCheckBox (" View Voronoi" );
270- connect (voronoiCheck, &QCheckBox::toggled, this , &MainWindow::onVoronoiToggled);
271- layout->addWidget (voronoiCheck);
272-
273- pointsCheck = new QCheckBox (" View Points" );
274- connect (pointsCheck, &QCheckBox::toggled, this , &MainWindow::onPointsToggled);
275- layout->addWidget (pointsCheck);
276-
277- contactLinesCheck = new QCheckBox (" Show Contact Lines" );
278- connect (contactLinesCheck, &QCheckBox::toggled, this , &MainWindow::onContactLinesToggled);
279- layout->addWidget (contactLinesCheck);
280-
281- layout->addStretch ();
282-
283- controlsPanel->setLayout (layout);
284- }
285-
286174void MainWindow::createNodeGraphDock () {
287175 nodeGraphDock = new NodeGraphDock (this );
288176 nodeGraphDock->setObjectName (" NodeGraphDock" );
@@ -346,7 +234,7 @@ void MainWindow::setNodeGraphVisible(bool visible) {
346234 }
347235
348236 QList<int > sizes = mainSplitter->sizes ();
349- if (sizes.size () < 3 ) {
237+ if (sizes.size () < 2 ) {
350238 return ;
351239 }
352240
@@ -363,100 +251,6 @@ void MainWindow::setNodeGraphVisible(bool visible) {
363251 nodeGraphDock->hide ();
364252}
365253
366- void MainWindow::onWireframeModeChanged (int index) {
367- if (settingsController) {
368- settingsController->setWireframeMode (static_cast <app::WireframeMode>(index));
369- }
370- }
371-
372- void MainWindow::onIntrinsicToggled (bool checked) {
373- if (settingsController) {
374- settingsController->setIntrinsicOverlayEnabled (checked);
375- }
376-
377- if (remeshOverlayAction && remeshOverlayAction->isChecked () != checked) {
378- remeshOverlayAction->setChecked (checked);
379- }
380- if (intrinsicCheck && intrinsicCheck->isChecked () != checked) {
381- intrinsicCheck->setChecked (checked);
382- }
383- }
384-
385- void MainWindow::onHeatOverlayToggled (bool checked) {
386- if (settingsController) {
387- settingsController->setHeatOverlayEnabled (checked);
388- }
389- if (heatOverlayCheck && heatOverlayCheck->isChecked () != checked) {
390- heatOverlayCheck->setChecked (checked);
391- }
392- }
393-
394- void MainWindow::onIntrinsicNormalsToggled (bool checked) {
395- if (settingsController) {
396- settingsController->setIntrinsicNormalsEnabled (checked);
397- }
398- if (intrinsicNormalsCheck && intrinsicNormalsCheck->isChecked () != checked) {
399- intrinsicNormalsCheck->setChecked (checked);
400- }
401- }
402-
403- void MainWindow::onIntrinsicVertexNormalsToggled (bool checked) {
404- if (settingsController) {
405- settingsController->setIntrinsicVertexNormalsEnabled (checked);
406- }
407- if (intrinsicVertexNormalsCheck && intrinsicVertexNormalsCheck->isChecked () != checked) {
408- intrinsicVertexNormalsCheck->setChecked (checked);
409- }
410- }
411-
412- void MainWindow::onSurfelsToggled (bool checked) {
413- if (settingsController) {
414- settingsController->setSurfelsEnabled (checked);
415- }
416- if (surfelsCheck && surfelsCheck->isChecked () != checked) {
417- surfelsCheck->setChecked (checked);
418- }
419- }
420-
421- void MainWindow::onVoronoiToggled (bool checked) {
422- if (settingsController) {
423- settingsController->setVoronoiEnabled (checked);
424- }
425- if (voronoiCheck && voronoiCheck->isChecked () != checked) {
426- voronoiCheck->setChecked (checked);
427- }
428- }
429-
430- void MainWindow::onPointsToggled (bool checked) {
431- if (settingsController) {
432- settingsController->setPointsEnabled (checked);
433- }
434- if (pointsCheck && pointsCheck->isChecked () != checked) {
435- pointsCheck->setChecked (checked);
436- }
437- }
438-
439- void MainWindow::onContactLinesToggled (bool checked) {
440- if (settingsController) {
441- settingsController->setContactLinesEnabled (checked);
442- }
443- if (contactLinesCheck && contactLinesCheck->isChecked () != checked) {
444- contactLinesCheck->setChecked (checked);
445- }
446- }
447-
448- void MainWindow::onNormalLengthChanged (double value) {
449- if (settingsController) {
450- settingsController->setIntrinsicNormalLength (static_cast <float >(value));
451- }
452- }
453-
454- void MainWindow::onPanSensitivityChanged (double value) {
455- if (app) {
456- app->setPanSensitivity (static_cast <float >(value) * 0 .001f );
457- }
458- }
459-
460254void MainWindow::onOpenModel () {
461255 if (app) {
462256 app->setRenderPaused (true );
0 commit comments