- made coordinate rounding precision configurable

Thu, 22 May 2014 18:01:19 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Thu, 22 May 2014 18:01:19 +0300
changeset 780
b0d84fb70ea5
parent 779
23130cafe95e
child 781
aa823ba3241d

- made coordinate rounding precision configurable

changelog.txt file | annotate | diff | comparison | revisions
src/actionsEdit.cc file | annotate | diff | comparison | revisions
src/configDialog.cc file | annotate | diff | comparison | revisions
src/configDialog.h file | annotate | diff | comparison | revisions
ui/config.ui file | annotate | diff | comparison | revisions
--- a/changelog.txt	Wed May 21 19:00:57 2014 +0300
+++ b/changelog.txt	Thu May 22 18:01:19 2014 +0300
@@ -33,6 +33,7 @@
 +	- Vertex snapping is now smarter, does a depth comparison to favor vertices closer to camera. Selecting a vertex very close with the cursor still allows selecting vertices far away from the camera. This makes it less likely to pick irrelevant vertices which caused problems in part files.
 +	- Added a selection hover effect to the renderer, making selecting objects a lot more convenient.
 +	- Selecting an invertnext'd object now also selects the invertnext.
++	- Made the coordinate rounding precision configurable.
 
 -	- 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.
--- a/src/actionsEdit.cc	Wed May 21 19:00:57 2014 +0300
+++ b/src/actionsEdit.cc	Thu May 22 18:01:19 2014 +0300
@@ -36,6 +36,9 @@
 
 EXTERN_CFGENTRY (String, defaultUser);
 
+CFGENTRY (Int,	roundPosition,	3);
+CFGENTRY (Int,	roundMatrix,	4);
+
 // =============================================================================
 //
 static int copyToClipboard()
@@ -532,8 +535,8 @@
 			Matrix t = mo->transform();
 
 			// Note: matrix values are to be rounded to 4 decimals.
-			v.apply ([](Axis, double& a) { roundToDecimals (a, 3); });
-			applyToMatrix (t, [](int, double& a) { roundToDecimals (a, 4); });
+			v.apply ([](Axis, double& a) { roundToDecimals (a, cfg::roundPosition); });
+			applyToMatrix (t, [](int, double& a) { roundToDecimals (a, cfg::roundMatrix); });
 
 			mo->setPosition (v);
 			mo->setTransform (t);
@@ -544,7 +547,7 @@
 			for (int i = 0; i < obj->numVertices(); ++i)
 			{
 				Vertex v = obj->vertex (i);
-				v.apply ([](Axis, double& a) { roundToDecimals (a, 3); });
+				v.apply ([](Axis, double& a) { roundToDecimals (a, cfg::roundPosition); });
 				obj->setVertex (i, v);
 				num += 3;
 			}
--- a/src/configDialog.cc	Wed May 21 19:00:57 2014 +0300
+++ b/src/configDialog.cc	Thu May 22 18:01:19 2014 +0300
@@ -77,6 +77,8 @@
 EXTERN_CFGENTRY (Float,	gridFineCoordinateSnap);
 EXTERN_CFGENTRY (Float,	gridFineAngleSnap);
 EXTERN_CFGENTRY (Bool, highlightObjectBelowCursor)
+EXTERN_CFGENTRY (Int, roundPosition)
+EXTERN_CFGENTRY (Int, roundMatrix)
 
 const char* g_extProgPathFilter =
 #ifdef _WIN32
@@ -117,6 +119,9 @@
 	ui->m_logostuds->setChecked (cfg::useLogoStuds);
 	ui->linelengths->setChecked (cfg::drawLineLengths);
 
+	ui->roundPosition->setValue (cfg::roundPosition);
+	ui->roundMatrix->setValue (cfg::roundMatrix);
+
 	int i = 0;
 
 	for (QAction* act : g_win->findChildren<QAction*>())
@@ -300,6 +305,8 @@
 	cfg::defaultLicense = ui->m_profileLicense->currentIndex();
 	cfg::antiAliasedLines = ui->m_aa->isChecked();
 	cfg::highlightObjectBelowCursor = ui->highlightObjectBelowCursor->isChecked();
+	cfg::roundPosition = ui->roundPosition->value();
+	cfg::roundMatrix = ui->roundMatrix->value();
 
 	// Rebuild the quick color toolbar
 	g_win->setQuickColors (quickColors);
--- a/src/configDialog.h	Wed May 21 19:00:57 2014 +0300
+++ b/src/configDialog.h	Thu May 22 18:01:19 2014 +0300
@@ -44,6 +44,7 @@
 		enum Tab
 		{
 			InterfaceTab,
+			EditingToolsTab,
 			ProfileTab,
 			ShortcutsTab,
 			QuickColorsTab,
--- a/ui/config.ui	Wed May 21 19:00:57 2014 +0300
+++ b/ui/config.ui	Thu May 22 18:01:19 2014 +0300
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>717</width>
-    <height>407</height>
+    <height>419</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -41,6 +41,11 @@
        </item>
        <item>
         <property name="text">
+         <string>Editing tools</string>
+        </property>
+       </item>
+       <item>
+        <property name="text">
          <string>Profile</string>
         </property>
        </item>
@@ -74,7 +79,7 @@
      <item>
       <widget class="QStackedWidget" name="m_pages">
        <property name="currentIndex">
-        <number>0</number>
+        <number>1</number>
        </property>
        <widget class="QWidget" name="page_3">
         <layout class="QVBoxLayout" name="verticalLayout_13">
@@ -317,6 +322,65 @@
          </item>
         </layout>
        </widget>
+       <widget class="QWidget" name="page">
+        <layout class="QVBoxLayout" name="verticalLayout_6">
+         <item>
+          <widget class="QGroupBox" name="groupBox_6">
+           <property name="title">
+            <string>Editing tools</string>
+           </property>
+           <layout class="QVBoxLayout" name="verticalLayout_7">
+            <item>
+             <widget class="QGroupBox" name="groupBox_7">
+              <property name="title">
+               <string>Rounding</string>
+              </property>
+              <layout class="QVBoxLayout" name="verticalLayout_9">
+               <item>
+                <layout class="QGridLayout" name="gridLayout_2">
+                 <item row="0" column="0">
+                  <widget class="QLabel" name="label_17">
+                   <property name="text">
+                    <string>Position decimals:</string>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="0" column="1">
+                  <widget class="QSpinBox" name="roundPosition"/>
+                 </item>
+                 <item row="1" column="0">
+                  <widget class="QLabel" name="label_18">
+                   <property name="text">
+                    <string>Matrix decimals:</string>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="1" column="1">
+                  <widget class="QSpinBox" name="roundMatrix"/>
+                 </item>
+                </layout>
+               </item>
+              </layout>
+             </widget>
+            </item>
+           </layout>
+          </widget>
+         </item>
+         <item>
+          <spacer name="verticalSpacer_6">
+           <property name="orientation">
+            <enum>Qt::Vertical</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>20</width>
+             <height>40</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </widget>
        <widget class="QWidget" name="page_4">
         <layout class="QVBoxLayout" name="verticalLayout_14">
          <item>

mercurial