@@ -217,14 +217,6 @@ auto FEcsactEditorModule::StartupModule() -> void {
217217 ),
218218 SourcesWatchHandle
219219 );
220- watcher->RegisterDirectoryChangedCallback_Handle (
221- PluginBinariesDir (),
222- IDirectoryWatcher::FDirectoryChanged::CreateRaw (
223- this ,
224- &FEcsactEditorModule::OnPluginBinariesChanged
225- ),
226- PluginBinariesWatchHandle
227- );
228220
229221 FEditorDelegates::OnEditorInitialized.AddRaw (
230222 this ,
@@ -407,16 +399,6 @@ auto FEcsactEditorModule::AddMenuEntry(FMenuBuilder& MenuBuilder) -> void {
407399 LOCTEXT (" EcsactToolsSectionTitle" , " Ecsact" )
408400 );
409401 {
410- MenuBuilder.AddMenuEntry (
411- LOCTEXT (" EcsactRunCodegen" , " Re-run codegen" ),
412- LOCTEXT (
413- " EcsactRunCodegenTooltip" ,
414- " Re-runs the ecsact codegen. This usually happens automatically and is "
415- " not necessary to run manually from the menu."
416- ),
417- FSlateIcon (),
418- FUIAction (FExecuteAction::CreateLambda ([this ] { RunCodegen (); }))
419- );
420402 MenuBuilder.AddMenuEntry (
421403 LOCTEXT (" EcsactRebuild" , " Rebuild runtime" ),
422404 LOCTEXT (
@@ -447,129 +429,13 @@ auto FEcsactEditorModule::OnProjectSourcesChanged(
447429 UE_LOG (
448430 EcsactEditor,
449431 Log,
450- TEXT (" Ecsact files changed. Re-generating C++ and rebuilding runtime ..." )
432+ TEXT (" Ecsact files changed. Rebuilding runtime ..." )
451433 );
452434
453- RunCodegen ();
454435 RunBuild ();
455436 }
456437}
457438
458- auto FEcsactEditorModule::OnPluginBinariesChanged (
459- const TArray<FFileChangeData>& FileChanges
460- ) -> void {
461- auto any_codegen_plugins_changed = false ;
462- auto plugin_ext = PlatformEcsactPluginExtension ();
463- if (plugin_ext.IsEmpty ()) {
464- return ;
465- }
466-
467- for (auto & change : FileChanges) {
468- if (!change.Filename .EndsWith (plugin_ext)) {
469- continue ;
470- }
471-
472- auto change_basename = FPaths::GetBaseFilename (change.Filename );
473- if (!change_basename.StartsWith (" UnrealEditor-Ecsact" )) {
474- continue ;
475- }
476- if (!change_basename.Contains (" CodegenPlugin" )) {
477- continue ;
478- }
479-
480- auto dash_index = int32{};
481- if (change_basename.FindLastChar (' -' , dash_index)) {
482- auto plugin_name = change_basename.Mid (0 , dash_index);
483- CodegenPluginHotReloadNames.Add (plugin_name, change_basename);
484- }
485-
486- any_codegen_plugins_changed = true ;
487- }
488-
489- if (any_codegen_plugins_changed) {
490- UE_LOG (
491- EcsactEditor,
492- Log,
493- TEXT (" Ecsact codegen plugins changed. Re-generating C++ ..." )
494- );
495-
496- RunCodegen ();
497- }
498- }
499-
500- auto FEcsactEditorModule::GetUnrealCodegenPlugins () -> TArray<FString> {
501- auto & fm = FPlatformFileManager::Get ().GetPlatformFile ();
502- auto plugins_dir = FPaths::ProjectPluginsDir ();
503- auto plugin_dir = FPaths::Combine (plugins_dir, " Ecsact" );
504-
505- if (!fm.DirectoryExists (*plugin_dir)) {
506- UE_LOG (
507- EcsactEditor,
508- Error,
509- TEXT (" Unable to find Ecsact Unreal integration plugin directory. Please "
510- " make sure it is installed as 'Ecsact' and not by any other name" )
511- );
512- return {};
513- }
514-
515- auto codegen_plugin_name = CodegenPluginHotReloadNames.FindRef (
516- " UnrealEditor-EcsactUnrealCodegenPlugin" ,
517- " UnrealEditor-EcsactUnrealCodegenPlugin"
518- );
519-
520- auto plugin_path = FPaths::Combine (
521- plugin_dir,
522- " Binaries" ,
523- PlatformBinariesDirname (),
524- codegen_plugin_name + PlatformEcsactPluginExtension ()
525- );
526-
527- if (fm.FileExists (*plugin_path)) {
528- return {plugin_path};
529- }
530-
531- UE_LOG (EcsactEditor, Error, TEXT (" Unable to find %s" ), *plugin_path);
532-
533- return {};
534- }
535-
536- auto FEcsactEditorModule::RunCodegen () -> void {
537- auto ecsact_files = GetAllEcsactFiles ();
538- auto args = TArray<FString>{
539- " codegen" ,
540- " --format=json" ,
541- " --plugin=cpp_header" ,
542- // "--plugin=systems_header",
543- // "--plugin=cpp_systems_header",
544- // "--plugin=cpp_systems_source",
545- };
546-
547- for (auto plugin : GetUnrealCodegenPlugins ()) {
548- args.Add (" --plugin=" + plugin);
549- }
550-
551- args.Append (ecsact_files);
552-
553- SpawnEcsactCli (
554- args,
555- FOnReceiveLine::CreateLambda ([this ](FString Line) {
556- OnReceiveEcsactCliJsonMessage (Line);
557- }),
558- FOnExitDelegate::CreateLambda ([](int32 ExitCode) -> void {
559- if (ExitCode == 0 ) {
560- UE_LOG (EcsactEditor, Log, TEXT (" Ecsact codegen success" ));
561- } else {
562- UE_LOG (
563- EcsactEditor,
564- Error,
565- TEXT (" Ecsact codegen failed with exit code %i" ),
566- ExitCode
567- );
568- }
569- })
570- );
571- }
572-
573439auto FEcsactEditorModule::RunBuild () -> void {
574440 const auto * settings = GetDefault<UEcsactSettings>();
575441
@@ -673,7 +539,6 @@ auto FEcsactEditorModule::SupportsDynamicReloading() -> bool {
673539}
674540
675541auto FEcsactEditorModule::OnEditorInitialized (double Duration) -> void {
676- RunCodegen ();
677542 RunBuild ();
678543}
679544
0 commit comments