I’m taking Mike Fricker’s advice and trying to hack together an editor plugin using the existing ability to load the game’s plugin code. This is part 1 of the quest - this is a mix of feedback and blockers.
- Did my code even load?
I had that question for awhile, because of this:
There’s no [Unload] or [Recompile], this is the default view of the game module until you manually recompile the module from the top toolbar. Very confusing, because there’s no obvious state your code is in. Consider a [Compile & Load] button if you don’t want to immediately load game modules upon load of the editor. Which I can completely understand the desire not to do, in case it causes the editor to constantly crash on load.
- Debugging
I’ve found this to be very difficult. If I unload the module, then attach Visual Studio to the rocket process, put a breakpoint in the modules StartupModule call, then load the module - exceptions are thrown inside the windows kernel base. Editor crashes but only if VS was attached during the Load.
One time, instead of Load and Unload, it just attached VS and clicked compile before my module had been loaded. Then when it loaded I hit the breakpoint. Awesome, only problem was every watch was garbage. It made me think everything is being compiled in Release mode. Is that correct, if so is there a way to force debug mode?
-
Clicking compile multiple times
This only does the work once if the code hasn’t changed. Good, but I recommend making it smart enough when manually forced by someone to compile that if nothing needs to be recompiled that it at least performs the Unload/Load. It’s a handy shortcut when trying to debug a module’s initial start-up. -
How can I write to the editor log?
-
I’m starting simple, insert something into a menu.
By looking at some other editor headers, I figured out I could provide my menus/toolbars using IHasMenuExtensibility and IHasToolBarExtensibility.
Nothing appears yet, but here’s where I am in terms of constructing a menu option.
toolbarExtensions = TSharedPtr (new FExtensibilityManager());
menuExtensions = TSharedPtr (new FExtensibilityManager());
bindingContextName = FName("NicksContext");
bindingconext = TSharedPtr(new FBindingContext(bindingContextName, TEXT("Description")));
cmdName = FName("NicksCommand");
iconName = FName("IconName");
TSharedPtr cmd;
FUICommandInfo::MakeCommandInfo(
bindingconext.ToSharedRef(),
cmd,
FLocCommandInfo(bindingContextName, cmdName, TEXT("CMD LBL"), TEXT("CMD DESC")),
iconName,
EUserInterfaceActionType::Type::Button,
FInputGesture());
callback.BindRaw(this, &MyEditorModule::MyCallback);
menucallback.BindRaw(this, &MyEditorModule::MyMenuCallback);
commands = TSharedPtr(new FUICommandList());
commands->MapAction(cmd, menucallback);
menuHookName = FName("HelpBrowse", FNAME_Find);
TSharedPtr extender = TSharedPtr(new FExtender());
extender->AddMenuExtension(menuHookName, EExtensionHook::Position::First, commands, callback);
menuExtensions->AddExtender(extender);
I feel like I’m close, but I suspect the I’m missing some information when it comes to the BindingContext. Like without the right binding context the menu won’t appear.
-
I figured out how to find the editor hooks. Preferences > Developer Tools > Display Multibox Hooks. Very useful.
-
I have an awesome idea for an editor plugin but I need to be able to add to the context menu of the blueprint editor, but unlike everything else I’ve encountered it appears to be the one thing that has no multibox hooks. Is this a rendering bug or just an overlooked place to add hooks.
- Can the beta forum be modified to contain more image uploads per post? It’s capped to 2.