Browse Source

terrain brush dragging cleanups

AzaezelX 4 years ago
parent
commit
66db6ac376
1 changed files with 11 additions and 8 deletions
  1. 11 8
      Engine/source/gui/worldEditor/terrainEditor.cpp

+ 11 - 8
Engine/source/gui/worldEditor/terrainEditor.cpp

@@ -1841,6 +1841,7 @@ void TerrainEditor::on3DMouseMove(const Gui3DMouseEvent & event)
    if(!hitTerrain)
    {
       mMouseBrush->reset();
+      return;
    }
    else
    {
@@ -1875,17 +1876,19 @@ void TerrainEditor::on3DMouseDragged(const Gui3DMouseEvent & event)
       return;
 
    Point3F pos;
+   bool selChanged = false;
 
    if ( !mSelectionLocked )
    {
-      if ( !collide( event, pos)  )
+      TerrainBlock* hitTerrain = collide(event, pos);
+
+      if (!hitTerrain)
+      {
          mMouseBrush->reset();
-   }
+         return;
+      }
 
-   // check if the mouse has actually moved in grid space
-   bool selChanged = false;
-   if ( !mSelectionLocked )
-   {
+      // check if the mouse has actually moved in grid space
       Point2I gMouse;
       Point2I gLastMouse;
       worldToGrid( pos, gMouse );
@@ -1896,8 +1899,8 @@ void TerrainEditor::on3DMouseDragged(const Gui3DMouseEvent & event)
 
       selChanged = gMouse != gLastMouse;
    }
-
-   mCurrentAction->process( mMouseBrush, event, true, TerrainAction::Update );
+   if (selChanged)
+      mCurrentAction->process( mMouseBrush, event, true, TerrainAction::Update );
 }
 
 void TerrainEditor::on3DMouseUp(const Gui3DMouseEvent & event)