Skip to content

Commit

Permalink
* 2D view now renders 3D objects as double-sided.
Browse files Browse the repository at this point in the history
* Popups are now properly blocking in the level editor.
  • Loading branch information
luciusDXL committed Jan 18, 2024
1 parent 2f40824 commit c665887
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ namespace LevelEditor
compute2dCamera(camera);

// Submit.
TFE_RenderShared::modelDraw_draw(&camera, s_viewportSize.x, s_viewportSize.z);
TFE_RenderShared::modelDraw_draw(&camera, s_viewportSize.x, s_viewportSize.z, false);
TFE_RenderShared::triDraw2d_draw();
TFE_RenderShared::lineDraw2d_drawLines();
}
Expand Down
29 changes: 16 additions & 13 deletions TheForceEngine/TFE_Editor/LevelEditor/levelEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4532,7 +4532,7 @@ namespace LevelEditor

void updateWindowControls()
{
if (isUiActive()) { return; }
if (isUiActive() || isPopupOpen()) { return; }

s32 mx, my;
TFE_Input::getMousePos(&mx, &my);
Expand Down Expand Up @@ -5056,17 +5056,20 @@ namespace LevelEditor
updateWindowControls();

// Hotkeys...
if (TFE_Input::keyPressed(KEY_Z) && TFE_Input::keyModDown(KEYMOD_CTRL))
if (!isPopupOpen())
{
levHistory_undo();
}
else if (TFE_Input::keyPressed(KEY_Y) && TFE_Input::keyModDown(KEYMOD_CTRL))
{
levHistory_redo();
}
if (TFE_Input::keyPressed(KEY_TAB))
{
s_showAllLabels = !s_showAllLabels;
if (TFE_Input::keyPressed(KEY_Z) && TFE_Input::keyModDown(KEYMOD_CTRL))
{
levHistory_undo();
}
else if (TFE_Input::keyPressed(KEY_Y) && TFE_Input::keyModDown(KEYMOD_CTRL))
{
levHistory_redo();
}
if (TFE_Input::keyPressed(KEY_TAB))
{
s_showAllLabels = !s_showAllLabels;
}
}

// Update thumbnails.
Expand Down Expand Up @@ -5203,7 +5206,7 @@ namespace LevelEditor
TFE_Input::getMousePos(&mx, &my);
const bool editWinHovered = mx >= s_editWinPos.x && mx < s_editWinPos.x + s_editWinSize.x && my >= s_editWinPos.z && my < s_editWinPos.z + s_editWinSize.z;

if (!getMenuActive() && !isUiActive())
if (!getMenuActive() && !isUiActive() && !isPopupOpen())
{
const ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize
| ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_AlwaysAutoResize;
Expand Down Expand Up @@ -6479,7 +6482,7 @@ namespace LevelEditor

s32 mx, my;
TFE_Input::getMousePos(&mx, &my);
if (mx >= s_editWinPos.x && mx < s_editWinPos.x + s_editWinSize.x && my >= s_editWinPos.z && my < s_editWinPos.z + s_editWinSize.z && !getMenuActive() && !isUiActive())
if (!isPopupOpen() && mx >= s_editWinPos.x && mx < s_editWinPos.x + s_editWinSize.x && my >= s_editWinPos.z && my < s_editWinPos.z + s_editWinSize.z && !getMenuActive() && !isUiActive())
{
if (s_view == EDIT_VIEW_2D)
{
Expand Down
5 changes: 5 additions & 0 deletions TheForceEngine/TFE_Editor/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ namespace TFE_Editor
return finished;
}

bool isPopupOpen()
{
return s_editorPopup != POPUP_NONE;
}

void handlePopupBegin()
{
if (s_editorPopup == POPUP_NONE) { return; }
Expand Down
2 changes: 2 additions & 0 deletions TheForceEngine/TFE_Editor/editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,6 @@ namespace TFE_Editor

ImVec4 getTextColor(EditorTextColor color);
bool getMenuActive();

bool isPopupOpen();
}

0 comments on commit c665887

Please sign in to comment.