Skip to content

Commit

Permalink
only classes need dll export interface?
Browse files Browse the repository at this point in the history
  • Loading branch information
ju6ge committed Jul 9, 2021
1 parent 9e232c4 commit 2b633eb
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 110 deletions.
22 changes: 11 additions & 11 deletions include/SceneWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,21 @@ class TOOLKIT_DLLAPI SceneWidget : public QWidget {

// adding an object will expect that all controll of memory is handed to this class meaning
// that you don't have to care about freeing the memory again
TOOLKIT_DLLAPI void addSceneObject(Qt3DCore::QEntity *scene_obj);
TOOLKIT_DLLAPI void removeSceneObject(Qt3DCore::QEntity *scene_obj);
TOOLKIT_DLLAPI void addSceneObjectToGroup(Qt3DCore::QEntity* scene_obj, QString group_name);
TOOLKIT_DLLAPI void removeSceneObjectFromGroup(Qt3DCore::QEntity* scene_obj, QString group_name);
void addSceneObject(Qt3DCore::QEntity *scene_obj);
void removeSceneObject(Qt3DCore::QEntity *scene_obj);
void addSceneObjectToGroup(Qt3DCore::QEntity* scene_obj, QString group_name);
void removeSceneObjectFromGroup(Qt3DCore::QEntity* scene_obj, QString group_name);

TOOLKIT_DLLAPI Qt3DRender::QCamera* getCameraObj();
TOOLKIT_DLLAPI void setCameraLens(Qt3DRender::QCameraLens::ProjectionType projection);
Qt3DRender::QCamera* getCameraObj();
void setCameraLens(Qt3DRender::QCameraLens::ProjectionType projection);

TOOLKIT_DLLAPI Qt3DCore::QEntity* getSceneRoot() { return scene_root; }
TOOLKIT_DLLAPI QColor getDefaultClearColor() { return default_clear_color; }
Qt3DCore::QEntity* getSceneRoot() { return scene_root; }
QColor getDefaultClearColor() { return default_clear_color; }

TOOLKIT_DLLAPI int getWidth() { return width; }
TOOLKIT_DLLAPI int getHeight() { return height; }
int getWidth() { return width; }
int getHeight() { return height; }

TOOLKIT_DLLAPI Qt3DRender::QRenderCaptureReply* requestFrameCapture();
Qt3DRender::QRenderCaptureReply* requestFrameCapture();

protected:
void resizeEvent(QResizeEvent *event);
Expand Down
24 changes: 12 additions & 12 deletions include/Timeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ class TOOLKIT_DLLAPI ToolkitTimeline : public QWidget, public Ui::Timeline {
public:
ToolkitTimeline(QWidget* parent);

TOOLKIT_DLLAPI void setMaxTime(float max_time);
TOOLKIT_DLLAPI float getMaxTime() { return max_time; }
TOOLKIT_DLLAPI float getCurrentTime() { return current_time; }
TOOLKIT_DLLAPI void setCurrentTime(float current_time, bool stop_playing=false);
TOOLKIT_DLLAPI void reset();
void setMaxTime(float max_time);
float getMaxTime() { return max_time; }
float getCurrentTime() { return current_time; }
void setCurrentTime(float current_time, bool stop_playing=false);
void reset();

public slots:
TOOLKIT_DLLAPI void speedChanged(double speed);
TOOLKIT_DLLAPI void togglePlaying();
void speedChanged(double speed);
void togglePlaying();

TOOLKIT_DLLAPI void sliderMoved(int pos);
TOOLKIT_DLLAPI void sliderPressed();
TOOLKIT_DLLAPI void sliderReleased();
void sliderMoved(int pos);
void sliderPressed();
void sliderReleased();

TOOLKIT_DLLAPI void tick(float dt);
void tick(float dt);

TOOLKIT_DLLAPI void reset_timeline();
void reset_timeline();

signals:
//signal always sends absolute time so that all listeners can update accordingly
Expand Down
36 changes: 18 additions & 18 deletions include/ToolkitApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,36 +50,36 @@ class TOOLKIT_DLLAPI ToolkitApp : public QMainWindow
public:
ToolkitSettings toolkit_settings;

TOOLKIT_DLLAPI ToolkitApp(QWidget *parent = 0);
TOOLKIT_DLLAPI std::vector<RBDLModelWrapper*>* getLoadedModels();
ToolkitApp(QWidget *parent = 0);
std::vector<RBDLModelWrapper*>* getLoadedModels();

TOOLKIT_DLLAPI RBDLModelWrapper* selectModel(ModelFilter filter);
RBDLModelWrapper* selectModel(ModelFilter filter);

TOOLKIT_DLLAPI void addView(QString name, QWidget *view_widget, Qt::DockWidgetArea area=Qt::RightDockWidgetArea, bool show_tilte = true);
TOOLKIT_DLLAPI void deleteView(QString name);
void addView(QString name, QWidget *view_widget, Qt::DockWidgetArea area=Qt::RightDockWidgetArea, bool show_tilte = true);
void deleteView(QString name);

TOOLKIT_DLLAPI void addFileAction(QAction* file_action);
void addFileAction(QAction* file_action);

TOOLKIT_DLLAPI QMenu* getMenu(std::string menu_name);
TOOLKIT_DLLAPI void deleteMenu(QMenu* menu);
QMenu* getMenu(std::string menu_name);
void deleteMenu(QMenu* menu);

TOOLKIT_DLLAPI void addCmdOption(QCommandLineOption &option, std::function<void(QCommandLineParser&)>);
TOOLKIT_DLLAPI void parseCmd(QApplication& app);
void addCmdOption(QCommandLineOption &option, std::function<void(QCommandLineParser&)>);
void parseCmd(QApplication& app);

TOOLKIT_DLLAPI void showWarningDialog(QString warning_msg);
void showWarningDialog(QString warning_msg);

TOOLKIT_DLLAPI static void showExceptionDialog(std::exception& e);
static void showExceptionDialog(std::exception& e);

TOOLKIT_DLLAPI ToolkitTimeline* getToolkitTimeline() { return timeline; }
TOOLKIT_DLLAPI SceneWidget* getSceneObj() { return main_display; }
ToolkitTimeline* getToolkitTimeline() { return timeline; }
SceneWidget* getSceneObj() { return main_display; }

public slots:
TOOLKIT_DLLAPI void action_reload_files();
TOOLKIT_DLLAPI void action_load_model();
void action_reload_files();
void action_load_model();

TOOLKIT_DLLAPI void model_visual_update(Qt3DCore::QEntity* visual);
void model_visual_update(Qt3DCore::QEntity* visual);

TOOLKIT_DLLAPI void loadModel(const QString &model_file);
void loadModel(const QString &model_file);

signals:
void reload();
Expand Down
20 changes: 10 additions & 10 deletions include/ToolkitSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,18 @@ class TOOLKIT_DLLAPI ToolkitSettings : public QObject{
public:
ToolkitSettings();

TOOLKIT_DLLAPI QVariant value(const QString &key);
TOOLKIT_DLLAPI QMetaType::Type type(const QString &key);
TOOLKIT_DLLAPI void setValue(const QString &key, const QVariant &value);
TOOLKIT_DLLAPI void setType(const QString &key, const QVariant infer_from_value);
QVariant value(const QString &key);
QMetaType::Type type(const QString &key);
void setValue(const QString &key, const QVariant &value);
void setType(const QString &key, const QVariant infer_from_value);

TOOLKIT_DLLAPI QString group() { return settings.group(); }
QString group() { return settings.group(); }

TOOLKIT_DLLAPI void beginGroup(QString group);
TOOLKIT_DLLAPI void endGroup();
void beginGroup(QString group);
void endGroup();

TOOLKIT_DLLAPI QStringList childKeys() { return settings.childKeys(); }
TOOLKIT_DLLAPI QStringList childGroups() { return settings.childGroups(); }
QStringList childKeys() { return settings.childKeys(); }
QStringList childGroups() { return settings.childGroups(); }

private:
QSettings settings;
Expand All @@ -67,7 +67,7 @@ class TOOLKIT_DLLAPI ToolkitSettings : public QObject{
void settings_changed();

public slots:
TOOLKIT_DLLAPI void editSettings();
void editSettings();
};

#endif
Expand Down
30 changes: 15 additions & 15 deletions include/rbdl_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,32 +76,32 @@ class TOOLKIT_DLLAPI RBDLModelWrapper : public QObject {
void clear();
virtual void load(QString model_file) = 0;
public:
TOOLKIT_DLLAPI static RBDLModelWrapper* loadFromFile(QString model_file);
static RBDLModelWrapper* loadFromFile(QString model_file);


RigidBodyDynamics::Model* rbdl_model;

RBDLModelWrapper();
TOOLKIT_DLLAPI void build3DEntity(ModelInfo&, std::vector<SegmentVisualInfo>&);
void build3DEntity(ModelInfo&, std::vector<SegmentVisualInfo>&);

TOOLKIT_DLLAPI QString getFileName() { return QFileInfo(model_file).baseName(); }
TOOLKIT_DLLAPI std::string getModelType() { return model_type; }
TOOLKIT_DLLAPI QString getModelFile();
TOOLKIT_DLLAPI int getModelDof();
TOOLKIT_DLLAPI Qt3DCore::QEntity* getRenderObj() { return model_root; }
TOOLKIT_DLLAPI Qt3DCore::QEntity* getSegmentEntity(std::string segment_name, bool create=false);
QString getFileName() { return QFileInfo(model_file).baseName(); }
std::string getModelType() { return model_type; }
QString getModelFile();
int getModelDof();
Qt3DCore::QEntity* getRenderObj() { return model_root; }
Qt3DCore::QEntity* getSegmentEntity(std::string segment_name, bool create=false);

TOOLKIT_DLLAPI void addStaticVisual(std::string segment_name, Qt3DCore::QEntity *visual);
TOOLKIT_DLLAPI void updateKinematics(RigidBodyDynamics::Math::VectorNd Q);
void addStaticVisual(std::string segment_name, Qt3DCore::QEntity *visual);
void updateKinematics(RigidBodyDynamics::Math::VectorNd Q);

TOOLKIT_DLLAPI void reload();
void reload();

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

public slots:
void model_update(float current_time);
Expand Down
16 changes: 8 additions & 8 deletions src/SceneWidget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void SceneWidget::resizeEvent(QResizeEvent *event) {
setCameraLens(camera->lens()->projectionType());
}

TOOLKIT_DLLAPI void SceneWidget::setCameraLens(QCameraLens::ProjectionType projection) {
void SceneWidget::setCameraLens(QCameraLens::ProjectionType projection) {
//std::cout << width << " " << height << std::endl;
camera->lens()->setProjectionType(projection);
if (projection == QCameraLens::PerspectiveProjection) {
Expand All @@ -112,7 +112,7 @@ TOOLKIT_DLLAPI void SceneWidget::setCameraLens(QCameraLens::ProjectionType proje
}
}

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

Expand All @@ -133,7 +133,7 @@ TOOLKIT_DLLAPI void SceneWidget::addSceneObject(Qt3DCore::QEntity *scene_obj) {
}
}

TOOLKIT_DLLAPI void SceneWidget::addSceneObjectToGroup(QEntity* scene_obj, QString group_name) {
void SceneWidget::addSceneObjectToGroup(QEntity* scene_obj, QString group_name) {
bool found = false;
for(auto it=scene_obj_grouping[group_name].begin(); it<scene_obj_grouping[group_name].end(); it++) {
if (*it == scene_obj) {
Expand Down Expand Up @@ -162,7 +162,7 @@ TOOLKIT_DLLAPI void SceneWidget::addSceneObjectToGroup(QEntity* scene_obj, QStri
}
}

TOOLKIT_DLLAPI void SceneWidget::removeSceneObjectFromGroup(QEntity* scene_obj, QString group_name) {
void SceneWidget::removeSceneObjectFromGroup(QEntity* scene_obj, QString group_name) {
for(auto it=scene_obj_grouping[group_name].begin(); it<scene_obj_grouping[group_name].end(); it++) {
if (*it == scene_obj) {
scene_obj_grouping[group_name].erase(it);
Expand All @@ -171,7 +171,7 @@ TOOLKIT_DLLAPI void SceneWidget::removeSceneObjectFromGroup(QEntity* scene_obj,
}
}

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

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

TOOLKIT_DLLAPI QCamera* SceneWidget::getCameraObj() {
QCamera* SceneWidget::getCameraObj() {
return camera;
}

void SceneWidget::update_orthographic_scale() {
setCameraLens(camera->lens()->projectionType());
}

TOOLKIT_DLLAPI void SceneWidget::setClearColor(QColor color){
void SceneWidget::setClearColor(QColor color){
qt3d_view->defaultFrameGraph()->setClearColor(color);
}

Expand All @@ -237,7 +237,7 @@ void SceneWidget::setOffscreenRender(QObject* surface) {
}
}

TOOLKIT_DLLAPI Qt3DRender::QRenderCaptureReply* SceneWidget::requestFrameCapture() {
Qt3DRender::QRenderCaptureReply* SceneWidget::requestFrameCapture() {
if (render_capture == nullptr) {
render_capture = new QRenderCapture();
qt3d_view->activeFrameGraph()->setParent(render_capture);
Expand Down
20 changes: 10 additions & 10 deletions src/Timeline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,42 +28,42 @@ ToolkitTimeline::ToolkitTimeline(QWidget *parent) : speed_factor(1.0),
connect(TimelineVertSlider, SIGNAL(sliderReleased()), this, SLOT(sliderReleased()));
}

TOOLKIT_DLLAPI void ToolkitTimeline::reset() {
void ToolkitTimeline::reset() {
max_time = 0.;
current_time = 0.;
playing = false;
speed_factor = 1.0;
}

TOOLKIT_DLLAPI void ToolkitTimeline::setMaxTime(float max) {
void ToolkitTimeline::setMaxTime(float max) {
float old_max = max_time;
max_time = std::max(max, max_time);

if (old_max != max_time)
emit maxTimeChanged(max_time);
}

TOOLKIT_DLLAPI void ToolkitTimeline::togglePlaying() {
void ToolkitTimeline::togglePlaying() {
if (max_time > 0.) {
playing = !playing;
was_playing = playing;
}
}

TOOLKIT_DLLAPI void ToolkitTimeline::sliderPressed() {
void ToolkitTimeline::sliderPressed() {
playing = false;
}

TOOLKIT_DLLAPI void ToolkitTimeline::sliderReleased() {
void ToolkitTimeline::sliderReleased() {
playing = was_playing;
}

TOOLKIT_DLLAPI void ToolkitTimeline::sliderMoved(int pos) {
void ToolkitTimeline::sliderMoved(int pos) {
float p = (float)pos / (float)slider_granularity;
setCurrentTime( max_time * p);
}

TOOLKIT_DLLAPI void ToolkitTimeline::setCurrentTime(float current, bool stop_playing) {
void ToolkitTimeline::setCurrentTime(float current, bool stop_playing) {
if (stop_playing) {
playing = false;
}
Expand All @@ -81,7 +81,7 @@ TOOLKIT_DLLAPI void ToolkitTimeline::setCurrentTime(float current, bool stop_pla
emit timeChanged(current_time);
}

TOOLKIT_DLLAPI void ToolkitTimeline::tick(float dt) {
void ToolkitTimeline::tick(float dt) {
if (max_time <= 0. || !playing ) {
//do not do anything if max time is smaller or equal to zero
//or if animation is halted
Expand All @@ -92,11 +92,11 @@ TOOLKIT_DLLAPI void ToolkitTimeline::tick(float dt) {
setCurrentTime(current_time);
}

TOOLKIT_DLLAPI void ToolkitTimeline::speedChanged(double speed) {
void ToolkitTimeline::speedChanged(double speed) {
speed_factor = speed;
}

TOOLKIT_DLLAPI void ToolkitTimeline::reset_timeline() {
void ToolkitTimeline::reset_timeline() {
max_time = 0.;
setCurrentTime(0.);
playing = false;
Expand Down
Loading

0 comments on commit 2b633eb

Please sign in to comment.