diff --git a/Assets/Fonts/Dangrek-Regular.shfont b/Assets/Fonts/Dangrek-Regular.shfont new file mode 100644 index 00000000..cb992fb0 Binary files /dev/null and b/Assets/Fonts/Dangrek-Regular.shfont differ diff --git a/Assets/Fonts/Dangrek-Regular.shfont.shmeta b/Assets/Fonts/Dangrek-Regular.shfont.shmeta new file mode 100644 index 00000000..65f95905 --- /dev/null +++ b/Assets/Fonts/Dangrek-Regular.shfont.shmeta @@ -0,0 +1,3 @@ +Name: Dangrek-Regular +ID: 174412429 +Type: 10 diff --git a/Assets/Fonts/Dangrek-Regular.ttf b/Assets/Fonts/Dangrek-Regular.ttf new file mode 100644 index 00000000..d9f127c7 Binary files /dev/null and b/Assets/Fonts/Dangrek-Regular.ttf differ diff --git a/Assets/Scenes/MainMenu.shade b/Assets/Scenes/MainMenu.shade index 7ab9c413..a2a5dd1c 100644 --- a/Assets/Scenes/MainMenu.shade +++ b/Assets/Scenes/MainMenu.shade @@ -477,7 +477,7 @@ IsActive: true Text Renderer Component: Text: Options - Font: 176667660 + Font: 174412429 IsActive: true UI Component: Canvas ID: 19 @@ -497,7 +497,7 @@ IsActive: true Text Renderer Component: Text: Audio - Font: 176667660 + Font: 174412429 IsActive: true UI Component: Canvas ID: 19 @@ -533,7 +533,7 @@ IsActive: true Text Renderer Component: Text: Master - Font: 176667660 + Font: 174412429 IsActive: true UI Component: Canvas ID: 19 @@ -553,7 +553,7 @@ IsActive: true Text Renderer Component: Text: SFX - Font: 176667660 + Font: 174412429 IsActive: true UI Component: Canvas ID: 19 @@ -573,7 +573,7 @@ IsActive: true Text Renderer Component: Text: BGM - Font: 176667660 + Font: 174412429 IsActive: true UI Component: Canvas ID: 19 @@ -612,7 +612,7 @@ Material: 128676209 IsActive: true Slider Component: - Slider Value: 0 + Slider Value: 1 IsActive: true UI Component: Canvas ID: 19 @@ -635,7 +635,7 @@ Material: 128676209 IsActive: true Slider Component: - Slider Value: 0 + Slider Value: 1 IsActive: true UI Component: Canvas ID: 19 @@ -658,7 +658,7 @@ Material: 128676209 IsActive: true Slider Component: - Slider Value: 0 + Slider Value: 1 IsActive: true UI Component: Canvas ID: 19 @@ -678,7 +678,7 @@ IsActive: true Text Renderer Component: Text: Camera - Font: 176667660 + Font: 174412429 IsActive: true UI Component: Canvas ID: 19 @@ -714,7 +714,7 @@ IsActive: true Text Renderer Component: Text: FOV - Font: 176667660 + Font: 174412429 IsActive: true UI Component: Canvas ID: 19 @@ -734,7 +734,7 @@ IsActive: true Text Renderer Component: Text: Sensitivity - Font: 176667660 + Font: 174412429 IsActive: true UI Component: Canvas ID: 19 @@ -773,7 +773,7 @@ Material: 128676209 IsActive: true Slider Component: - Slider Value: 0 + Slider Value: 1 IsActive: true UI Component: Canvas ID: 19 @@ -796,7 +796,7 @@ Material: 128676209 IsActive: true Slider Component: - Slider Value: 0 + Slider Value: 1 IsActive: true UI Component: Canvas ID: 19 @@ -832,7 +832,7 @@ IsActive: true Text Renderer Component: Text: 100 - Font: 176667660 + Font: 174412429 IsActive: true UI Component: Canvas ID: 19 @@ -852,7 +852,7 @@ IsActive: true Text Renderer Component: Text: 100 - Font: 176667660 + Font: 174412429 IsActive: true UI Component: Canvas ID: 19 @@ -872,7 +872,7 @@ IsActive: true Text Renderer Component: Text: 100 - Font: 176667660 + Font: 174412429 IsActive: true UI Component: Canvas ID: 19 @@ -908,7 +908,7 @@ IsActive: true Text Renderer Component: Text: 100 - Font: 176667660 + Font: 174412429 IsActive: true UI Component: Canvas ID: 19 @@ -928,7 +928,7 @@ IsActive: true Text Renderer Component: Text: 100 - Font: 176667660 + Font: 174412429 IsActive: true UI Component: Canvas ID: 19 @@ -1004,7 +1004,7 @@ IsActive: true Text Renderer Component: Text: Credits - Font: 176667660 + Font: 174412429 IsActive: true UI Component: Canvas ID: 46 @@ -1080,7 +1080,7 @@ IsActive: true Text Renderer Component: Text: Level Select - Font: 176667660 + Font: 174412429 IsActive: true UI Component: Canvas ID: 50 diff --git a/Assets/Scripts/Gameplay/SC_GameManager.cs b/Assets/Scripts/Gameplay/SC_GameManager.cs index d34a7020..1cebe002 100644 --- a/Assets/Scripts/Gameplay/SC_GameManager.cs +++ b/Assets/Scripts/Gameplay/SC_GameManager.cs @@ -97,7 +97,7 @@ public class GameManager : Script if (itemScored) { multiplierText.GetComponent().Text = $"X {currMultiplierCombo}"; - multiplierText.GetComponent().LocalScale -= fontScalar * Time.DeltaTimeF; + //multiplierText.GetComponent().LocalScale -= fontScalar * Time.DeltaTimeF; currMultiplierDuration += Time.DeltaTimeF; if (currMultiplierDuration >= maxMultiplierDuration) @@ -110,7 +110,7 @@ public class GameManager : Script } else { - multiplierText.GetComponent().LocalScale = Vector3.Zero; + //multiplierText.GetComponent().LocalScale = Vector3.Zero; } if ((timer > 0 && totalItemCount <= 0 && !itemShatter) || Input.GetKeyDown(Input.KeyCode.F1)) diff --git a/Assets/Scripts/UI/SC_SliderText.cs b/Assets/Scripts/UI/SC_SliderText.cs index 54d59f28..e3f5a8b3 100644 --- a/Assets/Scripts/UI/SC_SliderText.cs +++ b/Assets/Scripts/UI/SC_SliderText.cs @@ -14,7 +14,17 @@ namespace SHADE_Scripting.UI public int minValue = 0; public int maxValue = 0; + protected override void start() + { + Slider slider = sliderObj.GetComponent(); + TextRenderable text = GetComponent(); + + if (slider != null && text != null) + { + text.Text = ((int)(slider.GetValue() * (maxValue - minValue) + minValue)).ToString(); + } + } protected override void update() { Slider slider = sliderObj.GetComponent(); diff --git a/SHADE_Engine/src/AudioSystem/SHAudioSystem.cpp b/SHADE_Engine/src/AudioSystem/SHAudioSystem.cpp index a7245123..e02eac50 100644 --- a/SHADE_Engine/src/AudioSystem/SHAudioSystem.cpp +++ b/SHADE_Engine/src/AudioSystem/SHAudioSystem.cpp @@ -16,6 +16,7 @@ #include #include #include +#include "Camera/SHCameraSystem.h" const std::string AUDIO_FOLDER_PATH{ std::string(ASSET_ROOT)+ "/Audio/" }; @@ -53,8 +54,9 @@ namespace SHADE denseListener = &SHComponentManager::GetDense(); fmodStudioSystem->getCoreSystem(&fmodSystem); - - result = fmodStudioSystem->initialize(AUDIO_SYS_MAX_CHANNELS, AUDIO_SYS_MAX_CHANNELS, FMOD_STUDIO_INIT_NORMAL, extraDriverData); + fmodSystem->setSoftwareFormat(0, FMOD_SPEAKERMODE_5POINT1, 0); + result = fmodStudioSystem->initialize(AUDIO_SYS_MAX_CHANNELS, AUDIO_SYS_MAX_CHANNELS, FMOD_STUDIO_INIT_NORMAL | FMOD_INIT_NORMAL, extraDriverData); + ErrorCheck(); fmodSystem->setSoftwareFormat(0, speakerMode, 0); @@ -83,17 +85,10 @@ namespace SHADE LoadBank((AUDIO_FOLDER_PATH + "Master.bank").data()); LoadBank((AUDIO_FOLDER_PATH + "Master.strings.bank").data()); - //LoadBank((AUDIO_FOLDER_PATH + "Music.bank").data()); - //LoadBank((AUDIO_FOLDER_PATH + "footsteps.bank").data()); LoadBank((AUDIO_FOLDER_PATH + "Music.bank").data()); LoadBank((AUDIO_FOLDER_PATH + "SFX.bank").data()); LoadBank((AUDIO_FOLDER_PATH + "UI.bank").data()); - //auto clip = CreateAudioClip("event:/Characters/sfx_footsteps_human"); - //clip->Play(); - //PlayEventOnce("event:/Characters/sfx_footsteps_raccoon"); - //PlayEventOnce("event:/SFX/Dawn/Dawn_Attack"); - #ifdef SHEDITOR // Subscribe to Editor State Change Events @@ -115,35 +110,65 @@ namespace SHADE void SHADE::SHAudioSystem::Run(double dt) { static_cast(dt); - //if (GetKeyState(VK_SPACE) & 0x8000) - // PlayEventOnce("event:/Characters/sfx_footsteps_raccoon"); fmodStudioSystem->update(); - if (!denseListener->empty()) + //int listenerID = 0; + //for(auto& listener : *denseListener) + //{ + // if(!listener.isActive) + // continue; + // //SHAudioListenerComponent& listener = denseListener->at(0); //Loop through dense + // SHTransformComponent* listenerTransform = SHComponentManager::GetComponent_s(listener.GetEID()); + // if (listenerTransform) + // { + // listener.SetPos(listenerTransform->GetWorldPosition()); + // SHQuaternion worldOrientation = listenerTransform->GetWorldOrientation(); + // SHVec3 orientatedFoward = (worldOrientation * SHQuaternion::FromEuler(SHVec3::Forward) * SHQuaternion::Conjugate(worldOrientation)).ToEuler(); + // SHVec3 orientatedUp = (worldOrientation * SHQuaternion::FromEuler(SHVec3::Up) * SHQuaternion::Conjugate(worldOrientation)).ToEuler(); + // listener.SetForward(orientatedFoward); + // listener.SetUp(orientatedUp); + + // FMOD_3D_ATTRIBUTES attribs{ { 0 } }; + // attribs.position = { listener.pos.x, listener.pos.y, listener.pos.z }; + // attribs.forward = { orientatedFoward.x, orientatedFoward.y, orientatedFoward.z }; + // attribs.up = { orientatedUp.x, orientatedUp.y, orientatedUp.z }; + // + // fmodStudioSystem->setListenerAttributes(listenerID++, &attribs); + // } + //} + + if(auto camSystem = SHSystemManager::GetSystem()) { - SHAudioListenerComponent& listener = denseListener->at(0); - SHTransformComponent* listenerTransform = SHComponentManager::GetComponent_s(listener.GetEID()); - if (listenerTransform) + auto mainCamEID = camSystem->GetMainCameraEID(); + if(auto camComponent = SHComponentManager::GetComponent_s(mainCamEID)) { - listener.SetPos(listenerTransform->GetWorldPosition()); // TODO: Clean up listener - listener.SetForward({ (listenerTransform->GetLocalScale()[0] > 0.f) ? 1.f : -1.f, 0.f, 0.f }); //TODO: USE CORRECT FORWARD - FMOD_VECTOR pos = { listener.pos[0] ,listener.pos[1] ,0.f }; - FMOD_VECTOR forward = { listener.forward[0] ,listener.forward[1] ,listener.forward[2] }; - FMOD_VECTOR up = { listener.up[0] ,listener.up[1] ,listener.up[2] }; - fmodSystem->set3DListenerAttributes(0, &pos, nullptr, &forward, &up); + FMOD_3D_ATTRIBUTES attribs{ { 0 } }; + SHVec3 pos = camComponent->GetPosition(); + SHVec3 forward, up, right; + camSystem->GetCameraAxis(*camComponent, forward, right, up); + attribs.position = { pos.x, pos.y, pos.z }; + attribs.forward = { forward.x, forward.y, forward.z }; + attribs.up = { up.x, up.y, up.z }; + fmodStudioSystem->setListenerAttributes(0, &attribs); } } auto [begin, end] = audioClipLibrary.GetDenseAccess(); - for(auto it = begin; it != end; ++it) + for (auto& it = begin; it != end; ++it) { if(it->instance && (it->transformRef != MAX_EID)) { if(SHTransformComponent* transformComponent = SHComponentManager::GetComponent_s(it->transformRef)) { - FMOD_3D_ATTRIBUTES attribs{}; //TODO: Set other attribs + FMOD_3D_ATTRIBUTES attribs{ { 0 } }; auto pos = transformComponent->GetWorldPosition(); + SHQuaternion worldOrientation = transformComponent->GetWorldOrientation(); + SHVec3 orientatedFoward = (worldOrientation * SHQuaternion::FromEuler(SHVec3::Forward) * SHQuaternion::Conjugate(worldOrientation)).ToEuler(); + SHVec3 orientatedUp = (worldOrientation * SHQuaternion::FromEuler(SHVec3::Up) * SHQuaternion::Conjugate(worldOrientation)).ToEuler(); + attribs.position = {pos.x, pos.y, pos.z}; + attribs.forward = {orientatedFoward.x, orientatedFoward.y, orientatedFoward.z}; + attribs.up = {orientatedUp.x, orientatedUp.y, orientatedUp.z}; it->instance->set3DAttributes(&attribs); } } diff --git a/SHADE_Engine/src/AudioSystem/SHAudioSystem.h b/SHADE_Engine/src/AudioSystem/SHAudioSystem.h index 5714a618..68942a8e 100644 --- a/SHADE_Engine/src/AudioSystem/SHAudioSystem.h +++ b/SHADE_Engine/src/AudioSystem/SHAudioSystem.h @@ -22,7 +22,7 @@ namespace SHADE typedef FMOD::Studio::Bank* SHBank; class SHAudioListenerComponent; - + class SH_API AudioClip { public: diff --git a/SHADE_Engine/src/Common/SHAllComponents.h b/SHADE_Engine/src/Common/SHAllComponents.h index 9d280677..36b74853 100644 --- a/SHADE_Engine/src/Common/SHAllComponents.h +++ b/SHADE_Engine/src/Common/SHAllComponents.h @@ -12,4 +12,5 @@ #include "Graphics/MiddleEnd/Lights/SHLightComponent.h" #include "Graphics/MiddleEnd/Interface/SHRenderable.h" #include "Physics/Interface/SHColliderComponent.h" -#include "Graphics/MiddleEnd/TextRendering/SHTextRenderableComponent.h" \ No newline at end of file +#include "Graphics/MiddleEnd/TextRendering/SHTextRenderableComponent.h" +#include "AudioSystem/SHAudioListenerComponent.h" \ 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 31a959f3..a0aaf0fa 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/AssetBrowser/SHAssetBrowser.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/AssetBrowser/SHAssetBrowser.cpp @@ -267,7 +267,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()); @@ -280,10 +280,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 { @@ -363,7 +373,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: @@ -431,7 +446,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..8cc41d56 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanel.cpp @@ -29,6 +29,8 @@ #include "Serialization/Prefab/SHPrefabManager.h" #include "../SHEditorWindowManager.h" #include "../AssetBrowser/SHAssetBrowser.h" +#include "Assets/SHAssetManager.h" +#include "Assets/Asset Types/SHPrefabAsset.h" namespace SHADE @@ -99,7 +101,7 @@ namespace SHADE } ImGui::SeparatorEx(ImGuiSeparatorFlags_Horizontal); - if (!ImGui::IsAnyItemFocused()) + if (!ImGui::IsAnyItemActive()) { if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) && ImGui::IsKeyReleased(ImGuiKey_A)) { @@ -136,6 +138,23 @@ namespace SHADE draggingEntities.clear(); ImGui::ClearDragDrop(); } + //else if(SHDragDrop::currentDragDropTag == SHDragDrop::DRAG_RESOURCE) + //{ + // if (const AssetID* assetPayload = SHDragDrop::AcceptPayload(SHDragDrop::DRAG_RESOURCE)) //If payload is valid + // { + // auto assetId = *assetPayload; + // auto createdEntitiesList = SHSerialization::DeserializeEntitiesFromString(SHAssetManager::GetData(assetId)->data); + // if (!createdEntitiesList.empty()) + // { + // std::vector eidList; + // std::ranges::transform(createdEntitiesList, std::back_inserter(eidList), [](std::pair pair) {return pair.second; }); + // ParentSelectedEntities(eid, eidList); + // SetScrollTo(createdEntitiesList.begin()->second); + // SHPrefabManager::AddEntity(assetId, createdEntitiesList.begin()->second); + // skipFrame = true; + // } + // } + //} } } ImGui::End(); @@ -359,6 +378,20 @@ namespace SHADE draggingEntities.clear(); //ImGui::ClearDragDrop(); } + if (const AssetID* assetPayload = SHDragDrop::AcceptPayload(SHDragDrop::DRAG_RESOURCE)) //If payload is valid + { + auto assetId = *assetPayload; + auto createdEntitiesList = SHSerialization::DeserializeEntitiesFromString(SHAssetManager::GetData(assetId)->data); + if(!createdEntitiesList.empty()) + { + std::vector eidList; + std::ranges::transform(createdEntitiesList, std::back_inserter(eidList), [](std::pair pair){return pair.second;} ); + ParentSelectedEntities(eid, eidList); + SetScrollTo(createdEntitiesList.begin()->second); + SHPrefabManager::AddEntity(assetId, createdEntitiesList.begin()->second); + skipFrame = true; + } + } SHDragDrop::EndTarget(); } diff --git a/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanelCommands.cpp b/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanelCommands.cpp index 78545829..7bc19443 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanelCommands.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/HierarchyPanel/SHHierarchyPanelCommands.cpp @@ -49,7 +49,8 @@ namespace SHADE data.createdEntities.clear(); data.createdEntities = SHSerialization::DeserializeEntitiesFromString(data.entityData, data.parentEID); data.entityData = SHSerialization::ResolveSerializedEntityIndices(data.entityData, data.createdEntities); - SHEditorWindowManager::GetEditorWindow()->SetScrollTo(data.createdEntities.begin()->second); + if(!data.createdEntities.empty()) + SHEditorWindowManager::GetEditorWindow()->SetScrollTo(data.createdEntities.begin()->second); } void SHPasteEntitiesCommand::Undo() diff --git a/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorInspector.cpp b/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorInspector.cpp index 391e0be2..c95221ec 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorInspector.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorInspector.cpp @@ -171,10 +171,15 @@ namespace SHADE if (auto toggleButton = SHComponentManager::GetComponent_s(eid)) { DrawComponent(toggleButton); - }if (auto slider = SHComponentManager::GetComponent_s(eid)) + } + if (auto slider = SHComponentManager::GetComponent_s(eid)) { DrawComponent(slider); } + if(auto listenerComponent = SHComponentManager::GetComponent_s(eid)) + { + DrawComponent(listenerComponent); + } ImGui::Separator(); // Render Scripts SHScriptEngine* scriptEngine = static_cast(SHSystemManager::GetSystem()); @@ -198,7 +203,7 @@ namespace SHADE DrawAddComponentWithEnforcedComponentButton(eid); DrawAddComponentWithEnforcedComponentButton(eid); DrawAddComponentWithEnforcedComponentButton(eid); - + DrawAddComponentWithEnforcedComponentButton(eid); ImGui::EndMenu(); } 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(); diff --git a/SHADE_Engine/src/Serialization/SHSerialization.cpp b/SHADE_Engine/src/Serialization/SHSerialization.cpp index 29fb8cd7..13f5e36e 100644 --- a/SHADE_Engine/src/Serialization/SHSerialization.cpp +++ b/SHADE_Engine/src/Serialization/SHSerialization.cpp @@ -246,6 +246,7 @@ namespace SHADE AddComponentToComponentNode(components, eid); AddComponentToComponentNode(components, eid); AddComponentToComponentNode(components, eid); + AddComponentToComponentNode(components, eid); node[ComponentsNode] = components; @@ -306,6 +307,7 @@ namespace SHADE AddComponentID(componentIDList, componentsNode); AddComponentID(componentIDList, componentsNode); AddComponentID(componentIDList, componentsNode); + AddComponentID(componentIDList, componentsNode); return componentIDList; } @@ -392,5 +394,6 @@ namespace SHADE SHSerializationHelper::InitializeComponentFromNode(componentsNode, eid); SHSerializationHelper::InitializeComponentFromNode(componentsNode, eid); SHSerializationHelper::InitializeComponentFromNode(componentsNode, eid); + SHSerializationHelper::InitializeComponentFromNode(componentsNode, eid); } } diff --git a/SHADE_Engine/src/UI/SHUISystem.cpp b/SHADE_Engine/src/UI/SHUISystem.cpp index 05bd9ab5..87a6552d 100644 --- a/SHADE_Engine/src/UI/SHUISystem.cpp +++ b/SHADE_Engine/src/UI/SHUISystem.cpp @@ -432,16 +432,25 @@ namespace SHADE if (comp.GetValue() < 0.0f) comp.value = 0.0f; } - - if (comp.GetValue() != tempValue) + try { - //Set shader value. - auto renderable = SHComponentManager::GetComponent_s(comp.GetEID()); //auto texture = SHResourceManager::Get(comp.GetDefaultTexture()); auto material = renderable->GetModifiableMaterial(); - - material->SetProperty("data.sliderThreshold", comp.GetValue()); + if (renderable) + { + if (comp.GetValue() != material->GetProperty("data.sliderThreshold")) + { + //Set shader value. + + material->SetProperty("data.sliderThreshold", comp.GetValue()); + + } + } + + } + catch (...) + { } diff --git a/SHADE_Managed/src/Scripts/ScriptStore.cxx b/SHADE_Managed/src/Scripts/ScriptStore.cxx index aba63eb2..5d3a3bac 100644 --- a/SHADE_Managed/src/Scripts/ScriptStore.cxx +++ b/SHADE_Managed/src/Scripts/ScriptStore.cxx @@ -903,6 +903,12 @@ namespace SHADE { return pair->type; } + + /* Sort */ + System::String^ sortKeyAccessor(System::Type^ type) + { + return type->Name; + } } void ScriptStore::refreshScriptTypeList() @@ -926,6 +932,10 @@ namespace SHADE Func^ selector = gcnew Func(selectorFunc); scriptTypeList = Enumerable::Select(whereResult, selector); + /* Sort: By Alphabetical Order */ + Func^ sorter = gcnew Func(sortKeyAccessor); + scriptTypeList = Enumerable::OrderBy(scriptTypeList, sorter); + // Log std::ostringstream oss; oss << "[ScriptStore] Successfully retrieved references to " << Enumerable::Count(scriptTypeList)