# HG changeset patch # User Santeri Piippo # Date 1404050781 -10800 # Node ID efe34366e56a8632a753051da7f37b4b1808451b # Parent c8ef30fd0e54b06a194afb856576da169d07c38a - added ability to filter out surfaces/edgelines/condlines from the viewport diff -r c8ef30fd0e54 -r efe34366e56a changelog.txt --- a/changelog.txt Sun Jun 29 15:22:43 2014 +0300 +++ b/changelog.txt Sun Jun 29 17:06:21 2014 +0300 @@ -41,6 +41,7 @@ + - Added hi-res counterparts for various primitive categories. + - Added support for direct colors. + - Added an action for splitting lines into equal-sized segments. ++ - Added three togglable actions for filtering what's drawn (Draw surfaces/Draw edgelines/Draw conditional lines) - - The camera is now changed to the top one if switching to draw mode while using the free camera instead of disabling the draw mode. - - The color selector now uses the color's edge color for the borders instead of black. @@ -124,4 +125,4 @@ - Changed the green color to more "greener" green, rather than yellowish lime. - The dialog box for setting a comment's text is now a lot wider - Calculated coordinates are now rounded down (to prevent stuff like Z:160.000001) -- New part dialog: changed "Name:" to "Title", widened a tad. \ No newline at end of file +- New part dialog: changed "Name:" to "Title", widened a tad. diff -r c8ef30fd0e54 -r efe34366e56a src/actions.cc --- a/src/actions.cc Sun Jun 29 15:22:43 2014 +0300 +++ b/src/actions.cc Sun Jun 29 17:06:21 2014 +0300 @@ -45,6 +45,9 @@ EXTERN_CFGENTRY (Int, defaultLicense); EXTERN_CFGENTRY (Bool, drawAngles); EXTERN_CFGENTRY (Bool, randomColors) +EXTERN_CFGENTRY (Bool, drawSurfaces) +EXTERN_CFGENTRY (Bool, drawEdgeLines) +EXTERN_CFGENTRY (Bool, drawConditionalLines) // ============================================================================= // @@ -909,3 +912,24 @@ ref->fileInfo()->setImplicit (false); } } + +void MainWindow::slot_actionDrawSurfaces() +{ + cfg::drawSurfaces = not cfg::drawSurfaces; + updateActions(); + update(); +} + +void MainWindow::slot_actionDrawEdgeLines() +{ + cfg::drawEdgeLines = not cfg::drawEdgeLines; + updateActions(); + update(); +} + +void MainWindow::slot_actionDrawConditionalLines() +{ + cfg::drawConditionalLines = not cfg::drawConditionalLines; + updateActions(); + update(); +} diff -r c8ef30fd0e54 -r efe34366e56a src/glRenderer.cc --- a/src/glRenderer.cc Sun Jun 29 15:22:43 2014 +0300 +++ b/src/glRenderer.cc Sun Jun 29 17:06:21 2014 +0300 @@ -78,6 +78,9 @@ CFGENTRY (Bool, drawAngles, false) CFGENTRY (Bool, randomColors, false) CFGENTRY (Bool, highlightObjectBelowCursor, true) +CFGENTRY (Bool, drawSurfaces, true) +CFGENTRY (Bool, drawEdgeLines, true) +CFGENTRY (Bool, drawConditionalLines, true) // argh const char* g_CameraNames[7] = @@ -480,6 +483,14 @@ // void GLRenderer::drawVBOs (EVBOSurface surface, EVBOComplement colors, GLenum type) { + // Filter this through some configuration options + if (((surface == VBOSF_Quads || surface == VBOSF_Triangles) && cfg::drawSurfaces == false) || + (surface == VBOSF_Lines && cfg::drawEdgeLines == false) || + (surface == VBOSF_CondLines && cfg::drawConditionalLines == false)) + { + return; + } + int surfacenum = m_compiler->vboNumber (surface, VBOCM_Surfaces); int colornum = m_compiler->vboNumber (surface, colors); m_compiler->prepareVBO (surfacenum); diff -r c8ef30fd0e54 -r efe34366e56a src/mainWindow.cc --- a/src/mainWindow.cc Sun Jun 29 15:22:43 2014 +0300 +++ b/src/mainWindow.cc Sun Jun 29 17:06:21 2014 +0300 @@ -65,6 +65,9 @@ EXTERN_CFGENTRY (Bool, bfcRedGreenView); EXTERN_CFGENTRY (Bool, drawAngles); EXTERN_CFGENTRY (Bool, randomColors); +EXTERN_CFGENTRY (Bool, drawSurfaces) +EXTERN_CFGENTRY (Bool, drawEdgeLines) +EXTERN_CFGENTRY (Bool, drawConditionalLines) // ============================================================================= // @@ -100,10 +103,7 @@ m_quickColors = quickColorsFromConfig(); slot_selectionChanged(); setStatusBar (new QStatusBar); - ui->actionAxes->setChecked (cfg::drawAxes); - ui->actionWireframe->setChecked (cfg::drawWireframe); - ui->actionBFCView->setChecked (cfg::bfcRedGreenView); - ui->actionRandomColors->setChecked (cfg::randomColors); + updateActions(); // Connect all actions and save default sequences applyToActions ([&](QAction* act) @@ -964,14 +964,22 @@ // void MainWindow::updateActions() { - History* his = getCurrentDocument()->history(); - int pos = his->position(); - ui->actionUndo->setEnabled (pos != -1); - ui->actionRedo->setEnabled (pos < (long) his->getSize() - 1); + if (getCurrentDocument() != null && getCurrentDocument()->history() != null) + { + History* his = getCurrentDocument()->history(); + int pos = his->position(); + ui->actionUndo->setEnabled (pos != -1); + ui->actionRedo->setEnabled (pos < (long) his->getSize() - 1); + } + + ui->actionWireframe->setChecked (cfg::drawWireframe); ui->actionAxes->setChecked (cfg::drawAxes); ui->actionBFCView->setChecked (cfg::bfcRedGreenView); ui->actionRandomColors->setChecked (cfg::randomColors); ui->actionDrawAngles->setChecked (cfg::drawAngles); + ui->actionDrawSurfaces->setChecked (cfg::drawSurfaces); + ui->actionDrawEdgeLines->setChecked (cfg::drawEdgeLines); + ui->actionDrawConditionalLines->setChecked (cfg::drawConditionalLines); } // ============================================================================= diff -r c8ef30fd0e54 -r efe34366e56a src/mainWindow.h --- a/src/mainWindow.h Sun Jun 29 15:22:43 2014 +0300 +++ b/src/mainWindow.h Sun Jun 29 17:06:21 2014 +0300 @@ -273,6 +273,9 @@ void slot_actionRandomColors(); void slot_actionOpenSubfiles(); void slot_actionSplitLines(); + void slot_actionDrawSurfaces(); + void slot_actionDrawEdgeLines(); + void slot_actionDrawConditionalLines(); protected: void closeEvent (QCloseEvent* ev); diff -r c8ef30fd0e54 -r efe34366e56a ui/ldforge.ui --- a/ui/ldforge.ui Sun Jun 29 15:22:43 2014 +0300 +++ b/ui/ldforge.ui Sun Jun 29 17:06:21 2014 +0300 @@ -48,7 +48,7 @@ 0 0 233 - 436 + 418 @@ -75,8 +75,8 @@ 0 0 - 233 - 436 + 98 + 95 @@ -112,7 +112,7 @@ 0 0 1010 - 25 + 30 @@ -161,6 +161,10 @@ + + + + @@ -1548,6 +1552,39 @@ Split Lines... + + + true + + + Draw surfaces + + + Render surfaces (i.e. quads and triangles) on the viewport. + + + + + true + + + Draw edgelines + + + Render edgelines on the viewport + + + + + true + + + Draw conditional lines + + + Render conditional lines on the viewport. + +