/////////////////////////////////////////////////////////////////////////////// // Callback for when a document is closed. Closes the associated scene. // void SceneManager::DocumentClosed( const DocumentEventArgs& args ) { const Document* document = static_cast< const Document* >( args.m_Document ); HELIUM_ASSERT( document ); if ( document ) { Scene* scene = GetScene( document ); scene->DisconnectDocument( document ); // If the current scene is the one that is being closed, we need to set it // to no longer be the current scene. if ( HasCurrentScene() && GetCurrentScene() == scene ) { SetCurrentScene( NULL ); } #pragma TODO( "Is this sane?" ) while( IsNestedScene( scene ) ) { ReleaseNestedScene( scene ); } if ( scene ) { RemoveScene( scene ); } // Select the next scene in the list, if there is one if ( !HasCurrentScene() ) { SetCurrentScene( FindFirstNonNestedScene() ); } document->e_Closed.RemoveMethod( this, &SceneManager::DocumentClosed ); document->e_PathChanged.RemoveMethod( this, &SceneManager::DocumentPathChanged ); } }