MCPcopy Create free account
hub / github.com/URLab-Sim/UnrealRoboticsLab / StartupModule

Method StartupModule

Source/URLabEditor/Private/URLabEditor.cpp:67–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65#include "Framework/Docking/WorkspaceItem.h"
66
67void FURLabEditorModule::StartupModule()
68{
69 FMjEditorStyle::Initialize();
70
71 // Install the bridge-server resolver so AAMjManager (URLab module) can
72 // discover the editor-time server without depending on URLabEditor.
73 // The resolver lazy-starts the subsystem's server so a PIE BeginPlay
74 // that fires before the user toggles AutoStart still gets a server.
75 URLabBridgeProvider::RegisterResolver([]() -> UURLabBridgeServer* {
76 if (!GEditor)
77 return nullptr;
78 UURLabBridgeServerSubsystem* Sub =
79 GEditor->GetEditorSubsystem<UURLabBridgeServerSubsystem>();
80 if (!Sub)
81 return nullptr;
82 Sub->StartServer(); // idempotent; honours INI auto-start
83 return Sub->GetBridgeServer();
84 });
85
86 // Editor-only op handlers (import_xml, create_level, spawn_*, ...).
87 // The dispatcher in URLab forwards editor-only ops through
88 // URLabOpRegistry, which these handlers populate.
89 URLabEditorOpHandlers::RegisterAll();
90
91 FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
92 // Only Geom has non-hiding logic (the CoACD decomposition buttons).
93 // The other 9 components' simple "HideProperty(DefaultClass)" /
94 // "HideProperty(Name)" customizations were replaced by
95 // meta=(EditCondition="false", EditConditionHides) on the UPROPERTY
96 // decls themselves — see UMjActuator::DefaultClass et al.
97 {
98 TArray<UClass*> GeomClasses;
99 GetDerivedClasses(UMjGeom::StaticClass(), GeomClasses, true);
100 GeomClasses.Add(UMjGeom::StaticClass());
101 for (UClass* Class : GeomClasses)
102 {
103 PropertyModule.RegisterCustomClassLayout(
104 Class->GetFName(),
105 FOnGetDetailCustomizationInstance::CreateStatic(&FMjGeomDetailCustomization::MakeInstance));
106 }
107 }
108 PropertyModule.NotifyCustomizationModuleChanged();
109
110 // Register viewport actor context menu extender
111 FLevelEditorModule& LevelEditorModule = FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor");
112 FLevelEditorModule::FLevelViewportMenuExtender_SelectedActors MenuExtender =
113 FLevelEditorModule::FLevelViewportMenuExtender_SelectedActors::CreateStatic(
114 &FURLabEditorModule::OnExtendActorContextMenu);
115 auto& Extenders = LevelEditorModule.GetAllLevelViewportContextMenuExtenders();
116 Extenders.Add(MenuExtender);
117 ViewportContextMenuExtenderHandle = Extenders.Last().GetHandle();
118
119 // Register auto-parenting hook for MuJoCo components
120 OnObjectModifiedHandle = FCoreUObjectDelegates::OnObjectModified.AddRaw(this, &FURLabEditorModule::OnObjectModified);
121
122 // Register the StepMode status indicator into the level editor toolbar.
123 // The indicator is a small Slate widget that polls AAMjManager::Instance
124 // every 0.5s and shows a coloured pill: green=Live, amber=Direct,

Callers

nothing calls this directly

Calls 3

RegisterResolverFunction · 0.85
RegisterAllFunction · 0.85
StartServerMethod · 0.80

Tested by

no test coverage detected