editor: moved eliminateCoarseCascades and KTX2convert buttons to General options
This commit is contained in:
@@ -13,7 +13,7 @@ void GeneralWindow::Create(EditorComponent* _editor)
|
||||
|
||||
wi::gui::Window::Create("General", wi::gui::Window::WindowControls::COLLAPSE);
|
||||
|
||||
SetSize(XMFLOAT2(580, 620));
|
||||
SetSize(XMFLOAT2(580, 680));
|
||||
|
||||
physicsEnabledCheckBox.Create("Physics: ");
|
||||
physicsEnabledCheckBox.SetTooltip("Toggle Physics Simulation On/Off");
|
||||
@@ -491,13 +491,25 @@ void GeneralWindow::Create(EditorComponent* _editor)
|
||||
editor->newSceneButton.sprites[i].params.corners_rounding[2].radius = 10;
|
||||
editor->newSceneButton.sprites[i].params.corners_rounding[3].radius = 10;
|
||||
}
|
||||
for (int i = 0; i < arraysize(localizationButton.sprites); ++i)
|
||||
for (int i = 0; i < arraysize(wi::gui::Widget::sprites); ++i)
|
||||
{
|
||||
localizationButton.sprites[i].params.enableCornerRounding();
|
||||
localizationButton.sprites[i].params.corners_rounding[0].radius = 8;
|
||||
localizationButton.sprites[i].params.corners_rounding[1].radius = 8;
|
||||
localizationButton.sprites[i].params.corners_rounding[2].radius = 8;
|
||||
localizationButton.sprites[i].params.corners_rounding[3].radius = 8;
|
||||
|
||||
eliminateCoarseCascadesButton.sprites[i].params.enableCornerRounding();
|
||||
eliminateCoarseCascadesButton.sprites[i].params.corners_rounding[0].radius = 8;
|
||||
eliminateCoarseCascadesButton.sprites[i].params.corners_rounding[1].radius = 8;
|
||||
eliminateCoarseCascadesButton.sprites[i].params.corners_rounding[2].radius = 8;
|
||||
eliminateCoarseCascadesButton.sprites[i].params.corners_rounding[3].radius = 8;
|
||||
|
||||
ktxConvButton.sprites[i].params.enableCornerRounding();
|
||||
ktxConvButton.sprites[i].params.corners_rounding[0].radius = 8;
|
||||
ktxConvButton.sprites[i].params.corners_rounding[1].radius = 8;
|
||||
ktxConvButton.sprites[i].params.corners_rounding[2].radius = 8;
|
||||
ktxConvButton.sprites[i].params.corners_rounding[3].radius = 8;
|
||||
}
|
||||
for (int i = 0; i < arraysize(wi::gui::Widget::sprites); ++i)
|
||||
{
|
||||
@@ -555,6 +567,73 @@ void GeneralWindow::Create(EditorComponent* _editor)
|
||||
|
||||
});
|
||||
AddWidget(&themeCombo);
|
||||
|
||||
|
||||
|
||||
eliminateCoarseCascadesButton.Create("EliminateCoarseCascades");
|
||||
eliminateCoarseCascadesButton.SetTooltip("Eliminate the coarse cascade mask for every object in the scene.");
|
||||
eliminateCoarseCascadesButton.SetSize(XMFLOAT2(100, 18));
|
||||
eliminateCoarseCascadesButton.OnClick([=](wi::gui::EventArgs args) {
|
||||
|
||||
Scene& scene = editor->GetCurrentScene();
|
||||
for (size_t i = 0; i < scene.objects.GetCount(); ++i)
|
||||
{
|
||||
scene.objects[i].cascadeMask = 1;
|
||||
}
|
||||
|
||||
});
|
||||
AddWidget(&eliminateCoarseCascadesButton);
|
||||
|
||||
|
||||
ktxConvButton.Create("KTX2 Convert");
|
||||
ktxConvButton.SetTooltip("All material textures in the scene will be converted to KTX2 format.\nTHIS MIGHT TAKE LONG, SO GET YOURSELF A COFFEE OR TEA!");
|
||||
ktxConvButton.SetSize(XMFLOAT2(100, 18));
|
||||
ktxConvButton.OnClick([=](wi::gui::EventArgs args) {
|
||||
|
||||
Scene& scene = editor->GetCurrentScene();
|
||||
|
||||
wi::unordered_map<std::string, wi::Resource> conv;
|
||||
for (uint32_t i = 0; i < scene.materials.GetCount(); ++i)
|
||||
{
|
||||
MaterialComponent& material = scene.materials[i];
|
||||
for (auto& x : material.textures)
|
||||
{
|
||||
if (x.GetGPUResource() == nullptr)
|
||||
continue;
|
||||
if (wi::helper::GetExtensionFromFileName(x.name).compare("KTX2"))
|
||||
{
|
||||
x.name = wi::helper::ReplaceExtension(x.name, "KTX2");
|
||||
conv[x.name] = x.resource;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wi::jobsystem::context ctx;
|
||||
for (auto& x : conv)
|
||||
{
|
||||
wi::vector<uint8_t> filedata;
|
||||
if (wi::helper::saveTextureToMemory(x.second.GetTexture(), filedata))
|
||||
{
|
||||
x.second.SetFileData(std::move(filedata));
|
||||
wi::jobsystem::Execute(ctx, [&](wi::jobsystem::JobArgs args) {
|
||||
wi::vector<uint8_t> filedata_ktx2;
|
||||
if (wi::helper::saveTextureToMemoryFile(x.second.GetFileData(), x.second.GetTexture().desc, "KTX2", filedata_ktx2))
|
||||
{
|
||||
x.second = wi::resourcemanager::Load(x.first, wi::resourcemanager::Flags::IMPORT_RETAIN_FILEDATA, filedata_ktx2.data(), filedata_ktx2.size());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
wi::jobsystem::Wait(ctx);
|
||||
|
||||
for (uint32_t i = 0; i < scene.materials.GetCount(); ++i)
|
||||
{
|
||||
MaterialComponent& material = scene.materials[i];
|
||||
material.CreateRenderData();
|
||||
}
|
||||
|
||||
});
|
||||
AddWidget(&ktxConvButton);
|
||||
}
|
||||
|
||||
void GeneralWindow::RefreshLanguageSelectionAfterWholeGUIWasInitialized()
|
||||
@@ -670,4 +749,7 @@ void GeneralWindow::ResizeLayout()
|
||||
|
||||
y += jump;
|
||||
width = prev_width;
|
||||
|
||||
add_fullwidth(eliminateCoarseCascadesButton);
|
||||
add_fullwidth(ktxConvButton);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,8 @@ public:
|
||||
wi::gui::CheckBox skeletonsVisibleCheckBox;
|
||||
|
||||
wi::gui::Button localizationButton;
|
||||
wi::gui::Button eliminateCoarseCascadesButton;
|
||||
wi::gui::Button ktxConvButton;
|
||||
|
||||
void ResizeLayout() override;
|
||||
|
||||
|
||||
@@ -964,74 +964,6 @@ void WeatherWindow::Create(EditorComponent* _editor)
|
||||
AddWidget(&preset5Button);
|
||||
|
||||
|
||||
eliminateCoarseCascadesButton.Create("EliminateCoarseCascades");
|
||||
eliminateCoarseCascadesButton.SetTooltip("Eliminate the coarse cascade mask for every object in the scene.");
|
||||
eliminateCoarseCascadesButton.SetSize(XMFLOAT2(mod_wid, hei));
|
||||
eliminateCoarseCascadesButton.SetPos(XMFLOAT2(mod_x, y += step * 2));
|
||||
eliminateCoarseCascadesButton.OnClick([=](wi::gui::EventArgs args) {
|
||||
|
||||
Scene& scene = editor->GetCurrentScene();
|
||||
for (size_t i = 0; i < scene.objects.GetCount(); ++i)
|
||||
{
|
||||
scene.objects[i].cascadeMask = 1;
|
||||
}
|
||||
|
||||
});
|
||||
AddWidget(&eliminateCoarseCascadesButton);
|
||||
|
||||
|
||||
ktxConvButton.Create("KTX2 Convert");
|
||||
ktxConvButton.SetTooltip("All material textures in the scene will be converted to KTX2 format.\nTHIS MIGHT TAKE LONG, SO GET YOURSELF A COFFEE OR TEA!");
|
||||
ktxConvButton.SetSize(XMFLOAT2(mod_wid, hei));
|
||||
ktxConvButton.SetPos(XMFLOAT2(mod_x, y += step));
|
||||
ktxConvButton.OnClick([=](wi::gui::EventArgs args) {
|
||||
|
||||
Scene& scene = editor->GetCurrentScene();
|
||||
|
||||
wi::unordered_map<std::string, wi::Resource> conv;
|
||||
for (uint32_t i = 0; i < scene.materials.GetCount(); ++i)
|
||||
{
|
||||
MaterialComponent& material = scene.materials[i];
|
||||
for (auto& x : material.textures)
|
||||
{
|
||||
if (x.GetGPUResource() == nullptr)
|
||||
continue;
|
||||
if (wi::helper::GetExtensionFromFileName(x.name).compare("KTX2"))
|
||||
{
|
||||
x.name = wi::helper::ReplaceExtension(x.name, "KTX2");
|
||||
conv[x.name] = x.resource;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wi::jobsystem::context ctx;
|
||||
for (auto& x : conv)
|
||||
{
|
||||
wi::vector<uint8_t> filedata;
|
||||
if (wi::helper::saveTextureToMemory(x.second.GetTexture(), filedata))
|
||||
{
|
||||
x.second.SetFileData(std::move(filedata));
|
||||
wi::jobsystem::Execute(ctx, [&](wi::jobsystem::JobArgs args) {
|
||||
wi::vector<uint8_t> filedata_ktx2;
|
||||
if (wi::helper::saveTextureToMemoryFile(x.second.GetFileData(), x.second.GetTexture().desc, "KTX2", filedata_ktx2))
|
||||
{
|
||||
x.second = wi::resourcemanager::Load(x.first, wi::resourcemanager::Flags::IMPORT_RETAIN_FILEDATA, filedata_ktx2.data(), filedata_ktx2.size());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
wi::jobsystem::Wait(ctx);
|
||||
|
||||
for (uint32_t i = 0; i < scene.materials.GetCount(); ++i)
|
||||
{
|
||||
MaterialComponent& material = scene.materials[i];
|
||||
material.CreateRenderData();
|
||||
}
|
||||
|
||||
});
|
||||
AddWidget(&ktxConvButton);
|
||||
|
||||
|
||||
|
||||
|
||||
SetMinimized(true);
|
||||
@@ -1395,7 +1327,5 @@ void WeatherWindow::ResizeLayout()
|
||||
add_fullwidth(preset3Button);
|
||||
add_fullwidth(preset4Button);
|
||||
add_fullwidth(preset5Button);
|
||||
add_fullwidth(eliminateCoarseCascadesButton);
|
||||
add_fullwidth(ktxConvButton);
|
||||
|
||||
}
|
||||
|
||||
@@ -101,8 +101,6 @@ public:
|
||||
wi::gui::Button preset3Button;
|
||||
wi::gui::Button preset4Button;
|
||||
wi::gui::Button preset5Button;
|
||||
wi::gui::Button eliminateCoarseCascadesButton;
|
||||
wi::gui::Button ktxConvButton;
|
||||
|
||||
void ResizeLayout() override;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user