Fixed UI Rendering #326
|
@ -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)
|
||||||
|
|
|
@ -98,9 +98,9 @@ namespace SHADE
|
||||||
static bool IsItemHovered();
|
static bool IsItemHovered();
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* ImGui Wrapper Functions - Menu */
|
/* ImGui Wrapper Functions - Menu */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
static bool BeginMenu(const std::string& label);
|
static bool BeginMenu(const std::string& label);
|
||||||
static bool BeginMenu(const std::string& label, const char* icon);
|
static bool BeginMenu(const std::string& label, const char* icon);
|
||||||
static void EndMenu();
|
static void EndMenu();
|
||||||
static void BeginTooltip();
|
static void BeginTooltip();
|
||||||
|
@ -164,8 +164,8 @@ namespace SHADE
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="title">Text to display.</param>
|
/// <param name="title">Text to display.</param>
|
||||||
/// <returns>True if button was pressed.</returns>
|
/// <returns>True if button was pressed.</returns>
|
||||||
static bool Button(const std::string& title);
|
static bool Button(const std::string& title);
|
||||||
static bool Selectable(const std::string& label);
|
static bool Selectable(const std::string& label);
|
||||||
static bool Selectable(const std::string& label, const char* icon);
|
static bool Selectable(const std::string& label, const char* icon);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a checkbox widget for boolean input.
|
/// Creates a checkbox widget for boolean input.
|
||||||
|
|
Loading…
Reference in New Issue