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

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
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){
......@@ -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<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 );
}
//------------------------------------------------------------------------------
void InfoMeshObjectPlugin::slotAllCleared(){
targetMeshes_.clear();
if ( infoBar_ )
infoBar_->hideCounts();
}
......
......@@ -59,7 +59,6 @@
#include <OpenFlipper/BasePlugin/StatusbarInterface.hh>
#include <OpenFlipper/BasePlugin/LoggingInterface.hh>
#include <OpenFlipper/BasePlugin/LoadSaveInterface.hh>
#include <OpenFlipper/common/Types.hh>
#include <ObjectTypes/PolyMesh/PolyMesh.hh>
#include <ObjectTypes/TriangleMesh/TriangleMesh.hh>
......@@ -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<int> targetMeshes_;
template< class MeshT >
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