Added ability to change subpass for a material and fixed typo for vertex shader in the material editor
This commit is contained in:
parent
a67e65ff76
commit
8a4a469abf
|
@ -1,8 +1,11 @@
|
||||||
#include "SHpch.h"
|
#include "SHpch.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <imgui.h>
|
||||||
|
|
||||||
#include "Serialization/SHSerializationHelper.hpp"
|
#include "Serialization/SHSerializationHelper.hpp"
|
||||||
#include "SHMaterialInspector.h"
|
#include "SHMaterialInspector.h"
|
||||||
#include "Editor/SHImGuiHelpers.hpp"
|
#include "Editor/SHImGuiHelpers.hpp"
|
||||||
#include <imgui.h>
|
|
||||||
|
|
||||||
#include "Assets/SHAssetManager.h"
|
#include "Assets/SHAssetManager.h"
|
||||||
#include "Editor/IconsMaterialDesign.h"
|
#include "Editor/IconsMaterialDesign.h"
|
||||||
|
@ -176,7 +179,7 @@ namespace SHADE
|
||||||
const std::string VERT_SHADER_NAME = VERT_SHADER_INFO ? VERT_SHADER_INFO->name : "Unknown Shader";
|
const std::string VERT_SHADER_NAME = VERT_SHADER_INFO ? VERT_SHADER_INFO->name : "Unknown Shader";
|
||||||
isDirty |= SHEditorWidgets::DragDropReadOnlyField<AssetID>
|
isDirty |= SHEditorWidgets::DragDropReadOnlyField<AssetID>
|
||||||
(
|
(
|
||||||
"Fragment Shader", VERT_SHADER_NAME.data(),
|
"Vertex Shader", VERT_SHADER_NAME.data(),
|
||||||
[this]() { return currentMatSpec->vertexShader; },
|
[this]() { return currentMatSpec->vertexShader; },
|
||||||
[this](const AssetID& id) { currentMatSpec->vertexShader = id; },
|
[this](const AssetID& id) { currentMatSpec->vertexShader = id; },
|
||||||
SHDragDrop::DRAG_RESOURCE
|
SHDragDrop::DRAG_RESOURCE
|
||||||
|
@ -191,6 +194,37 @@ namespace SHADE
|
||||||
SHDragDrop::DRAG_RESOURCE
|
SHDragDrop::DRAG_RESOURCE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Subpass
|
||||||
|
const auto& SP_NAMES = SHGraphicsConstants::RenderGraphEntityNames::USABLE_SUBPASSES;
|
||||||
|
ImGui::Text("Subpass");
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::BeginCombo("##", currentMatSpec->subpassName.data(), ImGuiComboFlags_None))
|
||||||
|
{
|
||||||
|
for (const auto& NAME : SP_NAMES)
|
||||||
|
{
|
||||||
|
const bool IS_SELECTED = currentMatSpec->subpassName == NAME;
|
||||||
|
if (ImGui::Selectable(NAME.data(), IS_SELECTED))
|
||||||
|
{
|
||||||
|
isDirty = true;
|
||||||
|
SHCommandManager::PerformCommand
|
||||||
|
(
|
||||||
|
std::reinterpret_pointer_cast<SHBaseCommand>(std::make_shared<SHCommand<std::string>>
|
||||||
|
(
|
||||||
|
currentMatSpec->subpassName,
|
||||||
|
std::string(NAME),
|
||||||
|
[&](const std::string& newName){ currentMatSpec->subpassName = newName; }
|
||||||
|
)),
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (IS_SELECTED)
|
||||||
|
{
|
||||||
|
ImGui::SetItemDefaultFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndCombo();
|
||||||
|
}
|
||||||
|
|
||||||
// Load the shader to access it's data
|
// Load the shader to access it's data
|
||||||
auto fragShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(currentMatSpec->fragShader);
|
auto fragShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(currentMatSpec->fragShader);
|
||||||
if (!fragShader)
|
if (!fragShader)
|
||||||
|
|
Loading…
Reference in New Issue