Commit 9d121eb4 authored by Jan Möbius's avatar Jan Möbius

Use visibility changed from object now and use the new function otherwise

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7792 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 1e61ac4c
......@@ -123,15 +123,14 @@ class BaseInterface {
*/
virtual void updatedObject(int ) {};
/** \brief An object has been shown or hidden
/** \brief A scenegraph node has been shown or hidden
*
* Emit this Signal, if you changed the visibility of an object.
* Emit this Signal, if you changed the visibility of a scenegraph node directly (not via object->show/hide).
* This is required to reset the near and far plane for the viewers to provide
* an optimal view. Use the id of the object you show or hide as a parameter.
* Otherwise use -1 if you dont have the id.
* an optimal view. Use the id of the object the node is attached to or -1 if it is not connected to an object.
*
*/
virtual void visibilityChanged( int /*_identifier*/ ) {};
virtual void nodeVisibilityChanged( int /*_identifier*/ ) {};
/** \brief The object selection has been changed by this plugin
*
......
......@@ -279,21 +279,23 @@ void Core::backupRequest( int _id , QString _name ) {
void Core::newObject(int _objectId) {
// std::cerr << "newObject" << std::endl;
BaseObjectData* baseObjectData = 0;
PluginFunctions::getObject(_objectId,baseObjectData);
// Try to get the BaseObjectData because only then we have visibility info
if ( baseObjectData ) {
// BaseObjectData* baseObjectData = 0;
// PluginFunctions::getObject(_objectId,baseObjectData);
//
// // Try to get the BaseObjectData because only then we have visibility info
// if ( baseObjectData ) {
// std::cerr << "Connecting BaseObjectData" << std::endl;
// connect( baseObjectData, SIGNAL(visibilityChanged(int)),this,SLOT(test(int)) );
//
}
// connect( baseObjectData, SIGNAL(visibilityChanged(int)),this,SLOT(slotObjectSelectionChanged(int)) );
// return;
// }
BaseObject* baseObject = 0;
PluginFunctions::getObject(_objectId,baseObject);
if ( baseObject ) {
// std::cerr << "Base Object specific connects" << std::endl;
std::cerr << "Base Object specific connects" << std::endl;
connect( baseObject, SIGNAL(visibilityChanged(int)),this,SLOT(slotObjectSelectionChanged(int)) );
// connect( baseObject, SIGNAL(objectSelectionChanged(int)),this,SLOT(slotObjectSelectionChanged(int)) );
}
......
......@@ -501,8 +501,15 @@ void Core::loadPlugin(QString filename, bool silent){
if ( checkSignal(plugin,"visibilityChanged()" ) )
emit log (LOGERR,tr("Signal visibilityChanged() now requires objectid or -1 as argument " ));
if ( checkSignal(plugin,"visibilityChanged(int)") )
connect(plugin,SIGNAL(visibilityChanged(int)),this,SLOT(slotVisibilityChanged(int)), Qt::DirectConnection);
if ( checkSignal(plugin,"visibilityChanged(int)") ) {
emit log (LOGERR,tr("Signal visibilityChanged(int) is deprecated! " ));
emit log (LOGERR,tr("If an object changes its visibility, it will call the required functions automatically." ));
emit log (LOGERR,tr("If you change a scenegraph node, call nodeVisibilityChanged(int). See docu of this function for details." ));
}
if ( checkSignal(plugin,"nodeVisibilityChanged(int)") )
connect(plugin,SIGNAL(nodeVisibilityChanged(int)),this,SLOT(slotVisibilityChanged(int)), Qt::DirectConnection);
if ( checkSlot(plugin,"slotVisibilityChanged(int)") )
connect(this,SIGNAL(visibilityChanged(int)),plugin,SLOT(slotVisibilityChanged(int)), Qt::DirectConnection);
......
......@@ -324,9 +324,6 @@ void MouseAndKeyPlugin::contextMenuItemSelected(QAction* _action) {
// Hide object
obj->hide();
// Tell core that object's visibility has changed
visibilityChanged(objectId);
} // End contextMenuItemSelected
Q_EXPORT_PLUGIN2( mouseandkeyplugin , MouseAndKeyPlugin );
......
......@@ -32,7 +32,6 @@ class MouseAndKeyPlugin: public QObject,
//BaseInterface
void updateView();
void updatedObject(int _id);
void visibilityChanged(int _id);
//LoggingInterface
void log(Logtype _type, QString _message);
void log(QString _message);
......
......@@ -73,8 +73,6 @@ BaseObjectData::BaseObjectData(const BaseObjectData& _object)
{
// We have to create our own visualization nodes as we are a new object
init();
getObjectManager()->objectCreated(id());
}
BaseObjectData::BaseObjectData( SeparatorNode* _rootNode ) :
......@@ -89,8 +87,6 @@ BaseObjectData::BaseObjectData( SeparatorNode* _rootNode ) :
stencilRefNode_(0)
{
init();
getObjectManager()->objectCreated(id());
}
BaseObjectData::~BaseObjectData() {
......
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