Skip to content

Commit

Permalink
Auto Rebuild responsiveness improvement with Resize tool.
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry00IS committed Apr 11, 2018
1 parent 2b8b666 commit 17aba58
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Scripts/Tools/ResizeEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2086,11 +2086,21 @@ void TranslateBrushes(Vector3 worldDelta)
List<Transform> rootTransforms = TransformHelper.GetRootSelectionOnly(targetBrushTransforms);
Undo.RecordObjects(rootTransforms.ToArray(), "Move brush(es)");

for (int i = 0; i < rootTransforms.Count; i++)
bool didAnyPositionChange = false;

for (int i = 0; i < rootTransforms.Count; i++)
{
targetBrushTransforms[i].position += worldDelta;
if (worldDelta != Vector3.zero)
{
targetBrushTransforms[i].position += worldDelta;
didAnyPositionChange = true;
}
}

// the user translated brushes but the grid snapping caused no movement in the scene.
// we return here to prevent rebuilding a bunch of brushes.
if (!didAnyPositionChange) return;

for (int brushIndex = 0; brushIndex < targetBrushBases.Length; brushIndex++)
{
EditorHelper.SetDirty(targetBrushBases[brushIndex]);
Expand Down

0 comments on commit 17aba58

Please sign in to comment.