Explorar o código

adds an atGizmo option - for now drops a new object at a given singular mesh position. TODO: at the center of a given group.

Azaezel %!s(int64=8) %!d(string=hai) anos
pai
achega
f1d315d51a

+ 17 - 2
Engine/source/gui/worldEditor/worldEditor.cpp

@@ -68,7 +68,8 @@ ImplementEnumType( WorldEditorDropType,
    { WorldEditor::DropAtScreenCenter,     "screenCenter",   "Places at a position projected outwards from the screen's center.\n"    },
    { WorldEditor::DropAtCentroid,         "atCentroid",     "Places at the center position of the current centroid.\n"      },
    { WorldEditor::DropToTerrain,          "toTerrain",      "Places on the terrain.\n"       },
-   { WorldEditor::DropBelowSelection,     "belowSelection", "Places at a position below the selected object.\n"  }
+   { WorldEditor::DropBelowSelection,     "belowSelection", "Places at a position below the selected object.\n"  },
+   { WorldEditor::DropAtGizmo,            "atGizmo",        "Places at the gizmo point.\n"  }
 EndImplementEnumType;
 
 ImplementEnumType( WorldEditorAlignmentType,
@@ -728,12 +729,26 @@ void WorldEditor::dropSelection(Selection*  sel)
          dropBelowSelection(sel, centroid, mDropAtBounds);
          break;
       }
+
+      case DropAtGizmo:
+      {
+         dropAtGizmo(sel, mGizmo->getPosition()-centroid);
+         break;
+      }
    }
 
    //
    updateClientTransforms(sel);
 }
 
+void WorldEditor::dropAtGizmo(Selection*  sel, const Point3F & gizmoPos)
+{
+   if (!sel->size())
+      return;
+
+   sel->offset(gizmoPos, (!mUseGroupCenter && mGridSnap) ? mGridPlaneSize : 0.f);
+}
+
 void WorldEditor::dropBelowSelection(Selection*  sel, const Point3F & centroid, bool useBottomBounds)
 {
    if(!sel->size())
@@ -3642,7 +3657,7 @@ void WorldEditor::makeSelectionPrefab( const char *filename )
          else
          {
             //Only push the cleanup of the group if it's ONLY a SimGroup.
-            cleanup.push_back(grp);
+         cleanup.push_back( grp );
          }
       }
       else

+ 4 - 2
Engine/source/gui/worldEditor/worldEditor.h

@@ -164,7 +164,8 @@ class WorldEditor : public EditTSCtrl
       bool copySelection(Selection*  sel);
       bool pasteSelection(bool dropSel=true);
       void dropSelection(Selection*  sel);
-      void dropBelowSelection(Selection*  sel, const Point3F & centroid, bool useBottomBounds=false);
+      void dropBelowSelection(Selection*  sel, const Point3F & centroid, bool useBottomBounds = false);
+      void dropAtGizmo(Selection*  sel, const Point3F & gizmoPos);
 
       void terrainSnapSelection(Selection* sel, U8 modifier, Point3F gizmoPos, bool forceStick=false);
       void softSnapSelection(Selection* sel, U8 modifier, Point3F gizmoPos);
@@ -296,7 +297,8 @@ class WorldEditor : public EditTSCtrl
          DropAtScreenCenter,
          DropAtCentroid,
          DropToTerrain,
-         DropBelowSelection
+         DropBelowSelection,
+         DropAtGizmo
       };
 
       // Snapping alignment mode

+ 1 - 0
Templates/Full/game/tools/worldEditor/scripts/menus.ed.cs

@@ -315,6 +315,7 @@ function EditorGui::buildMenus(%this)
          item[5] = "at Centroid" TAB "" TAB "atCentroid";
          item[6] = "to Terrain" TAB "" TAB "toTerrain";
          item[7] = "Below Selection" TAB "" TAB "belowSelection";
+         item[8] = "At Gizmo" TAB "" TAB "atGizmo";
       };
       
       %this.alignBoundsMenu = new PopupMenu()