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

This commit is contained in:
Azaezel 2017-02-26 18:34:32 -06:00
parent 4b1e2816a9
commit f1d315d51a
3 changed files with 22 additions and 4 deletions

View file

@ -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

View file

@ -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

View file

@ -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()