From e081dcc089ec6eba2d3458fe91c05a9eaf795cfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tur=C3=A1nszki=20J=C3=A1nos?= Date: Tue, 27 Sep 2022 22:33:47 +0200 Subject: [PATCH] relative path is not computed if already relative; editor updates; --- Editor/LayerWindow.cpp | 4 ++-- Editor/TerrainWindow.cpp | 20 ++++++++++---------- WickedEngine/wiHelper.cpp | 11 +++++++---- WickedEngine/wiVersion.cpp | 2 +- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/Editor/LayerWindow.cpp b/Editor/LayerWindow.cpp index 52c7317b5..0209608a7 100644 --- a/Editor/LayerWindow.cpp +++ b/Editor/LayerWindow.cpp @@ -189,14 +189,14 @@ void LayerWindow::ResizeLayout() y += enableNoneButton.GetSize().y; y += padding; - float off_x = padding; + float off_x = padding + 30; for (uint32_t i = 0; i < arraysize(layers); ++i) { layers[i].SetPos(XMFLOAT2(off_x, y)); off_x += 50; if (off_x + layers[i].GetSize().x > width - padding) { - off_x = padding; + off_x = padding + 30; y += layers[i].GetSize().y; y += padding; } diff --git a/Editor/TerrainWindow.cpp b/Editor/TerrainWindow.cpp index e60104da8..af578a0aa 100644 --- a/Editor/TerrainWindow.cpp +++ b/Editor/TerrainWindow.cpp @@ -860,15 +860,15 @@ void TerrainWindow::SetupAssets() terrain_preset.material_Slope.SetRoughness(0.1f); terrain_preset.material_LowAltitude.SetRoughness(1); terrain_preset.material_HighAltitude.SetRoughness(1); - terrain_preset.material_Base.textures[MaterialComponent::BASECOLORMAP].name = "terrain/base.jpg"; - terrain_preset.material_Base.textures[MaterialComponent::NORMALMAP].name = "terrain/base_nor.jpg"; - terrain_preset.material_Slope.textures[MaterialComponent::BASECOLORMAP].name = "terrain/slope.jpg"; - terrain_preset.material_Slope.textures[MaterialComponent::NORMALMAP].name = "terrain/slope_nor.jpg"; - terrain_preset.material_LowAltitude.textures[MaterialComponent::BASECOLORMAP].name = "terrain/low_altitude.jpg"; - terrain_preset.material_LowAltitude.textures[MaterialComponent::NORMALMAP].name = "terrain/low_altitude_nor.jpg"; - terrain_preset.material_HighAltitude.textures[MaterialComponent::BASECOLORMAP].name = "terrain/high_altitude.jpg"; - terrain_preset.material_HighAltitude.textures[MaterialComponent::NORMALMAP].name = "terrain/high_altitude_nor.jpg"; - terrain_preset.material_GrassParticle.textures[MaterialComponent::BASECOLORMAP].name = "terrain/grassparticle.png"; + terrain_preset.material_Base.textures[MaterialComponent::BASECOLORMAP].name = wi::helper::GetCurrentPath() + "/terrain/base.jpg"; + terrain_preset.material_Base.textures[MaterialComponent::NORMALMAP].name = wi::helper::GetCurrentPath() + "/terrain/base_nor.jpg"; + terrain_preset.material_Slope.textures[MaterialComponent::BASECOLORMAP].name = wi::helper::GetCurrentPath() + "/terrain/slope.jpg"; + terrain_preset.material_Slope.textures[MaterialComponent::NORMALMAP].name = wi::helper::GetCurrentPath() + "/terrain/slope_nor.jpg"; + terrain_preset.material_LowAltitude.textures[MaterialComponent::BASECOLORMAP].name = wi::helper::GetCurrentPath() + "/terrain/low_altitude.jpg"; + terrain_preset.material_LowAltitude.textures[MaterialComponent::NORMALMAP].name = wi::helper::GetCurrentPath() + "/terrain/low_altitude_nor.jpg"; + terrain_preset.material_HighAltitude.textures[MaterialComponent::BASECOLORMAP].name = wi::helper::GetCurrentPath() + "/terrain/high_altitude.jpg"; + terrain_preset.material_HighAltitude.textures[MaterialComponent::NORMALMAP].name = wi::helper::GetCurrentPath() + "/terrain/high_altitude_nor.jpg"; + terrain_preset.material_GrassParticle.textures[MaterialComponent::BASECOLORMAP].name = wi::helper::GetCurrentPath() + "/terrain/grassparticle.png"; terrain_preset.material_GrassParticle.alphaRef = 0.75f; terrain_preset.grass_properties.length = 2; terrain_preset.grass_properties.frameCount = 2; @@ -882,7 +882,7 @@ void TerrainWindow::SetupAssets() terrain_preset.material_GrassParticle.CreateRenderData(); Scene props_scene; - wi::scene::LoadModel(props_scene, "terrain/props.wiscene"); + wi::scene::LoadModel(props_scene, wi::helper::GetCurrentPath() + "/terrain/props.wiscene"); // Tree prop: if(props_scene.Entity_FindByName("tree_mesh") != INVALID_ENTITY) diff --git a/WickedEngine/wiHelper.cpp b/WickedEngine/wiHelper.cpp index e8e48e0d1..a0cd8d21c 100644 --- a/WickedEngine/wiHelper.cpp +++ b/WickedEngine/wiHelper.cpp @@ -649,11 +649,14 @@ namespace wi::helper #else std::filesystem::path filepath = path; - std::filesystem::path rootpath = rootdir; - std::filesystem::path relative = std::filesystem::relative(path, rootdir); - if (!relative.empty()) + if (filepath.is_absolute()) { - path = relative.string(); + std::filesystem::path rootpath = rootdir; + std::filesystem::path relative = std::filesystem::relative(path, rootdir); + if (!relative.empty()) + { + path = relative.string(); + } } #endif // PLATFORM_UWP diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index b01f982d8..912043925 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -9,7 +9,7 @@ namespace wi::version // minor features, major updates, breaking compatibility changes const int minor = 71; // minor bug fixes, alterations, refactors, updates - const int revision = 56; + const int revision = 57; const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);