diff options
author | rtk0c <[email protected]> | 2022-04-19 12:36:02 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-04-19 12:36:02 -0700 |
commit | 3290bb2b2dec223f0312c6d5fc3edf71d5d6e46f (patch) | |
tree | 1293b330f07ef410b1aea22e338c99c5ca07356b /source/EditorCore.cpp | |
parent | 07e8754e4d799e44678b595177e79e6eaa621268 (diff) |
Changeset: 12 Add hardcoded dependencies for IresManager, migrate Shader to Ires
Diffstat (limited to 'source/EditorCore.cpp')
-rw-r--r-- | source/EditorCore.cpp | 99 |
1 files changed, 0 insertions, 99 deletions
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 <annoymous at %p>", (void*)shader); - } else { - ImGui::Text("Shader: %s", name.c_str()); - } - } else { - ImGui::TextUnformatted("Shader: <null>"); - } -} } // namespace ProjectBrussel_UNITY_ID EditorInstance::EditorInstance(App* app, GameWorld* world) @@ -297,10 +249,6 @@ void EditorInstance::Show() { ShowInspector(static_cast<GameObject*>(mEdInspector.selectedItPtr)); } break; - case EditorInspector::ITT_Shader: { - ShowInspector(static_cast<Shader*>(mEdInspector.selectedItPtr)); - } break; - case EditorInspector::ITT_Ires: { auto ires = static_cast<IresObject*>(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<EaShader*>(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); } |