Commit 3d11893e authored by Jan Möbius's avatar Jan Möbius

Second fix version, now handling deleted objects separatly.

Problem was that the object gets deleted after the function got called.

closes #2443



git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@20608 383ad7c9-94d9-4d36-a494-682f7c89f535
parent e35d88a1
......@@ -823,23 +823,28 @@ bool InfoMeshObjectPlugin::getEdgeLengths(int _id, double &min, double &max, dou
//------------------------------------------------------------------------------
void InfoMeshObjectPlugin::slotObjectUpdated( int _identifier , const UpdateType& _type){
void InfoMeshObjectPlugin::updateData( int _identifier , const UpdateType& _type, const bool _deleted){
if ( !infoBar_ ) {
return;
}
// We only show the information in the status bar if one target mesh is selected.
if ( PluginFunctions::targetCount() == 1 ) {
BaseObjectData* object;
PluginFunctions::getObject(_identifier,object);
// We only show the information in the status bar if one target mesh is selected or
// If 2 targets where selected, where one is deleted which was target
if ( PluginFunctions::targetCount() == 1 || ( _deleted && (PluginFunctions::targetCount() == 2) && object && object->target() ) ) {
// The object that caused the update is not a target anymore.
// Therefore we need to get the remaining target by iteration.
// If something was deleted, we might see this object here, so make sure, to not take the one with the same id as the deleted one
if ( object && !object->target() ) {
for ( PluginFunctions::ObjectIterator o_it = PluginFunctions::ObjectIterator(PluginFunctions::TARGET_OBJECTS); o_it != PluginFunctions::objectsEnd(); ++o_it ) {
if ( !_deleted || ( o_it->id() != _identifier ) ) {
object = *o_it;
break;
}
}
}
......@@ -873,12 +878,16 @@ void InfoMeshObjectPlugin::slotObjectUpdated( int _identifier , const UpdateType
}
//infoBar_->hideCounts();
infoBar_->hideCounts();
} else {
// Display only count information
if ( PluginFunctions::targetCount() > 1 ) {
if ( (PluginFunctions::targetCount() > 1) && object ) {
if ( _deleted && object->target() ) {
infoBar_->showTargetCount( PluginFunctions::targetCount() - 1);
} else {
infoBar_->showTargetCount( PluginFunctions::targetCount() );
}
} else
infoBar_->hideCounts();
}
......@@ -887,10 +896,25 @@ void InfoMeshObjectPlugin::slotObjectUpdated( int _identifier , const UpdateType
//------------------------------------------------------------------------------
void InfoMeshObjectPlugin::slotObjectUpdated( int _identifier , const UpdateType& _type){
updateData(_identifier,_type,false);
}
//------------------------------------------------------------------------------
void InfoMeshObjectPlugin::slotObjectSelectionChanged( int _identifier ){
slotObjectUpdated( _identifier , UPDATE_ALL );
updateData(_identifier,UPDATE_ALL,false);
}
//------------------------------------------------------------------------------
void InfoMeshObjectPlugin::objectDeleted( int _identifier ){
updateData(_identifier,UPDATE_ALL,true);
}
//------------------------------------------------------------------------------
void InfoMeshObjectPlugin::slotAllCleared(){
......
......@@ -56,7 +56,7 @@
#include <OpenFlipper/BasePlugin/BaseInterface.hh>
#include <OpenFlipper/BasePlugin/InformationInterface.hh>
#include <OpenFlipper/BasePlugin/LoadSaveInterface.hh>
#include <OpenFlipper/BasePlugin/StatusbarInterface.hh>
#include <OpenFlipper/BasePlugin/LoggingInterface.hh>
#include <OpenFlipper/common/Types.hh>
......@@ -73,13 +73,14 @@
Plugin to visualize information about objects in the scene
*/
class InfoMeshObjectPlugin : public QObject, BaseInterface, InformationInterface, LoggingInterface, StatusbarInterface
class InfoMeshObjectPlugin : public QObject, BaseInterface, InformationInterface, LoggingInterface, StatusbarInterface, LoadSaveInterface
{
Q_OBJECT
Q_INTERFACES(BaseInterface)
Q_INTERFACES(InformationInterface)
Q_INTERFACES(LoggingInterface)
Q_INTERFACES(StatusbarInterface)
Q_INTERFACES(LoadSaveInterface)
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-MeshObjectInfo")
......@@ -106,6 +107,9 @@ class InfoMeshObjectPlugin : public QObject, BaseInterface, InformationInterface
void slotObjectSelectionChanged( int _identifier );
void slotAllCleared();
// LoadSaveInterface
void objectDeleted( int _identifier );
void noguiSupported( ) {} ;
// InformationInterface
......@@ -134,6 +138,9 @@ class InfoMeshObjectPlugin : public QObject, BaseInterface, InformationInterface
template< class MeshT >
void printMeshInfo( MeshT* _mesh, int _id, unsigned int _face, ACG::Vec3d& _hitPoint );
/// Slot that updates the visualization
void updateData( int _identifier , const UpdateType& _type, const bool deleted);
//===========================================================================
/** @name Scripting Functions
* @{ */
......
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