#include "SceneEditorWindow.h" #include "Widgets/SceneHierarchyWidget.h" #include "Widgets/SelectionPropertyWidget.h" #include using namespace Nuake; SceneEditorWindow::SceneEditorWindow(Ref inScene) { editorContext = EditorContext(inScene, inScene->GetName()); RegisterWidget(); RegisterWidget(); } void SceneEditorWindow::Update(float ts) { for (auto& widget : widgets) { widget->Update(ts); } } void SceneEditorWindow::Draw() { Ref scene = editorContext.GetScene(); const std::string sceneName = scene->GetName(); // This is to prevent other windows of other scene editors to dock ImGuiWindowClass windowClass; windowClass.ClassId = ImHashStr(editorContext.GetWindowClass().data()); windowClass.DockingAllowUnclassed = false; ImGui::SetNextWindowClass(&windowClass); if (ImGui::Begin(sceneName.c_str())) { ImGuiWindowClass localSceneEditorClass; localSceneEditorClass.ClassId = ImHashStr(sceneName.c_str()); std::string dockspaceId = std::string("Dockspace##" + sceneName); ImGui::DockSpace(ImGui::GetID(dockspaceId.c_str()), ImGui::GetContentRegionAvail(), ImGuiDockNodeFlags_None, &localSceneEditorClass); for (auto& widget : widgets) { widget->Draw(); } ImGui::End(); } }