diff --git a/Assets/Editor/Editor.SHConfig b/Assets/Editor/Editor.SHConfig deleted file mode 100644 index 37edf50c..00000000 --- a/Assets/Editor/Editor.SHConfig +++ /dev/null @@ -1,4 +0,0 @@ -Start Maximized: true -Working Scene ID: 97158628 -Window Size: {x: 1920, y: 1013} -Style: 0 \ No newline at end of file diff --git a/SHADE_Engine/src/Editor/EditorWindow/AssetBrowser/SHAssetBrowser.cpp b/SHADE_Engine/src/Editor/EditorWindow/AssetBrowser/SHAssetBrowser.cpp index dce3ffbd..0b6db700 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/AssetBrowser/SHAssetBrowser.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/AssetBrowser/SHAssetBrowser.cpp @@ -254,7 +254,7 @@ namespace SHADE return ImRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax()); } - ImRect SHAssetBrowser::DrawAsset(SHAsset const* const asset, FileExt const& ext /*= ""*/) noexcept + ImRect SHAssetBrowser::DrawAsset(SHAsset const* const asset, FileExt const& ext /*= ""*/, bool isSubAsset /*= false*/) noexcept { if (asset == nullptr) return ImRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax()); @@ -267,10 +267,20 @@ namespace SHADE bool highlighted = false; if(!filter.empty()) { - ImGui::SetNextItemOpen(true); + //ImGui::SetNextItemOpen(true); if(SHStringUtilities::StringFindInsensitive(asset->name.data(), filter) == std::string::npos) { - return ImRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax()); + bool subAssetFiltered = false; + for (auto const& subAsset : asset->subAssets) + { + subAssetFiltered |= (SHStringUtilities::StringFindInsensitive(subAsset->name.data(), filter) != std::string::npos); + } + if(!subAssetFiltered) + return ImRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax()); + else if(!asset->subAssets.empty()) + { + ImGui::SetNextItemOpen(true); + } } else { @@ -350,7 +360,12 @@ namespace SHADE case AssetType::TEXTURE: break; case AssetType::MESH: break; case AssetType::SCENE: - editor->LoadScene(asset->id); + { + if(editor->LoadScene(asset->id)) + { + editor->editorConfig->workingSceneID = asset->id; + } + } break; case AssetType::PREFAB: break; case AssetType::MATERIAL: @@ -418,7 +433,7 @@ namespace SHADE for(auto const& subAsset : asset->subAssets) { const float horizontalLineSize = 25.0f; - const ImRect childRect = DrawAsset(subAsset); + const ImRect childRect = DrawAsset(subAsset, "", true); const float midPoint = (childRect.Min.y + childRect.Max.y) * 0.5f; drawList->AddLine(ImVec2(vertLineStart.x, midPoint), ImVec2(vertLineStart.x + horizontalLineSize, midPoint), treeLineColor, 1); vertLineEnd.y = midPoint; diff --git a/SHADE_Engine/src/Editor/EditorWindow/AssetBrowser/SHAssetBrowser.h b/SHADE_Engine/src/Editor/EditorWindow/AssetBrowser/SHAssetBrowser.h index 0ff5225e..48050684 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/AssetBrowser/SHAssetBrowser.h +++ b/SHADE_Engine/src/Editor/EditorWindow/AssetBrowser/SHAssetBrowser.h @@ -24,7 +24,7 @@ namespace SHADE ImRect RecursivelyDrawTree(FolderPointer folder); void DrawCurrentFolder(); ImRect DrawFile(SHFile& file) noexcept; - ImRect DrawAsset(SHAsset const* const asset, FileExt const& ext = "") noexcept; + ImRect DrawAsset(SHAsset const* const asset, FileExt const& ext = "", bool isSubAsset = false) noexcept; void DrawAssetBeingCreated() noexcept; void DrawAssetBrowserFilter(); diff --git a/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.cpp b/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.cpp index cb7e3b12..f18e1cbd 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.cpp @@ -99,7 +99,7 @@ namespace SHADE } ImGui::SeparatorEx(ImGuiSeparatorFlags_Horizontal); - if (!ImGui::IsAnyItemFocused()) + if (!ImGui::IsAnyItemActive()) { if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) && ImGui::IsKeyReleased(ImGuiKey_A)) { diff --git a/SHADE_Engine/src/Editor/SHEditor.cpp b/SHADE_Engine/src/Editor/SHEditor.cpp index d151fd64..bc238b96 100644 --- a/SHADE_Engine/src/Editor/SHEditor.cpp +++ b/SHADE_Engine/src/Editor/SHEditor.cpp @@ -579,19 +579,23 @@ namespace SHADE return false; } - void SHEditor::LoadScene(AssetID const& assetID) noexcept + bool SHEditor::LoadScene(AssetID const& assetID) noexcept { if(shWindow->IsUnsavedChanges()) { //Unsaved changes prompt isUnsavedChangesPromptOpen = true; sceneToLoad = assetID; + return false; } else { //Load the scene sceneToLoad = 0; + editorConfig->workingSceneID = assetID; + SHConfigurationManager::SaveEditorConfig(); SHSceneManager::RestartScene(assetID); + return true; } } diff --git a/SHADE_Engine/src/Editor/SHEditor.h b/SHADE_Engine/src/Editor/SHEditor.h index 58ac6e26..1cbc4f9d 100644 --- a/SHADE_Engine/src/Editor/SHEditor.h +++ b/SHADE_Engine/src/Editor/SHEditor.h @@ -115,7 +115,7 @@ namespace SHADE bool SaveScene(std::string const& newSceneName = {}); - void LoadScene(AssetID const& assetID) noexcept; + bool LoadScene(AssetID const& assetID) noexcept; void Play(); void Pause();