Code/Editor/CryEditPy.cpp
void CloseCurrentLevel()
    {
        CCryEditDoc* currentLevel = GetIEditor()->GetDocument();
        if (currentLevel && currentLevel->IsDocumentReady())
        {
            // This closes the current document (level)
            currentLevel->OnNewDocument();

            // Then we need to tell the game engine there is no level to render anymore
            if (GetIEditor()->GetGameEngine())
            {
                GetIEditor()->GetGameEngine()->SetLevelPath("");
                GetIEditor()->GetGameEngine()->SetLevelLoaded(false);

                CViewManager* pViewManager = GetIEditor()->GetViewManager();
                CViewport* pGameViewport = pViewManager ? pViewManager->GetGameViewport() : nullptr;
                if (pGameViewport)
                {
                    pGameViewport->SetViewTM(Matrix34::CreateIdentity());
                }
            }
        }
    }
//! We have explicitly not exposed this CloseCurrentLevel API to Python Scripting since the Editor
//! doesn't officially support it (it doesn't exist in the File menu). It is used for cases
//! where a level with legacy entities are unable to be converted and so the level that has
//! been opened needs to be closed, but it hasn't been fully tested for a normal workflow.
We have explicitly not exposed this CloseCurrentLevel API to Python Scripting since the Editor
doesn't officially support it (it doesn't exist in the File menu). It is used for cases
where a level with legacy entities are unable to be converted and so the level that has
been opened needs to be closed, but it hasn't been fully tested for a normal workflow.
We have explicitly not exposed this CloseCurrentLevel API to Python Scripting since the Editor doesn ' t officially support it ( it doesn ' t exist in the File menu ) . It is used for cases where a level with legacy entities are unable to be converted and so the level that has been opened needs to be closed but it hasn ' t been fully tested for a normal workflow .
void CloseCurrentLevel()
    {
        CCryEditDoc* currentLevel = GetIEditor()->GetDocument();
        if (currentLevel && currentLevel->IsDocumentReady())
        {
            currentLevel->OnNewDocument();
            if (GetIEditor()->GetGameEngine())
            {
                GetIEditor()->GetGameEngine()->SetLevelPath("");
                GetIEditor()->GetGameEngine()->SetLevelLoaded(false);
                CViewManager* pViewManager = GetIEditor()->GetViewManager();
                CViewport* pGameViewport = pViewManager ? pViewManager->GetGameViewport() : nullptr;
                if (pGameViewport)
                {
                    pGameViewport->SetViewTM(Matrix34::CreateIdentity());
                }
            }
        }
    }
void CloseCurrentLevel ( ) { CCryEditDoc * currentLevel = GetIEditor ( ) -> GetDocument ( ) ; if ( currentLevel && currentLevel -> IsDocumentReady ( ) ) { currentLevel -> OnNewDocument ( ) ; if ( GetIEditor ( ) -> GetGameEngine ( ) ) { GetIEditor ( ) -> GetGameEngine ( ) -> SetLevelPath ( " " ) ; GetIEditor ( ) -> GetGameEngine ( ) -> SetLevelLoaded ( false ) ; CViewManager * pViewManager = GetIEditor ( ) -> GetViewManager ( ) ; CViewport * pGameViewport = pViewManager ? pViewManager -> GetGameViewport ( ) : nullptr ; if ( pGameViewport ) { pGameViewport -> SetViewTM ( Matrix34 :: CreateIdentity ( ) ) ; } } } }
We have explicitly not exposed this CloseCurrentLevel API to Python Scripting since the Editor
doesn't officially support it (it doesn't exist in the File menu).
We have explicitly not exposed this CloseCurrentLevel API to Python Scripting since the Editor doesn ' t officially support it ( it doesn ' t exist in the File menu ) .
// This closes the current document (level) // Then we need to tell the game engine there is no level to render anymore