diff --git a/MeshObjectInfoPlugin.cc b/MeshObjectInfoPlugin.cc index d690d2cf73f39b58155a85b3bc8f7d9edb3426c1..da4ea601398f6d76990d91607d03243ed546709f 100644 --- a/MeshObjectInfoPlugin.cc +++ b/MeshObjectInfoPlugin.cc @@ -811,38 +811,6 @@ bool InfoMeshObjectPlugin::getEdgeLengths(int _id, double &min, double &max, dou 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::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){ @@ -851,10 +819,15 @@ void InfoMeshObjectPlugin::slotObjectUpdated( int _identifier , const UpdateType 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; - PluginFunctions::getObject((*targetMeshes_.begin()),object); - if( object ) { + PluginFunctions::getObject(_identifier,object); + + // We only need to update something, if the updated object is the target object + if (object->target() ) { + if (object->dataType(DATA_TRIANGLE_MESH)){ TriMesh* mesh = PluginFunctions::triMesh(object); @@ -881,6 +854,7 @@ void InfoMeshObjectPlugin::slotObjectUpdated( int _identifier , const UpdateType } } + } else { // Display only count information if ( PluginFunctions::targetCount() > 0 ) { @@ -894,30 +868,12 @@ void InfoMeshObjectPlugin::slotObjectUpdated( int _identifier , const UpdateType //------------------------------------------------------------------------------ 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::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 ); } //------------------------------------------------------------------------------ void InfoMeshObjectPlugin::slotAllCleared(){ - targetMeshes_.clear(); if ( infoBar_ ) infoBar_->hideCounts(); } diff --git a/MeshObjectInfoPlugin.hh b/MeshObjectInfoPlugin.hh index 2a3257482bd009fbde431309120baa0d3afe1644..c3b96c8ff1653d432ca17d5a8bbc429118620f1f 100644 --- a/MeshObjectInfoPlugin.hh +++ b/MeshObjectInfoPlugin.hh @@ -59,7 +59,6 @@ #include #include -#include #include #include #include @@ -74,14 +73,13 @@ 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_INTERFACES(BaseInterface) Q_INTERFACES(InformationInterface) Q_INTERFACES(LoggingInterface) Q_INTERFACES(StatusbarInterface) - Q_INTERFACES(LoadSaveInterface) signals: @@ -105,11 +103,6 @@ class InfoMeshObjectPlugin : public QObject, BaseInterface, InformationInterface void slotObjectSelectionChanged( int _identifier ); void slotAllCleared(); - //LoadSaveInterface - void addedEmptyObject(int _id); - void objectDeleted(int _id); - - void noguiSupported( ) {} ; // InformationInterface @@ -135,8 +128,6 @@ class InfoMeshObjectPlugin : public QObject, BaseInterface, InformationInterface InfoBar* infoBar_; - QSet targetMeshes_; - template< class MeshT > void printMeshInfo( MeshT* _mesh, int _id, unsigned int _face, ACG::Vec3d& _hitPoint );