Radium Engine  1.5.0
SimpleWindow.cpp
1 #include <Gui/RadiumWindow/SimpleWindow.hpp>
2 
3 #include <Engine/Rendering/ForwardRenderer.hpp>
4 #include <Gui/SelectionManager/SelectionManager.hpp>
5 #include <Gui/TreeModel/EntityTreeModel.hpp>
6 #include <Gui/Viewer/CameraManipulator.hpp>
7 #include <Gui/Viewer/Viewer.hpp>
8 
9 namespace Ra {
10 using namespace Gui;
11 using namespace Engine;
12 using namespace Engine::Rendering;
13 
14 namespace Gui {
15 
16 SimpleWindow::SimpleWindow( uint w, uint h, QWidget* parent ) : MainWindowInterface( parent ) {
17  if ( objectName().isEmpty() ) setObjectName( QString::fromUtf8( "RadiumSimpleWindow" ) );
18  resize( w, h );
19 
20  // Initialize the minimum tools for a Radium-Guibased Application
21  m_viewer = std::make_unique<Viewer>();
22  m_viewer->setObjectName( QStringLiteral( "m_viewer" ) );
23 
24  // Initialize the scene interactive representation
25  m_sceneModel =
26  std::make_unique<Ra::Gui::ItemModel>( Ra::Engine::RadiumEngine::getInstance(), this );
27  m_selectionManager = std::make_unique<Ra::Gui::SelectionManager>( m_sceneModel.get(), this );
28 
29  // initialize Gui for the application
30  auto viewerWidget = QWidget::createWindowContainer( m_viewer.get() );
31  viewerWidget->setAutoFillBackground( false );
32  setCentralWidget( viewerWidget );
33  setWindowTitle( QString( "Radium player" ) );
34 
35  createConnections();
36 }
37 
38 SimpleWindow::~SimpleWindow() = default;
39 
41  return m_viewer.get();
42 }
43 
44 Ra::Gui::SelectionManager* SimpleWindow::getSelectionManager() {
45  return m_selectionManager.get();
46 }
47 
49  return nullptr;
50 }
51 
53  // no ui in the simple window, so, nothing to do
54 }
55 
57 
58 void SimpleWindow::addRenderer( const std::string&,
59  std::shared_ptr<Ra::Engine::Rendering::Renderer> e ) {
60  m_viewer->addRenderer( e );
61 }
62 
64  m_selectionManager->clear();
65  if ( m_viewer->prepareDisplay() ) { emit frameUpdate(); }
66 }
67 
69  m_viewer.reset( nullptr );
70 }
71 
72 void SimpleWindow::createConnections() {}
73 
74 void SimpleWindow::displayHelpDialog() {
75  m_viewer->displayHelpDialog();
76 }
77 
78 } // namespace Gui
79 } // namespace Ra
void updateUi(Ra::Plugins::RadiumPluginInterface *plugin) override
Update the ui from the plugins loaded.
void frameUpdate()
Emitted when frame must be updated.
void onFrameComplete() override
void addRenderer(const std::string &name, std::shared_ptr< Ra::Engine::Rendering::Renderer > e) override
Add render in the application: UI, viewer - this method does not associate a control panel.
Ra::Gui::Timeline * getTimeline() override
Access the timeline.
void prepareDisplay() override
Ra::Gui::Viewer * getViewer() override
Access the viewer, i.e. the rendering widget.
SimpleWindow(uint w=800, uint h=640, QWidget *parent=nullptr)
Ra::Gui::SelectionManager * getSelectionManager() override
Access the selection manager.
void cleanup() override
Cleanup resources.
The Timeline class provides display and management of time, as well as keyframes.
Definition: Timeline.hpp:38
Interface class for Radiums plugins.
Definition: Cage.cpp:3