# How can I modify the editor viewport layout configuration in C++?

**URL:** <https://forums.unrealengine.com/t/how-can-i-modify-the-editor-viewport-layout-configuration-in-c/2104369>\
**Category:** Editor Scripting\
**Tags:** c-c, c-class-wizard, c-and-bluepri, c-custommeshcomponen, c-and-blueprint, c-error, c-class, Editor-Scripting, c-custom-shape, c-programming, c-cone-shape, editor-viewports, unreal-engine, question, CPP\
**Created:** [November 4, 2024, 2:38pm UTC](https://forums.unrealengine.com/t/how-can-i-modify-the-editor-viewport-layout-configuration-in-c/2104369 "2024-11-04T14:38:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anonymous\_Kyborg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Anonymous\_Kyborg](https://forums.unrealengine.com/u/Anonymous_Kyborg)\
**Post date:** [November 4, 2024, 2:38pm UTC](https://forums.unrealengine.com/t/how-can-i-modify-the-editor-viewport-layout-configuration-in-c/2104369/1 "2024-11-04T14:38:30Z")

</div>

I’m working on a plugin that saves and loads viewport settings. But I can’t seem to figure out how to get and set the viewport layout configuration for the active level editor viewport. I’ve been looking into the FLevelViewportLayout class but, I’m not sure how to get an instance of it from the active viewport.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/2/7/7271e492dc7e6dfaabf145eaee64d9ca179b6614.jpeg)

---

<div class="post-metadata">

**Author:** ![Katianie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Katianie](https://forums.unrealengine.com/u/Katianie)\
**Post date:** [December 11, 2024, 6:54pm UTC](https://forums.unrealengine.com/t/how-can-i-modify-the-editor-viewport-layout-configuration-in-c/2104369/2 "2024-12-11T18:54:22Z")

</div>

I managed to figure it out, here is what is working for me:

```auto
void FLyraModule::SetQuadView()
{
    // Get the current level editor
    FLevelEditorModule& LevelEditorModule = FModuleManager::GetModuleChecked<FLevelEditorModule>("LevelEditor");
    TSharedPtr<ILevelEditor> LevelEditor = LevelEditorModule.GetFirstLevelEditor();

    if (LevelEditor.IsValid())
    {
        // Get the active viewport

		TSharedPtr<FUICommandList> CommandList;
		if (TSharedPtr<SLevelViewport> ActiveLevelViewport = LevelEditor->GetActiveViewportInterface())
		{
			CommandList = ActiveLevelViewport->GetCommandList();
		}

		CommandList->ExecuteAction(FLevelViewportCommands::Get().ViewportConfig_FourPanes2x2.ToSharedRef());
	}

}

```

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [January 10, 2025, 6:54pm UTC](https://forums.unrealengine.com/t/how-can-i-modify-the-editor-viewport-layout-configuration-in-c/2104369/3 "2025-01-10T18:54:34Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
