From 497a0ddb2ab57f6c517543ca20ea1b8333214710 Mon Sep 17 00:00:00 2001 From: hnOsmium0001 Date: Tue, 19 Apr 2022 12:36:02 -0700 Subject: Add hardcoded dependencies for IresManager, migrate Shader to Ires --- source/EditorCore.cpp | 99 --------------------------------------------------- 1 file changed, 99 deletions(-) (limited to 'source/EditorCore.cpp') diff --git a/source/EditorCore.cpp b/source/EditorCore.cpp index 1be6418..59da2b3 100644 --- a/source/EditorCore.cpp +++ b/source/EditorCore.cpp @@ -66,9 +66,6 @@ void EditorContentBrowser::Show(bool* open) { if (ImGui::Selectable("Settings", mPane == P_Settings)) { mPane = P_Settings; } - if (ImGui::Selectable("Shaders", mPane == P_Shader)) { - mPane = P_Shader; - } if (ImGui::Selectable("Ires", mPane == P_Ires)) { mPane = P_Ires; } @@ -83,37 +80,6 @@ void EditorContentBrowser::Show(bool* open) { ImGui::SliderFloat("Height", &mBrowserHeight, 0.1f, 1.0f); } break; - case P_Shader: { - if (ImGui::Button("Refresh")) { - // TODO reload shaders while keeping existing references working - } - ImGui::SameLine(); - if (ImGui::Button("Save all")) { - auto& shaders = ShaderManager::instance->GetShaders(); - for (auto&& [DISCARD, shader] : shaders) { - shader->SaveMetadataToFile(shader->GetDesignatedMetadataPath()); - } - } - - auto& shaders = ShaderManager::instance->GetShaders(); - for (auto it = shaders.begin(); it != shaders.end(); ++it) { - auto shader = it->second.Get(); - auto& name = shader->GetName(); - - bool selected = mInspector->selectedItPtr == shader; - if (ImGui::Selectable(name.c_str(), selected)) { - mInspector->SelectTarget(EditorInspector::ITT_Shader, shader); - } - - if (ImGui::BeginDragDropSource()) { - // Reason: intentionally using pointer as Fpayload - ImGui::SetDragDropPayload(BRUSSEL_TAG_Shader, &shader, sizeof(shader)); // NOLINT(bugprone-sizeof-expression) - ImGui::Text("Shader '%s'", name.c_str()); - ImGui::EndDragDropSource(); - } - } - } break; - case P_Ires: { auto itt = mInspector->selectedItt; auto itPtr = mInspector->selectedItPtr; @@ -251,20 +217,6 @@ void PushKeyCodeRecorder(App* app, int* writeKey, bool* writeKeyStatus) { return false; }); } - -void ShowShaderName(const Shader* shader) { - if (shader) { - auto& name = shader->GetName(); - bool isAnnoymous = name.empty(); - if (isAnnoymous) { - ImGui::Text("Shader ", (void*)shader); - } else { - ImGui::Text("Shader: %s", name.c_str()); - } - } else { - ImGui::TextUnformatted("Shader: "); - } -} } // namespace ProjectBrussel_UNITY_ID EditorInstance::EditorInstance(App* app, GameWorld* world) @@ -297,10 +249,6 @@ void EditorInstance::Show() { ShowInspector(static_cast(mEdInspector.selectedItPtr)); } break; - case EditorInspector::ITT_Shader: { - ShowInspector(static_cast(mEdInspector.selectedItPtr)); - } break; - case EditorInspector::ITT_Ires: { auto ires = static_cast(mEdInspector.selectedItPtr); ShowInspector(ires); @@ -322,53 +270,6 @@ void EditorInstance::ShowWorldProperties() { // TOOD move resource-specific and gameobject-specific inspector code into attachments mechanism -void EditorInstance::ShowInspector(Shader* shader) { - using namespace Tags; - using namespace ProjectBrussel_UNITY_ID; - - EaShader* attachment; - if (auto ea = shader->GetEditorAttachment()) { - attachment = static_cast(ea); - } else { - attachment = new EaShader(); - attachment->shader = shader; - shader->SetEditorAttachment(attachment); - } - - auto& info = shader->GetInfo(); - auto& name = shader->GetName(); - bool isAnnoymous = name.empty(); - ShowShaderName(shader); - - if (ImGui::Button("Reload metadata", isAnnoymous)) { - shader->LoadMetadataFromFile(shader->GetDesignatedMetadataPath()); - } - ImGui::SameLine(); - if (ImGui::Button("Save metadata", isAnnoymous)) { - shader->SaveMetadataToFile(shader->GetDesignatedMetadataPath()); - } - ImGui::SameLine(); - if (ImGui::Button("Gather info")) { - shader->GatherInfoShaderIntrospection(); - } - - if (ImGui::CollapsingHeader("Inputs")) { - for (auto& input : info.inputs) { - input.ShowInfo(); - } - } - if (ImGui::CollapsingHeader("Outputs")) { - for (auto& output : info.outputs) { - output.ShowInfo(); - } - } - if (ImGui::CollapsingHeader("Uniforms")) { - for (auto& uniform : info.uniforms) { - uniform->ShowInfo(); - } - } -} - void EditorInstance::ShowInspector(IresObject* ires) { ires->ShowEditor(*this); } -- cgit v1.2.3-70-g09d2