TiManGames / AmnesiaTheDarkDescent

GNU General Public License v3.0
30 stars 8 forks source link

Model Editor: changing the grid settings causes a crash #16

Closed jkulawik closed 3 weeks ago

jkulawik commented 1 month ago

This applies both to the text box and the grid presets from MFP.

jkulawik commented 3 weeks ago

Fix from Luis:

--- C:/Users/Work/AppData/Local/Temp/EditorWindowLowerToolbar.cpp-revBASE.svn001.tmp.cppmi. may. 18 01:05:28 2011
+++ H:/ATDD/HPL2/tools/editors/common/EditorWindowLowerToolbar.cppmi. jun. 12 17:56:14 2024
@@ -100,11 +100,12 @@ iWidget* iEditorWindowLowerToolbar::AddGridControl
 mpBSnap->SetToolTip(_W("Toggle grid snapping"));
 mpBSnap->SetToolTipEnabled(true);

 // Height and sep.
 mpInpPlaneHeight = CreateInputNumber(cVector3f(65,5,0.1f), _W("Height"), "", mpGridControlsGroup, 50, 0.25f);
-mpInpSnapSep = CreateInputNumber(cVector3f(120,5,0.1f), _W("Snap sep."), "", mpGridControlsGroup, 50, 0.25f); 
+mpInpSnapSep = CreateInputNumber(cVector3f(120,5,0.1f), _W("Snap sep."), "", mpGridControlsGroup, 50, 0.25f);
+mpInpSnapSep->SetLowerBound(true, 0.01f);

 return mpGridControlsGroup;
 }

 iWidget* iEditorWindowLowerToolbar::AddLightingControls()
@@ -199,19 +200,19 @@ iWidget* iEditorWindowLowerToolbar::AddClipPlaneCo

 //---------------------------------------------------------------

 void iEditorWindowLowerToolbar::SetFocusedClipPlane(int alX)
 {
-if(mpInpClipPlanes)
+if(mpGClipPlanes)
 mpInpClipPlanes->SetValue(alX);
 }

 //---------------------------------------------------------------

 int iEditorWindowLowerToolbar::GetFocusedClipPlane()
 {
-if(mpInpClipPlanes)
+if(mpGClipPlanes)
 return mpInpClipPlanes->GetValue();

 return -1;
 }

@@ -298,11 +299,11 @@ bool iEditorWindowLowerToolbar::WindowSpecificInpu
 cEditorGrid* pGrid = mpEditor->GetFocusedViewport()->GetGrid();
 ePlaneNormal plane = pGrid->GetPlaneNormal();
 iEditorAction* pAction = NULL;

 int lClipPlaneIdx = -1;
-if(mpInpClipPlanes) lClipPlaneIdx = mpInpClipPlanes->GetValue();
+if(mpGClipPlanes) lClipPlaneIdx = mpInpClipPlanes->GetValue();
 cEditorClipPlane* pClipPlane = pWorld->GetClipPlane(lClipPlaneIdx);

 if(apInput==mpInpPlaneHeight)
 {
 cVector3f vHeight = pGrid->GetHeights();