Radium Engine  1.5.20
Loading...
Searching...
No Matches
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
9namespace Ra {
10using namespace Gui;
11using namespace Engine;
12using namespace Engine::Rendering;
13
14namespace Gui {
15
16SimpleWindow::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
38SimpleWindow::~SimpleWindow() = default;
39
41 return m_viewer.get();
42}
43
44Ra::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
62
64 m_selectionManager->clear();
65 if ( m_viewer->prepareDisplay() ) { emit frameUpdate(); }
66}
67
69 m_viewer.reset( nullptr );
70}
71
72void SimpleWindow::createConnections() {}
73
74void 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
virtual bool prepareDisplay()
Definition Viewer.cpp:827
int addRenderer(const std::shared_ptr< Engine::Rendering::Renderer > &e)
Definition Viewer.cpp:188
Interface class for Radiums plugins.
T get(T... args)
hepler function to manage enum as underlying types in VariableSet
Definition Cage.cpp:3
T reset(T... args)