diff --git a/SHADE_Engine/src/Editor/EditorWindow/MaterialInspector/SHMaterialInspector.cpp b/SHADE_Engine/src/Editor/EditorWindow/MaterialInspector/SHMaterialInspector.cpp index 537cfc55..d382451d 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/MaterialInspector/SHMaterialInspector.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/MaterialInspector/SHMaterialInspector.cpp @@ -1,8 +1,11 @@ #include "SHpch.h" + +#include +#include + #include "Serialization/SHSerializationHelper.hpp" #include "SHMaterialInspector.h" #include "Editor/SHImGuiHelpers.hpp" -#include #include "Assets/SHAssetManager.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"; isDirty |= SHEditorWidgets::DragDropReadOnlyField ( - "Fragment Shader", VERT_SHADER_NAME.data(), + "Vertex Shader", VERT_SHADER_NAME.data(), [this]() { return currentMatSpec->vertexShader; }, [this](const AssetID& id) { currentMatSpec->vertexShader = id; }, SHDragDrop::DRAG_RESOURCE @@ -191,6 +194,37 @@ namespace SHADE 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(std::make_shared> + ( + 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 auto fragShader = SHResourceManager::LoadOrGet(currentMatSpec->fragShader); if (!fragShader) diff --git a/SHADE_Engine/src/Editor/SHEditorUI.h b/SHADE_Engine/src/Editor/SHEditorUI.h index cd87f46b..23cc2d1a 100644 --- a/SHADE_Engine/src/Editor/SHEditorUI.h +++ b/SHADE_Engine/src/Editor/SHEditorUI.h @@ -98,9 +98,9 @@ namespace SHADE static bool IsItemHovered(); /*-----------------------------------------------------------------------------*/ - /* ImGui Wrapper Functions - Menu */ - /*-----------------------------------------------------------------------------*/ - static bool BeginMenu(const std::string& label); + /* ImGui Wrapper Functions - Menu */ + /*-----------------------------------------------------------------------------*/ + static bool BeginMenu(const std::string& label); static bool BeginMenu(const std::string& label, const char* icon); static void EndMenu(); static void BeginTooltip(); @@ -164,8 +164,8 @@ namespace SHADE /// /// Text to display. /// True if button was pressed. - static bool Button(const std::string& title); - static bool Selectable(const std::string& label); + static bool Button(const std::string& title); + static bool Selectable(const std::string& label); static bool Selectable(const std::string& label, const char* icon); /// /// Creates a checkbox widget for boolean input.