Sun, 29 Jun 2014 17:06:21 +0300
- added ability to filter out surfaces/edgelines/condlines from the viewport
changelog.txt | file | annotate | diff | comparison | revisions | |
src/actions.cc | file | annotate | diff | comparison | revisions | |
src/glRenderer.cc | file | annotate | diff | comparison | revisions | |
src/mainWindow.cc | file | annotate | diff | comparison | revisions | |
src/mainWindow.h | file | annotate | diff | comparison | revisions | |
ui/ldforge.ui | file | annotate | diff | comparison | revisions |
--- 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.
--- 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(); +}
--- 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);
--- 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); } // =============================================================================
--- 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);
--- 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 @@ <x>0</x> <y>0</y> <width>233</width> - <height>436</height> + <height>418</height> </rect> </property> <attribute name="label"> @@ -75,8 +75,8 @@ <rect> <x>0</x> <y>0</y> - <width>233</width> - <height>436</height> + <width>98</width> + <height>95</height> </rect> </property> <attribute name="label"> @@ -112,7 +112,7 @@ <x>0</x> <y>0</y> <width>1010</width> - <height>25</height> + <height>30</height> </rect> </property> <widget class="QMenu" name="menuFile"> @@ -161,6 +161,10 @@ <addaction name="actionDrawAngles"/> <addaction name="actionRandomColors"/> <addaction name="separator"/> + <addaction name="actionDrawSurfaces"/> + <addaction name="actionDrawEdgeLines"/> + <addaction name="actionDrawConditionalLines"/> + <addaction name="separator"/> <addaction name="actionSetOverlay"/> <addaction name="actionClearOverlay"/> <addaction name="separator"/> @@ -1548,6 +1552,39 @@ <string>Split Lines...</string> </property> </action> + <action name="actionDrawSurfaces"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Draw surfaces</string> + </property> + <property name="toolTip"> + <string>Render surfaces (i.e. quads and triangles) on the viewport.</string> + </property> + </action> + <action name="actionDrawEdgeLines"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Draw edgelines</string> + </property> + <property name="toolTip"> + <string>Render edgelines on the viewport</string> + </property> + </action> + <action name="actionDrawConditionalLines"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Draw conditional lines</string> + </property> + <property name="toolTip"> + <string>Render conditional lines on the viewport.</string> + </property> + </action> </widget> <resources> <include location="../ldforge.qrc"/>