Commit 721603fa authored by Jan Möbius's avatar Jan Möbius
Browse files

Significant speedup for the InfoMeshObject Plugin, which kept an additional...

Significant speedup for the InfoMeshObject Plugin, which kept an additional list of object targets. refs #1375

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@16191 383ad7c9-94d9-4d36-a494-682f7c89f535
parent f73a9bd6
...@@ -811,38 +811,6 @@ bool InfoMeshObjectPlugin::getEdgeLengths(int _id, double &min, double &max, dou ...@@ -811,38 +811,6 @@ bool InfoMeshObjectPlugin::getEdgeLengths(int _id, double &min, double &max, dou
return false; return false;
} }
////------------------------------------------------------------------------------
void InfoMeshObjectPlugin::addedEmptyObject(int _id) {
BaseObject* object;
PluginFunctions::getObject(_id,object);
if( object ) {
if ( (object->dataType() == DATA_TRIANGLE_MESH || object->dataType() == DATA_POLY_MESH) &&
object->target()
)
targetMeshes_.insert(_id);
} else {
std::cerr << "MeshObject Info Plugin: Unable to get Object after adding!" << std::endl;
}
}
//------------------------------------------------------------------------------
void InfoMeshObjectPlugin::objectDeleted(int _id) {
BaseObject* object;
PluginFunctions::getObject(_id,object);
if( object ) {
if ( object->dataType() == DATA_TRIANGLE_MESH || object->dataType() == DATA_POLY_MESH) {
QSet<int>::iterator iter = targetMeshes_.find(_id);
if ( iter != targetMeshes_.end() ) {
targetMeshes_.erase(iter);
}
}
} else {
std::cerr << "MeshObject Info Plugin: Unable to get Object after adding!" << std::endl;
}
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void InfoMeshObjectPlugin::slotObjectUpdated( int _identifier , const UpdateType& _type){ void InfoMeshObjectPlugin::slotObjectUpdated( int _identifier , const UpdateType& _type){
...@@ -851,10 +819,15 @@ void InfoMeshObjectPlugin::slotObjectUpdated( int _identifier , const UpdateType ...@@ -851,10 +819,15 @@ void InfoMeshObjectPlugin::slotObjectUpdated( int _identifier , const UpdateType
return; return;
} }
if ( targetMeshes_.count() == 1) { // We only show the information in the status bar if one target mesh is selected.
if ( PluginFunctions::targetCount() ==1 ) {
BaseObjectData* object; BaseObjectData* object;
PluginFunctions::getObject((*targetMeshes_.begin()),object); PluginFunctions::getObject(_identifier,object);
if( object ) {
// We only need to update something, if the updated object is the target object
if (object->target() ) {
if (object->dataType(DATA_TRIANGLE_MESH)){ if (object->dataType(DATA_TRIANGLE_MESH)){
TriMesh* mesh = PluginFunctions::triMesh(object); TriMesh* mesh = PluginFunctions::triMesh(object);
...@@ -881,6 +854,7 @@ void InfoMeshObjectPlugin::slotObjectUpdated( int _identifier , const UpdateType ...@@ -881,6 +854,7 @@ void InfoMeshObjectPlugin::slotObjectUpdated( int _identifier , const UpdateType
} }
} }
} else { } else {
// Display only count information // Display only count information
if ( PluginFunctions::targetCount() > 0 ) { if ( PluginFunctions::targetCount() > 0 ) {
...@@ -894,30 +868,12 @@ void InfoMeshObjectPlugin::slotObjectUpdated( int _identifier , const UpdateType ...@@ -894,30 +868,12 @@ void InfoMeshObjectPlugin::slotObjectUpdated( int _identifier , const UpdateType
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void InfoMeshObjectPlugin::slotObjectSelectionChanged( int _identifier ){ void InfoMeshObjectPlugin::slotObjectSelectionChanged( int _identifier ){
BaseObject* object;
PluginFunctions::getObject(_identifier,object);
if( object ) {
if ( object->dataType() == DATA_TRIANGLE_MESH || object->dataType() == DATA_POLY_MESH) {
if ( ! object->target() ) {
QSet<int>::iterator iter = targetMeshes_.find(_identifier);
if ( iter != targetMeshes_.end() )
targetMeshes_.erase(iter);
} else
targetMeshes_.insert(_identifier);
}
} else {
std::cerr << "MeshObject Info Plugin: Unable to get Object after adding!" << std::endl;
}
slotObjectUpdated( _identifier , UPDATE_ALL ); slotObjectUpdated( _identifier , UPDATE_ALL );
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void InfoMeshObjectPlugin::slotAllCleared(){ void InfoMeshObjectPlugin::slotAllCleared(){
targetMeshes_.clear();
if ( infoBar_ ) if ( infoBar_ )
infoBar_->hideCounts(); infoBar_->hideCounts();
} }
......
...@@ -59,7 +59,6 @@ ...@@ -59,7 +59,6 @@
#include <OpenFlipper/BasePlugin/StatusbarInterface.hh> #include <OpenFlipper/BasePlugin/StatusbarInterface.hh>
#include <OpenFlipper/BasePlugin/LoggingInterface.hh> #include <OpenFlipper/BasePlugin/LoggingInterface.hh>
#include <OpenFlipper/BasePlugin/LoadSaveInterface.hh>
#include <OpenFlipper/common/Types.hh> #include <OpenFlipper/common/Types.hh>
#include <ObjectTypes/PolyMesh/PolyMesh.hh> #include <ObjectTypes/PolyMesh/PolyMesh.hh>
#include <ObjectTypes/TriangleMesh/TriangleMesh.hh> #include <ObjectTypes/TriangleMesh/TriangleMesh.hh>
...@@ -74,14 +73,13 @@ ...@@ -74,14 +73,13 @@
Plugin to visualize information about objects in the scene Plugin to visualize information about objects in the scene
*/ */
class InfoMeshObjectPlugin : public QObject, BaseInterface, InformationInterface, LoggingInterface, StatusbarInterface, LoadSaveInterface class InfoMeshObjectPlugin : public QObject, BaseInterface, InformationInterface, LoggingInterface, StatusbarInterface
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(BaseInterface) Q_INTERFACES(BaseInterface)
Q_INTERFACES(InformationInterface) Q_INTERFACES(InformationInterface)
Q_INTERFACES(LoggingInterface) Q_INTERFACES(LoggingInterface)
Q_INTERFACES(StatusbarInterface) Q_INTERFACES(StatusbarInterface)
Q_INTERFACES(LoadSaveInterface)
signals: signals:
...@@ -105,11 +103,6 @@ class InfoMeshObjectPlugin : public QObject, BaseInterface, InformationInterface ...@@ -105,11 +103,6 @@ class InfoMeshObjectPlugin : public QObject, BaseInterface, InformationInterface
void slotObjectSelectionChanged( int _identifier ); void slotObjectSelectionChanged( int _identifier );
void slotAllCleared(); void slotAllCleared();
//LoadSaveInterface
void addedEmptyObject(int _id);
void objectDeleted(int _id);
void noguiSupported( ) {} ; void noguiSupported( ) {} ;
// InformationInterface // InformationInterface
...@@ -135,8 +128,6 @@ class InfoMeshObjectPlugin : public QObject, BaseInterface, InformationInterface ...@@ -135,8 +128,6 @@ class InfoMeshObjectPlugin : public QObject, BaseInterface, InformationInterface
InfoBar* infoBar_; InfoBar* infoBar_;
QSet<int> targetMeshes_;
template< class MeshT > template< class MeshT >
void printMeshInfo( MeshT* _mesh, int _id, unsigned int _face, ACG::Vec3d& _hitPoint ); void printMeshInfo( MeshT* _mesh, int _id, unsigned int _face, ACG::Vec3d& _hitPoint );
......
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