Commit b11b6474 authored by Jan Möbius's avatar Jan Möbius

Backup via system backup interface and tooltips



git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@12701 383ad7c9-94d9-4d36-a494-682f7c89f535
parent a97bc3a1
......@@ -63,8 +63,8 @@
#include <OpenFlipper/BasePlugin/BaseInterface.hh>
#include <OpenFlipper/BasePlugin/ToolboxInterface.hh>
#include <OpenFlipper/BasePlugin/LoggingInterface.hh>
#include <OpenFlipper/BasePlugin/ContextMenuInterface.hh>
#include <OpenFlipper/BasePlugin/LoggingInterface.hh>
#include <OpenFlipper/common/Types.hh>
......@@ -72,13 +72,13 @@
//== CLASS DEFINITION ============================================
class SplatCloudRenderingControlPlugin : public QObject, BaseInterface, ToolboxInterface, LoggingInterface, ContextMenuInterface
class SplatCloudRenderingControlPlugin : public QObject, BaseInterface, ToolboxInterface, ContextMenuInterface, LoggingInterface
{
Q_OBJECT
Q_INTERFACES( BaseInterface )
Q_INTERFACES( ToolboxInterface )
Q_INTERFACES( LoggingInterface )
Q_INTERFACES( ContextMenuInterface )
Q_INTERFACES( LoggingInterface )
signals:
......@@ -86,15 +86,15 @@ signals:
void updatedObject( int _identifier, const UpdateType _type);
//-- Toolbox Interface --
void addToolbox( QString _name , QWidget* _widget, QIcon* _icon);
void addToolbox( QString _name, QWidget *_widget, QIcon *_icon );
//-- ContextMenu Interface--
void addContextMenuItem( QAction *_action, DataType _objectType, ContextMenuType _type );
//-- Logging Interface --
void log( Logtype _type, QString _message );
void log( QString _message );
//-- ContextMenu Interface--
void addContextMenuItem( QAction *_action, DataType _objectType, ContextMenuType _type );
public:
//-- Base Interface --
......@@ -112,14 +112,13 @@ private:
QSpinBox *toolboxDefaultColorR_;
QSpinBox *toolboxDefaultColorG_;
QSpinBox *toolboxDefaultColorB_;
QIcon *toolBoxIcon_;
// menu options
QAction *menuScaleAction_;
QAction *menuCullingAction_;
QAction *menuDefaultsAction_;
QAction *menuReloadShadersAction_;
QAction *menuRebuildVBOAction_;
// context menu options
QAction *contextScaleAction_;
QAction *contextCullingAction_;
QAction *contextDefaultsAction_;
QAction *contextReloadShadersAction_;
QAction *contextRebuildVBOAction_;
// scale widget options
QWidget *scaleWidget_;
......@@ -154,11 +153,11 @@ private slots:
void slotToolboxApplyDefaultsButtonClicked();
// slots called when a context menu action was triggered
void slotMenuScaleActionTriggered();
void slotMenuCullingActionTriggered();
void slotMenuReloadShadersActionTriggered();
void slotMenuRebuildVBOActionTriggered();
void slotMenuDefaultsActionTriggered();
void slotContextScaleActionTriggered();
void slotContextCullingActionTriggered();
void slotContextReloadShadersActionTriggered();
void slotContextRebuildVBOActionTriggered();
void slotContextDefaultsActionTriggered();
// slots called when a scale widget option changed value
void slotScaleWidgetPointsizeScaleValueChanged();
......
include (plugin)
openflipper_plugin ( INSTALLDATA Icons Shaders
)
openflipper_plugin (INSTALLDATA Icons Shaders)
//== INCLUDES ====================================================
#include "SplatCloudBackup.hh"
//== IMPLEMENTATION ==============================================
SplatCloudBackup::SplatCloudBackup( SplatCloudObject *_splatCloud, QString _name, UpdateType _type ) :
BaseBackup ( _splatCloud, _name, _type ),
splatCloud_ ( _splatCloud ),
normalsBackup_ ( 0 ),
pointsizesBackup_( 0 )
{
// std::cerr << "Create SplatCloudBackup with name:" << name_.toStdString() << "(id : " << id_ << ")" << std::endl;
if( _type == updateType( "Normals" ) || _type == UPDATE_ALL )
normalsBackup_ = new SplatCloudNode::NormalVector( _splatCloud->splatCloudNode()->normals() );
else if ( _type == updateType( "Pointsizes" ) || _type == UPDATE_ALL )
pointsizesBackup_ = new SplatCloudNode::PointsizeVector( _splatCloud->splatCloudNode()->pointsizes() );
}
//----------------------------------------------------------------
SplatCloudBackup::~SplatCloudBackup()
{
// std::cerr << "Delete SplatCloudBackup with name:" << name_.toStdString() << "(id : " << id_ << ")" << std::endl;
delete normalsBackup_;
delete pointsizesBackup_;
}
//----------------------------------------------------------------
void SplatCloudBackup::apply()
{
// first apply the baseBackup
BaseBackup::apply();
// std::cerr << "Apply SplatCloudBackup with name:" << name_.toStdString() << "(id : " << id_ << ")" << std::endl;
if( normalsBackup_ )
splatCloud_->splatCloudNode()->normals() = *normalsBackup_;
if( pointsizesBackup_ )
splatCloud_->splatCloudNode()->pointsizes() = *pointsizesBackup_;
}
#ifndef SPLATCLOUDBACKUP_HH
#define SPLATCLOUDBACKUP_HH
//== INCLUDES ====================================================
#include <OpenFlipper/common/BaseBackup.hh>
#include <ObjectTypes/SplatCloud/SplatCloud.hh>
//== CLASS DEFINITION ============================================
/**
* @brief Class that encapsulates a backup
*/
class SplatCloudBackup : public BaseBackup
{
public:
SplatCloudBackup( SplatCloudObject *_splatCloud, QString _name, UpdateType _type );
~SplatCloudBackup();
//-- BaseBackup --
void apply();
private:
SplatCloudObject *splatCloud_;
SplatCloudNode::NormalVector *normalsBackup_;
SplatCloudNode::PointsizeVector *pointsizesBackup_;
};
//================================================================
#endif // SPLATCLOUDBACKUP_HH
......@@ -54,6 +54,9 @@
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <OpenFlipper/common/BackupData.hh>
#include "SplatCloudBackup.hh"
#include <ACG/GL/GLState.hh>
......@@ -244,6 +247,38 @@ QString TypeSplatCloudPlugin::get_unique_name( SplatCloudObject *_object )
}
//----------------------------------------------------------------
void TypeSplatCloudPlugin::generateBackup( int _id, QString _name, UpdateType _type )
{
BaseObjectData *object = 0;
PluginFunctions::getObject( _id, object );
SplatCloudObject *splatCloud = PluginFunctions::splatCloudObject( object );
if( splatCloud )
{
// get backup object data
BackupData *backupData = 0;
if( object->hasObjectData( OBJECT_BACKUPS ) )
backupData = dynamic_cast<BackupData *>( object->objectData( OBJECT_BACKUPS ) );
else
{
// add backup data
backupData = new BackupData( object );
object->setObjectData( OBJECT_BACKUPS, backupData );
}
// store a new backup
SplatCloudBackup *backup = new SplatCloudBackup( splatCloud, _name, _type );
backupData->storeBackup( backup );
}
}
//================================================================
......
......@@ -79,8 +79,8 @@ class TypeSplatCloudPlugin : public QObject, BaseInterface, LoggingInterface, Ty
signals:
//-- Type Interface --
void emptyObjectAdded( int _id );
//-- Type Interface --
void emptyObjectAdded( int _id );
//-- Logging Interface --
void log( Logtype _type, QString _message );
......@@ -113,6 +113,7 @@ public slots:
//-- Type Interface --
int addEmpty();
DataType supportedType() { return DATA_SPLATCLOUD; };
void generateBackup( int _id, QString _name, UpdateType _type );
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment