From 4f401acdca3758da8615a73e07998f8ed7344bf8 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Fri, 8 Jul 2016 18:23:34 -0700 Subject: [PATCH] Add space switching --- Editor/ModelViewer.cpp | 11 ----------- Editor/ModelViewer.hpp | 1 - Editor/ParticleEditor.hpp | 2 ++ Editor/Space.cpp | 19 +++++++++++++++++++ Editor/Space.hpp | 2 +- 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Editor/ModelViewer.cpp b/Editor/ModelViewer.cpp index ba8bdd438..fe3b43d15 100644 --- a/Editor/ModelViewer.cpp +++ b/Editor/ModelViewer.cpp @@ -9,17 +9,6 @@ void ModelViewer::View::resized(const boo::SWindowRect& root, const boo::SWindow m_scissorRect = sub; } -void ModelViewer::View::draw(boo::IGraphicsCommandQueue* gfxQ) -{ - gfxQ->setScissor(m_scissorRect); - m_mv.m_lineRenderer->Reset(); - m_mv.m_lineRenderer->AddVertex({-0.5f, 0.f, -0.5f}, zeus::CColor::skBlue, 1.f); - m_mv.m_lineRenderer->AddVertex({-0.5f, 0.f, 0.5f}, zeus::CColor::skBlue, 1.f); - m_mv.m_lineRenderer->AddVertex({0.5f, 10.f, 0.5f}, zeus::CColor::skRed, 3.f); - m_mv.m_lineRenderer->AddVertex({0.5f, 0.f, -0.5f}, zeus::CColor::skBlue, 1.f); - m_mv.m_lineRenderer->Render(); - gfxQ->setScissor({}); -} } diff --git a/Editor/ModelViewer.hpp b/Editor/ModelViewer.hpp index ba0dfa379..b42942857 100644 --- a/Editor/ModelViewer.hpp +++ b/Editor/ModelViewer.hpp @@ -36,7 +36,6 @@ class ModelViewer : public ViewerSpace : specter::View(res, mv.m_vm.rootView()), m_mv(mv) {} void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub); - void draw(boo::IGraphicsCommandQueue *gfxQ); }; Camera m_camera; diff --git a/Editor/ParticleEditor.hpp b/Editor/ParticleEditor.hpp index 2560e1ba9..eef97bbd1 100644 --- a/Editor/ParticleEditor.hpp +++ b/Editor/ParticleEditor.hpp @@ -38,6 +38,8 @@ public: { return new EffectEditor(m_vm, parent, *this); } + + bool usesToolbar() const { return true; } }; } diff --git a/Editor/Space.cpp b/Editor/Space.cpp index 41de935d7..55ce751d5 100644 --- a/Editor/Space.cpp +++ b/Editor/Space.cpp @@ -238,4 +238,23 @@ RootSpace* Space::NewRootSpaceFromConfigStream(ViewManager& vm, ConfigReader& r) return new RootSpace(vm, r); } +void Space::SpaceMenuNode::SubNode::activated(const boo::SWindowCoord &coord) +{ + std::unique_ptr newSpace; + switch(m_data.m_cls) + { + case Class::InformationCenter: newSpace.reset(new InformationCenter(m_space.m_parent->m_vm, m_space.m_parent)); break; + case Class::EffectEditor: newSpace.reset(new EffectEditor(m_space.m_parent->m_vm, m_space.m_parent)); break; + case Class::ResourceBrowser: newSpace.reset(new ResourceBrowser(m_space.m_parent->m_vm, m_space.m_parent)); break; + case Class::ModelViewer: newSpace.reset(new ModelViewer(m_space.m_parent->m_vm, m_space.m_parent)); break; + default: break; + } + if (newSpace) + { + Space* parent = m_space.m_parent; + m_space.m_parent->exchangeSpaceSplitJoin(&m_space, std::move(newSpace)); + parent->m_vm.BuildSpaceViews(); + } +} + } diff --git a/Editor/Space.hpp b/Editor/Space.hpp index 4d4d3a44e..4117c915b 100644 --- a/Editor/Space.hpp +++ b/Editor/Space.hpp @@ -64,7 +64,7 @@ public: Space& m_space; const SubNodeData& m_data; const std::string* text() const {return &m_data.m_text;} - void activated(const boo::SWindowCoord& coord) {} + void activated(const boo::SWindowCoord& coord); SubNode(Space& space, const SubNodeData& data) : m_space(space), m_data(data) {} };