Trying to switch to custom editor modes fails because code only finds one 'valid' editor mode, the current one?

I’ve been trying pretty much everything (and I literally mean everything) to switch the modes palette to my own custom editor mode tab (which is basically a default editor mode example plugin) from code. Unfortunately, I’ve run into major problems.

GLevelEditorModeTools().GetActiveModes(ActiveModes) is supposed to fill an array of FEdMode* with all active modes, but this only ever returns one mode, the tab currently selected in the modes palette. GLevelEditorModeTools().ActivateMode(myFEditorModeID) breakpoints and kills the editor, assumedly because it can’t find it? Same thing with FEditorDelegates::ChangeEditorMode.Broadcast(myFEditorModeID).

Thought I’d found a way around this by using GEditor->DeferredCommands.Add(TEXT(“MODE myFEditorModeIDvalue”))… but this only works for the builtin, hardcoded types. Other types fall back on GLevelEditorModeTools().FindMode in the engine code, which brings me back to the earlier problem of the mode list only having one thing in it for some reason.

Help?

Actually did some further testing (from 4.10 through to 4.12), and the MODE command straight up does not work even for the built-in modes if you actually use their defined FEditorModeIDs.
Only the ones that are hardcoded in UnrealEdSrv.cpp (which does not include BSP, for example), actually do anything.
Is FindMode totally bugged?

The hardcoded modes that work don’t match their FEditorModeIDs.
EM_Landscape is hardcoded as MODE LANDSCAPE, so that works, but MODE EM_Landscape which goes looking for EM_Landscape… doesn’t find anything.

(Moved this to bug reports, since I can’t believe this is intended behaviour)

Hey turfster-

Can you explain what exactly you’re trying to do? Are you referring to creating a new Editor Mode plugin and then trying to select it in the editor’s Modes Tab? Are you able to reproduce this issue in a new project and, if so, can you include the steps that you used?

Quick and dirty example plugin I slapped together to demonstrate the problem with built-in editor modes.
Top line works, bottom line should work looking at the editor code that handles deferred commands… but doesn’t because GLevelEditorModeTools().FindMode seems to be returning faulty information?

(The ultimate goal is to do the same thing with a new Editor Mode plugin, but that runs into the same problem the bottom line does)

Hey turfster-

I’ve entered a bug report to investigate the use of the FEditorModeID in the editor/code (UE-30522)

Cheers

Hi , did you ever figure out a work around to switch editor modes?

MODE LANDSCAPE does not work either on 4.25 / 4.26…