Announcement

Collapse
No announcement yet.

Force opening of a .umap asset in editor via C++? [4.9.1]

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Force opening of a .umap asset in editor via C++? [4.9.1]

    Currently trying to spawn in hundreds of levels in the editor from C++, but as per this bug report, spawning several hundred in one session leads to an 'out of video memory' crash. I have found that reloading the current map/level/world will 'reset' this limit and allow me to spawn more.

    Because this is part of a lengthy automated process (by which we import lots of architectural data into the world and split parts of it out into levels), I need to be able to automate the reload of this master level. The only way I've seen is via UEditorEngine::Map_Load (EditorServer.cpp:2155), but this is both private and unwieldy.

    Any ideas?

    #2
    I think this should do the trick.

    Code:
    FEditorFileUtils::LoadMap(TEXT("/Game/Maps/mapname.mapname"), false, true);

    Comment


      #3
      Originally posted by Goomii View Post
      I think this should do the trick.

      Code:
      FEditorFileUtils::LoadMap(TEXT("/Game/Maps/mapname.mapname"), false, true);
      Awesome, that totally does the trick! Now I need to save the map before each load (otherwise I lose the levels created in this process since the last save).

      Of course, FEditorFileUtils::SaveMap is not exported -_-

      Comment


        #4
        Ahh, got it working. This is what I use every 100 levels to stop the 'Out of video memory bug' + keep the created levels saved/existing.
        UWorld* editorWorld = GEditor->GetEditorWorldContext().World();
        if (editorWorld)
        {
        FString longPackageName = "";
        FString longFilename = "";
        if (FPackageName::SearchForPackageOnDisk(editorWorld->GetMapName(), &longPackageName, &longFilename, false))
        {
        FEditorFileUtils::SaveDirtyPackages(false, true, false, false);
        FEditorFileUtils::LoadMap(longPackageName, false, true);
        }
        }
        Thanks for the help, Goomii!

        Comment

        Working...
        X