From ebdd44183319ecf3b34ffbd69c71490ebfb08dc9 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 22 Feb 2017 14:31:26 -0600 Subject: [PATCH] adds a useGroupCenter var/button to allow folks to use non-itterative snapping, and defaults it to do so (maintains prior functionality envelope) --- Engine/source/gui/worldEditor/worldEditor.cpp | 7 +++--- Engine/source/gui/worldEditor/worldEditor.h | 1 + .../gui/ObjectSnapOptionsWindow.ed.gui | 23 +++++++++++++++++-- .../tools/worldEditor/scripts/EditorGui.ed.cs | 7 ++++++ 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/Engine/source/gui/worldEditor/worldEditor.cpp b/Engine/source/gui/worldEditor/worldEditor.cpp index 5a2515fff..8872bd1a3 100644 --- a/Engine/source/gui/worldEditor/worldEditor.cpp +++ b/Engine/source/gui/worldEditor/worldEditor.cpp @@ -1805,7 +1805,7 @@ WorldEditor::WorldEditor() mSoftSnapDebugPoint.set(0.0f, 0.0f, 0.0f); mGridSnap = false; - + mUseGroupCenter = true; mFadeIcons = true; mFadeIconsDist = 8.f; } @@ -2254,7 +2254,7 @@ void WorldEditor::on3DMouseDragged(const Gui3DMouseEvent & event) mGizmo->getProfile()->snapToGrid = snapToGrid; } - mSelected->offset(mGizmo->getOffset(), mGridSnap ? mGridPlaneSize : 0.f); + mSelected->offset(mGizmo->getOffset(), (!mUseGroupCenter && mGridSnap) ? mGridPlaneSize : 0.f); // Handle various sticking terrainSnapSelection( mSelected, event.modifier, mGizmo->getPosition() ); @@ -2686,7 +2686,8 @@ void WorldEditor::initPersistFields() addGroup( "Grid" ); addField( "gridSnap", TypeBool, Offset( mGridSnap, WorldEditor ), - "If true, transform operations will snap to the grid." ); + "If true, transform operations will snap to the grid."); + addField("useGroupCenter", TypeBool, Offset(mUseGroupCenter, WorldEditor)); endGroup( "Grid" ); diff --git a/Engine/source/gui/worldEditor/worldEditor.h b/Engine/source/gui/worldEditor/worldEditor.h index f1c231ee9..86412a2ab 100644 --- a/Engine/source/gui/worldEditor/worldEditor.h +++ b/Engine/source/gui/worldEditor/worldEditor.h @@ -349,6 +349,7 @@ class WorldEditor : public EditTSCtrl F32 mDropAtScreenCenterMax; bool mGridSnap; + bool mUseGroupCenter; bool mStickToGround; bool mStuckToGround; ///< Selection is stuck to the ground AlignmentType mTerrainSnapAlignment; ///< How does the stickied object align to the terrain diff --git a/Templates/Full/game/tools/worldEditor/gui/ObjectSnapOptionsWindow.ed.gui b/Templates/Full/game/tools/worldEditor/gui/ObjectSnapOptionsWindow.ed.gui index 24f5c8172..64332f8a3 100644 --- a/Templates/Full/game/tools/worldEditor/gui/ObjectSnapOptionsWindow.ed.gui +++ b/Templates/Full/game/tools/worldEditor/gui/ObjectSnapOptionsWindow.ed.gui @@ -28,7 +28,7 @@ canMinimize = "0"; canMaximize = "0"; position = "400 31"; - extent =" 175 257"; + extent =" 175 267"; MinExtent = "175 130"; text = "Snap Options"; closeCommand = "ESnapOptions.hideDialog();"; @@ -51,7 +51,7 @@ Visible = "1"; hovertime = "1000"; Docking = "Client"; - Margin = "3 22 3 3"; + Margin = "3 32 3 3"; Padding = "0 0 0 0"; AnchorTop = "1"; AnchorBottom = "0"; @@ -793,6 +793,25 @@ canSave = "1"; canSaveDynamicFields = "0"; }; + new GuiCheckBoxCtrl() { + text = "Use Group Center"; + groupNum = "1"; + useMouseEvents = "0"; + isContainer = "0"; + horizSizing = "right"; + vertSizing = "top"; + position = "4 246"; + extent = "105 24"; + minExtent = "8 8"; + visible = "1"; + active = "1"; + command = "toggleSnappingOptions(\"byGroup\");"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + internalName = "GroupSnapButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; new GuiTextCtrl() { text = "Size"; maxLength = "1024"; diff --git a/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs b/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs index 31f794d17..8463b3dfe 100644 --- a/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs +++ b/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs @@ -2056,6 +2056,7 @@ function EWorldEditor::syncGui( %this ) ESnapOptions-->GridSize.setText( EWorldEditor.getGridSize() ); ESnapOptions-->GridSnapButton.setStateOn( %this.getGridSnap() ); + ESnapOptions-->GroupSnapButton.setStateOn( %this.UseGroupCenter ); SnapToBar-->objectGridSnapBtn.setStateOn( %this.getGridSnap() ); ESnapOptions-->NoSnapButton.setStateOn( !%this.stickToGround && !%this.getSoftSnap() && !%this.getGridSnap() ); } @@ -2458,6 +2459,12 @@ function toggleSnappingOptions( %var ) { EWorldEditor.setGridSnap( !EWorldEditor.getGridSnap() ); } + else if( %var $= "byGroup" ) + { + EWorldEditor.UseGroupCenter = !EWorldEditor.UseGroupCenter; + ESnapOptions->GroupSnapButton.setStateOn(EWorldEditor.UseGroupCenter); + error(EWorldEditor.UseGroupCenter); + } else { // No snapping.