Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/Features/WeatherEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,13 @@ void LerpDirectional(RE::BGSDirectionalAmbientLightingColors::Directional& oldCo

void WeatherEditor::DrawSettings()
{
if (ImGui::Button("Open Editor", { -1, 0 })) {
auto player = RE::PlayerCharacter::GetSingleton();
bool hasCell = player && player->parentCell;
ImGui::BeginDisabled(!hasCell);
if (ImGui::Button(hasCell ? "Open Editor" : "Open Editor (no active cell)", { -1, 0 })) {
EditorWindow::GetSingleton()->open = true;
}
ImGui::EndDisabled();

ImGui::Spacing();
ImGui::Separator();
Expand Down Expand Up @@ -230,6 +234,10 @@ void WeatherEditor::RenderWeatherDetailsWindow(bool* open)
if (!*open)
return;

auto player = RE::PlayerCharacter::GetSingleton();
if (!player || !player->parentCell)
return;

// Set initial position if not already set
if (!WeatherDetailsWindow.PositionSet) {
ImGui::SetNextWindowPos(ImVec2(50.0f, 50.0f));
Expand Down Expand Up @@ -1028,6 +1036,10 @@ std::string WeatherEditor::GetDisplayName(const RE::TESWeather* weather)

void WeatherEditor::DrawOverlay()
{
auto player = RE::PlayerCharacter::GetSingleton();
if (!player || !player->parentCell)
return;

bool overlayVisible = Menu::GetSingleton()->overlayVisible;
static bool lastShowInOverlay = false;
const bool showInOverlay = WeatherDetailsWindow.ShowInOverlay;
Expand Down
2 changes: 1 addition & 1 deletion src/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ void Menu::ProcessInputEventQueue()
{ settings.ShaderBlockPrevKey, [this, shaderCache]() { if (settings.EnableShaderBlocking) shaderCache->IterateShaderBlock(); } },
{ settings.ShaderBlockNextKey, [this, shaderCache]() { if (settings.EnableShaderBlocking) shaderCache->IterateShaderBlock(false); } },
{ settings.OverlayToggleKey, []() { Menu::GetSingleton()->overlayVisible = !Menu::GetSingleton()->overlayVisible; } },
{ settings.WeatherEditorToggleKey, []() { EditorWindow::GetSingleton()->open = !EditorWindow::GetSingleton()->open; } },
{ settings.WeatherEditorToggleKey, []() { auto p = RE::PlayerCharacter::GetSingleton(); if (p && p->parentCell) EditorWindow::GetSingleton()->open = !EditorWindow::GetSingleton()->open; } },
};
for (const auto& ka : keyActions) {
// Check if key matches last key in combo and all modifiers are held (exact match)
Expand Down
10 changes: 8 additions & 2 deletions src/Menu/OverlayRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,15 @@ void OverlayRenderer::RenderOverlay(
RenderFirstTimeSetupOverlay();

// Draw weather editor independently of main menu state
if (EditorWindow::GetSingleton()->open) {
// Auto-close editor if player leaves valid game space (e.g., loading screen)
auto* editorWindow = EditorWindow::GetSingleton();
auto player = RE::PlayerCharacter::GetSingleton();
if (editorWindow->open && !(player && player->parentCell)) {
editorWindow->open = false;
}
if (editorWindow->open) {
ImGui::GetIO().MouseDrawCursor = true;
EditorWindow::GetSingleton()->Draw();
editorWindow->Draw();
} else if (menu.IsEnabled || HomePageRenderer::ShouldShowFirstTimeSetup()) {
ImGui::GetIO().MouseDrawCursor = true;
if (menu.IsEnabled) {
Expand Down