Skip to content
This repository has been archived by the owner on Feb 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #93 from Henry00IS/AutoRebuildBounds
Browse files Browse the repository at this point in the history
Auto Rebuild responsiveness improvement with Resize tool.
  • Loading branch information
Henry00IS authored Apr 13, 2018
2 parents 2b8b666 + 17aba58 commit e1cc2fb
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 e1cc2fb

Please sign in to comment.