Skip to content

Commit 185dca5

Browse files
committed
more functions added to dllapi
1 parent d7eb6d1 commit 185dca5

15 files changed

+120
-113
lines changed

include/SceneWidget.h

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include "ToolkitApp.h"
2323
#include "SceneGroupsWidget.h"
2424

25+
#include "toolkit_config.h"
26+
2527
class ToolkitApp;
2628
/*
2729
* A small wrapper class to render with the Qt3D Engine to be used as a QWidget
@@ -46,7 +48,7 @@ class RenderGroupCheckBox : public QCheckBox {
4648
};
4749

4850

49-
class SceneWidget : public QWidget {
51+
class TOOLKIT_DLLAPI SceneWidget : public QWidget {
5052
Q_OBJECT
5153
private:
5254
ToolkitApp* main_app;
@@ -77,22 +79,21 @@ class SceneWidget : public QWidget {
7779

7880
// adding an object will expect that all controll of memory is handed to this class meaning
7981
// that you don't have to care about freeing the memory again
80-
void addSceneObject(Qt3DCore::QEntity *scene_obj);
81-
void removeSceneObject(Qt3DCore::QEntity *scene_obj);
82-
void addSceneObjectToGroup(Qt3DCore::QEntity* scene_obj, QString group_name);
83-
void removeSceneObjectFromGroup(Qt3DCore::QEntity* scene_obj, QString group_name);
84-
85-
Qt3DRender::QCamera* getCameraObj();
86-
void setCameraLens(Qt3DRender::QCameraLens::ProjectionType projection);
82+
TOOLKIT_DLLAPI void addSceneObject(Qt3DCore::QEntity *scene_obj);
83+
TOOLKIT_DLLAPI void removeSceneObject(Qt3DCore::QEntity *scene_obj);
84+
TOOLKIT_DLLAPI void addSceneObjectToGroup(Qt3DCore::QEntity* scene_obj, QString group_name);
85+
TOOLKIT_DLLAPI void removeSceneObjectFromGroup(Qt3DCore::QEntity* scene_obj, QString group_name);
8786

88-
Qt3DCore::QEntity* getSceneRoot() { return scene_root; }
89-
QColor getDefaultClearColor() { return default_clear_color; }
87+
TOOLKIT_DLLAPI Qt3DRender::QCamera* getCameraObj();
88+
TOOLKIT_DLLAPI void setCameraLens(Qt3DRender::QCameraLens::ProjectionType projection);
9089

91-
int getWidth() { return width; }
92-
int getHeight() { return height; }
90+
TOOLKIT_DLLAPI Qt3DCore::QEntity* getSceneRoot() { return scene_root; }
91+
TOOLKIT_DLLAPI QColor getDefaultClearColor() { return default_clear_color; }
9392

94-
Qt3DRender::QRenderCaptureReply* requestFrameCapture();
93+
TOOLKIT_DLLAPI int getWidth() { return width; }
94+
TOOLKIT_DLLAPI int getHeight() { return height; }
9595

96+
TOOLKIT_DLLAPI Qt3DRender::QRenderCaptureReply* requestFrameCapture();
9697

9798
protected:
9899
void resizeEvent(QResizeEvent *event);

include/Timeline.h

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33

44
#include <QWidget>
55
#include "ui_Timeline.h"
6+
#include "toolkit_config.h"
67

7-
class ToolkitTimeline : public QWidget, public Ui::Timeline {
8+
class TOOLKIT_DLLAPI ToolkitTimeline : public QWidget, public Ui::Timeline {
89
Q_OBJECT
910
private:
1011
float speed_factor;
@@ -17,23 +18,23 @@ class ToolkitTimeline : public QWidget, public Ui::Timeline {
1718
public:
1819
ToolkitTimeline(QWidget* parent);
1920

20-
void setMaxTime(float max_time);
21-
float getMaxTime() { return max_time; }
22-
float getCurrentTime() { return current_time; }
23-
void setCurrentTime(float current_time, bool stop_playing=false);
24-
void reset();
21+
TOOLKIT_DLLAPI void setMaxTime(float max_time);
22+
TOOLKIT_DLLAPI float getMaxTime() { return max_time; }
23+
TOOLKIT_DLLAPI float getCurrentTime() { return current_time; }
24+
TOOLKIT_DLLAPI void setCurrentTime(float current_time, bool stop_playing=false);
25+
TOOLKIT_DLLAPI void reset();
2526

2627
public slots:
27-
void speedChanged(double speed);
28-
void togglePlaying();
28+
TOOLKIT_DLLAPI void speedChanged(double speed);
29+
TOOLKIT_DLLAPI void togglePlaying();
2930

30-
void sliderMoved(int pos);
31-
void sliderPressed();
32-
void sliderReleased();
31+
TOOLKIT_DLLAPI void sliderMoved(int pos);
32+
TOOLKIT_DLLAPI void sliderPressed();
33+
TOOLKIT_DLLAPI void sliderReleased();
3334

34-
void tick(float dt);
35+
TOOLKIT_DLLAPI void tick(float dt);
3536

36-
void reset_timeline();
37+
TOOLKIT_DLLAPI void reset_timeline();
3738

3839
signals:
3940
//signal always sends absolute time so that all listeners can update accordingly

include/ToolkitApp.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424

2525
class SceneWidget;
2626

27-
TOOLKIT_DLLAPI
28-
class ToolkitApp : public QMainWindow
27+
class TOOLKIT_DLLAPI ToolkitApp : public QMainWindow
2928
{
3029
Q_OBJECT
3130
private:
@@ -65,7 +64,7 @@ class ToolkitApp : public QMainWindow
6564
TOOLKIT_DLLAPI void deleteMenu(QMenu* menu);
6665

6766
TOOLKIT_DLLAPI void addCmdOption(QCommandLineOption &option, std::function<void(QCommandLineParser&)>);
68-
void parseCmd(QApplication& app);
67+
TOOLKIT_DLLAPI void parseCmd(QApplication& app);
6968

7069
TOOLKIT_DLLAPI void showWarningDialog(QString warning_msg);
7170

include/ToolkitSettings.h

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <QIcon>
1111

1212
#include "ui_SettingsEditor.h"
13+
#include "toolkit_config.h"
1314

1415
class ToolkitSettings;
1516

@@ -39,23 +40,23 @@ class SettingsEditor : public QWidget, public Ui::SettingsEditor {
3940
};
4041

4142

42-
class ToolkitSettings : public QObject{
43+
class TOOLKIT_DLLAPI ToolkitSettings : public QObject{
4344
Q_OBJECT
4445
public:
4546
ToolkitSettings();
4647

47-
QVariant value(const QString &key);
48-
QMetaType::Type type(const QString &key);
49-
void setValue(const QString &key, const QVariant &value);
50-
void setType(const QString &key, const QVariant infer_from_value);
48+
TOOLKIT_DLLAPI QVariant value(const QString &key);
49+
TOOLKIT_DLLAPI QMetaType::Type type(const QString &key);
50+
TOOLKIT_DLLAPI void setValue(const QString &key, const QVariant &value);
51+
TOOLKIT_DLLAPI void setType(const QString &key, const QVariant infer_from_value);
5152

52-
QString group() { return settings.group(); }
53+
TOOLKIT_DLLAPI QString group() { return settings.group(); }
5354

54-
void beginGroup(QString group);
55-
void endGroup();
55+
TOOLKIT_DLLAPI void beginGroup(QString group);
56+
TOOLKIT_DLLAPI void endGroup();
5657

57-
QStringList childKeys() { return settings.childKeys(); }
58-
QStringList childGroups() { return settings.childGroups(); }
58+
TOOLKIT_DLLAPI QStringList childKeys() { return settings.childKeys(); }
59+
TOOLKIT_DLLAPI QStringList childGroups() { return settings.childGroups(); }
5960

6061
private:
6162
QSettings settings;
@@ -66,7 +67,7 @@ class ToolkitSettings : public QObject{
6667
void settings_changed();
6768

6869
public slots:
69-
void editSettings();
70+
TOOLKIT_DLLAPI void editSettings();
7071
};
7172

7273
#endif

include/rbdl_wrapper.h

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include <Qt3DCore/QEntity>
1313
#include <Qt3DCore/QTransform>
1414

15+
#include "toolkit_config.h"
16+
1517
class RBDLModelWrapper;
1618

1719

@@ -54,7 +56,7 @@ struct SegmentVisualInfo {
5456

5557
/* This class provides a wrapper around rbdl models, in order to visualize them with Qt3D
5658
*/
57-
class RBDLModelWrapper : public QObject {
59+
class TOOLKIT_DLLAPI RBDLModelWrapper : public QObject {
5860
Q_OBJECT
5961
protected:
6062
QString model_file;
@@ -74,32 +76,32 @@ class RBDLModelWrapper : public QObject {
7476
void clear();
7577
virtual void load(QString model_file) = 0;
7678
public:
77-
static RBDLModelWrapper* loadFromFile(QString model_file);
79+
TOOLKIT_DLLAPI static RBDLModelWrapper* loadFromFile(QString model_file);
7880

7981

8082
RigidBodyDynamics::Model* rbdl_model;
8183

8284
RBDLModelWrapper();
83-
void build3DEntity(ModelInfo&, std::vector<SegmentVisualInfo>&);
85+
TOOLKIT_DLLAPI void build3DEntity(ModelInfo&, std::vector<SegmentVisualInfo>&);
8486

85-
QString getFileName() { return QFileInfo(model_file).baseName(); }
86-
std::string getModelType() { return model_type; }
87-
QString getModelFile();
88-
int getModelDof();
89-
Qt3DCore::QEntity* getRenderObj() { return model_root; }
90-
Qt3DCore::QEntity* getSegmentEntity(std::string segment_name, bool create=false);
87+
TOOLKIT_DLLAPI QString getFileName() { return QFileInfo(model_file).baseName(); }
88+
TOOLKIT_DLLAPI std::string getModelType() { return model_type; }
89+
TOOLKIT_DLLAPI QString getModelFile();
90+
TOOLKIT_DLLAPI int getModelDof();
91+
TOOLKIT_DLLAPI Qt3DCore::QEntity* getRenderObj() { return model_root; }
92+
TOOLKIT_DLLAPI Qt3DCore::QEntity* getSegmentEntity(std::string segment_name, bool create=false);
9193

92-
void addStaticVisual(std::string segment_name, Qt3DCore::QEntity *visual);
93-
void updateKinematics(RigidBodyDynamics::Math::VectorNd Q);
94+
TOOLKIT_DLLAPI void addStaticVisual(std::string segment_name, Qt3DCore::QEntity *visual);
95+
TOOLKIT_DLLAPI void updateKinematics(RigidBodyDynamics::Math::VectorNd Q);
9496

95-
void reload();
97+
TOOLKIT_DLLAPI void reload();
9698

9799
//takes ownership of extension -> only delete via model not where it was created
98-
void addExtension(WrapperExtension* extension);
100+
TOOLKIT_DLLAPI void addExtension(WrapperExtension* extension);
99101
//void deleteExtension(std::string name);
100-
bool hasExtension(std::string name);
101-
const std::vector<std::string>& loadedExtensions() { return extension_names; }
102-
WrapperExtension* getExtension(std::string name);
102+
TOOLKIT_DLLAPI bool hasExtension(std::string name);
103+
TOOLKIT_DLLAPI const std::vector<std::string>& loadedExtensions() { return extension_names; }
104+
TOOLKIT_DLLAPI WrapperExtension* getExtension(std::string name);
103105

104106
public slots:
105107
void model_update(float current_time);

include/render_util.h

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,25 @@
33

44
#include <Qt3DCore/QEntity>
55
#include <QColor>
6+
#include "toolkit_config.h"
67

78
#include <rbdl/addons/luamodel/luatables.h>
89

9-
Qt3DCore::QEntity* createGridFloor(float lxy_border,
10-
float r_xyborder,
11-
int count,
12-
QColor line_color=QColor(QRgb(0xffffff)));
10+
TOOLKIT_DLLAPI Qt3DCore::QEntity* createGridFloor(float lxy_border,
11+
float r_xyborder,
12+
int count,
13+
QColor line_color=QColor(QRgb(0xffffff)));
1314

14-
Qt3DCore::QEntity* createWire(const QVector3D& wire,
15-
const QColor& line_color,
16-
float line_width = 1.,
17-
Qt3DCore::QEntity* parent=nullptr);
15+
TOOLKIT_DLLAPI Qt3DCore::QEntity* createWire(const QVector3D& wire,
16+
const QColor& line_color,
17+
float line_width = 1.,
18+
Qt3DCore::QEntity* parent=nullptr);
1819

19-
Qt3DCore::QEntity* createMeshEntity(const QString& mesh_file,
20-
const QColor& mesh_color,
21-
const QVector3D& mesh_translation,
22-
const QQuaternion& mesh_rotation,
23-
Qt3DCore::QEntity* parent=nullptr);
20+
TOOLKIT_DLLAPI Qt3DCore::QEntity* createMeshEntity(const QString& mesh_file,
21+
const QColor& mesh_color,
22+
const QVector3D& mesh_translation,
23+
const QQuaternion& mesh_rotation,
24+
Qt3DCore::QEntity* parent=nullptr);
2425

2526
#endif
2627

include/toolkit_errors.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
#define TOOLKIT_ERRORS_H_INCLUDED
33

44
#include <rbdl/rbdl_errors.h>
5+
#include <toolkit_config.h>
56

6-
class RBDLToolkitError : public RigidBodyDynamics::Errors::RBDLError {
7+
class TOOLKIT_DLLAPI RBDLToolkitError : public RigidBodyDynamics::Errors::RBDLError {
78
public:
89
RBDLToolkitError(std::string text);
910
};
1011

11-
class RBDLFileNotFoundError: public RBDLToolkitError {
12+
class TOOLKIT_DLLAPI RBDLFileNotFoundError: public RBDLToolkitError {
1213
public:
1314
RBDLFileNotFoundError(std::string text);
1415
};

include/util.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99
#include <string>
1010

1111
#include <rbdl/rbdl_math.h>
12+
#include "toolkit_config.h"
1213

1314
// returs an empty file on failure
14-
QString findFile(QString file, bool absolute=false);
15-
QString findFile(std::string file, bool absolute=false);
15+
TOOLKIT_DLLAPI QString findFile(QString file, bool absolute=false);
16+
TOOLKIT_DLLAPI QString findFile(std::string file, bool absolute=false);
1617

17-
QString findPlugin(QString plugin);
18-
QStringList findAllPlugins();
18+
TOOLKIT_DLLAPI QString findPlugin(QString plugin);
19+
TOOLKIT_DLLAPI QStringList findAllPlugins();
1920

20-
QVector3D to_qt_vector(RigidBodyDynamics::Math::Vector3d&);
21+
TOOLKIT_DLLAPI QVector3D to_qt_vector(RigidBodyDynamics::Math::Vector3d&);
2122

2223
#endif

src/SceneWidget.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void SceneWidget::resizeEvent(QResizeEvent *event) {
8787
setCameraLens(camera->lens()->projectionType());
8888
}
8989

90-
void SceneWidget::setCameraLens(QCameraLens::ProjectionType projection) {
90+
TOOLKIT_DLLAPI void SceneWidget::setCameraLens(QCameraLens::ProjectionType projection) {
9191
//std::cout << width << " " << height << std::endl;
9292
camera->lens()->setProjectionType(projection);
9393
if (projection == QCameraLens::PerspectiveProjection) {
@@ -112,7 +112,7 @@ void SceneWidget::setCameraLens(QCameraLens::ProjectionType projection) {
112112
}
113113
}
114114

115-
void SceneWidget::addSceneObject(Qt3DCore::QEntity *scene_obj) {
115+
TOOLKIT_DLLAPI void SceneWidget::addSceneObject(Qt3DCore::QEntity *scene_obj) {
116116
//qDebug() << scene_obj->dynamicPropertyNames();
117117
scene_obj->setParent(scene_root);
118118

@@ -133,7 +133,7 @@ void SceneWidget::addSceneObject(Qt3DCore::QEntity *scene_obj) {
133133
}
134134
}
135135

136-
void SceneWidget::addSceneObjectToGroup(QEntity* scene_obj, QString group_name) {
136+
TOOLKIT_DLLAPI void SceneWidget::addSceneObjectToGroup(QEntity* scene_obj, QString group_name) {
137137
bool found = false;
138138
for(auto it=scene_obj_grouping[group_name].begin(); it<scene_obj_grouping[group_name].end(); it++) {
139139
if (*it == scene_obj) {
@@ -162,7 +162,7 @@ void SceneWidget::addSceneObjectToGroup(QEntity* scene_obj, QString group_name)
162162
}
163163
}
164164

165-
void SceneWidget::removeSceneObjectFromGroup(QEntity* scene_obj, QString group_name) {
165+
TOOLKIT_DLLAPI void SceneWidget::removeSceneObjectFromGroup(QEntity* scene_obj, QString group_name) {
166166
for(auto it=scene_obj_grouping[group_name].begin(); it<scene_obj_grouping[group_name].end(); it++) {
167167
if (*it == scene_obj) {
168168
scene_obj_grouping[group_name].erase(it);
@@ -171,7 +171,7 @@ void SceneWidget::removeSceneObjectFromGroup(QEntity* scene_obj, QString group_n
171171
}
172172
}
173173

174-
void SceneWidget::removeSceneObject(Qt3DCore::QEntity *scene_obj) {
174+
TOOLKIT_DLLAPI void SceneWidget::removeSceneObject(Qt3DCore::QEntity *scene_obj) {
175175
scene_obj->setParent((Qt3DCore::QEntity*) nullptr);
176176

177177
QVariant obj_grouping = scene_obj->property("Scene.ObjGroup");
@@ -204,15 +204,15 @@ void SceneWidget::frame_action_repeater(float dt) {
204204
emit frame_sync_signal(dt);
205205
}
206206

207-
QCamera* SceneWidget::getCameraObj() {
207+
TOOLKIT_DLLAPI QCamera* SceneWidget::getCameraObj() {
208208
return camera;
209209
}
210210

211211
void SceneWidget::update_orthographic_scale() {
212212
setCameraLens(camera->lens()->projectionType());
213213
}
214214

215-
void SceneWidget::setClearColor(QColor color){
215+
TOOLKIT_DLLAPI void SceneWidget::setClearColor(QColor color){
216216
qt3d_view->defaultFrameGraph()->setClearColor(color);
217217
}
218218

@@ -237,7 +237,7 @@ void SceneWidget::setOffscreenRender(QObject* surface) {
237237
}
238238
}
239239

240-
Qt3DRender::QRenderCaptureReply* SceneWidget::requestFrameCapture() {
240+
TOOLKIT_DLLAPI Qt3DRender::QRenderCaptureReply* SceneWidget::requestFrameCapture() {
241241
if (render_capture == nullptr) {
242242
render_capture = new QRenderCapture();
243243
qt3d_view->activeFrameGraph()->setParent(render_capture);

0 commit comments

Comments
 (0)