Skip to content

Commit 9202381

Browse files
committed
* Show all selected entities in the viewport.
* Moving entities over to using the same selection/tranform system as geometry - still WIP. * Changed layer check to use a function and started moving everything over - this way layer handling is simplified and consistent.
1 parent 02d2523 commit 9202381

File tree

13 files changed

+351
-146
lines changed

13 files changed

+351
-146
lines changed

TheForceEngine/TFE_Editor/LevelEditor/Rendering/viewport.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2024,17 +2024,15 @@ namespace LevelEditor
20242024
if (s_editMode == LEDIT_ENTITY && drawEntityBounds)
20252025
{
20262026
EditorSector* hoveredSector = nullptr;
2027-
EditorSector* curSector = nullptr;
2028-
s32 hoveredFeatureIndex, curFeatureIndex;
2029-
bool hasHovered = selection_getEntity(SEL_INDEX_HOVERED, hoveredSector, hoveredFeatureIndex);
2030-
bool hasCur = selection_getEntity(0, curSector, curFeatureIndex);
2027+
s32 hoveredFeatureIndex = -1;
2028+
selection_getEntity(SEL_INDEX_HOVERED, hoveredSector, hoveredFeatureIndex);
20312029

20322030
Highlight hl = HL_NONE;
2033-
if (hasHovered && sector == curSector && curFeatureIndex == id)
2031+
if (selection_entity(SA_CHECK_INCLUSION, (EditorSector*)sector, id))
20342032
{
20352033
hl = HL_SELECTED;
20362034
}
2037-
if (hasCur && sector == hoveredSector && hoveredFeatureIndex == id)
2035+
if (sector == hoveredSector && hoveredFeatureIndex == id)
20382036
{
20392037
hl = (hl == HL_SELECTED) ? Highlight(HL_SELECTED + 1) : HL_HOVERED;
20402038
}
@@ -2952,7 +2950,7 @@ namespace LevelEditor
29522950

29532951
// Draw bounds.
29542952
Highlight hl = HL_NONE;
2955-
if (sector == curSector && curFeatureIndex == id)
2953+
if (selection_entity(SA_CHECK_INCLUSION, (EditorSector*)sector, id))
29562954
{
29572955
hl = HL_SELECTED;
29582956
}
@@ -2971,7 +2969,7 @@ namespace LevelEditor
29712969
Vec2f size = { width*2.0f, width*2.0f };
29722970

29732971
Highlight hl = HL_NONE;
2974-
if (sector == curSector && curFeatureIndex == id)
2972+
if (selection_entity(SA_CHECK_INCLUSION, (EditorSector*)sector, id))
29752973
{
29762974
hl = HL_SELECTED;
29772975
}

TheForceEngine/TFE_Editor/LevelEditor/editCommon.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "editCommon.h"
2+
#include "editEntity.h"
23
#include "editVertex.h"
34
#include "editSurface.h"
45
#include "editTransforms.h"
@@ -80,6 +81,17 @@ namespace LevelEditor
8081
edit_deleteSector(sector->id);
8182
}
8283
} break;
84+
case LEDIT_ENTITY:
85+
{
86+
if (sector && featureIndex >= 0)
87+
{
88+
edit_deleteObject(sector, featureIndex);
89+
90+
selection_clearHovered();
91+
selection_clear(SEL_ENTITY);
92+
cmd_objectListSnapshot(LName_DeleteObject, sector->id);
93+
}
94+
} break;
8395
}
8496
}
8597

@@ -221,6 +233,10 @@ namespace LevelEditor
221233
{
222234
handleVertexInsert(worldPos, info);
223235
}
236+
else if (s_editMode == LEDIT_ENTITY)
237+
{
238+
handleEntityInsert({ worldPos.x, s_cursor3d.y, worldPos.z }, info);
239+
}
224240
}
225241
}
226242
}

0 commit comments

Comments
 (0)