Editormodule : React to changes in details panel of component

Hey,

In my plugin I’ve got a runtime & editor module. The runtime module defines a custom actor component A and its behaviour.
Now I’d like to react to changes made to the component A in its details panel and call methods from the editor module depending on the changes made, like an item was added to an array. There’s the PostEditChangeChainProperty(struct FPropertyChangedChainEvent& PropertyChangedEvent)
method in the component but I can’t call methods from my editor module since I can’t link a runtime module with a editor module.

What’s the proper way to go here?

I can’t call methods from my editor module since I can’t link a runtime module with a editor module

Yes, you can :slight_smile:

In your runtime .Build.cs you can check if the build contains editor when specifying dependency modules:

namespace UnrealBuildTool.Rules
{
    public class MyRuntimeModule : ModuleRules
    {
        public MyRuntimeModule(ReadOnlyTargetRules Target) : base(Target)
        {
            PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;

            PrivateDependencyModuleNames.AddRange(
                new string[]
                {
                    "SHARED MODULES GO HERE"
                }
            );

            if (Target.bBuildEditor)
            {
                PrivateDependencyModuleNames.AddRange(
                    new string[]
                    {
                        "EDITOR-ONLY MODULES GO HERE"
                    }
                );
            }
        }
    }
}

Then in your runtime files, you wrap the necessary editor module include files in the WITH_EDITOR check:

#if WITH_EDITOR
#include "YourRuntimeModuleIncludeFile1.h"
#include "YourRuntimeModuleIncludeFile2.h"
#include "YourRuntimeModuleIncludeFile3.h"
#endif

It does package this way, but I can’t start a test project with the packaged plugin. It fails to load the editor module.

Unable to load module 'I:/TestProject/Plugins/EasyFootPrints/Binaries/Win64/UE4Editor-EasyFootPrintsEditor.dll' because the file couldn't be loaded by the OS.

Strange, seems to work fine for my plugin.

  1. Are you packaging the plugin and test project separately or as one?
  2. Are you sure there are no more references to the editor module that would be outside the Editor checks?

Well, I got it working on an older version without the seperate modules. There’s just one runtime module and that adds the dependency to editor modules if in editor.

But back to the runtime & editor module version. The crash occurs when a file from the runtime module tries to call a (static) function from the editor module.

When compiling the editor module ( through modules manager) it crashes due to not finding .generated.h files from the runtime module. Why does it search for them in the first place? The editor module does not have dependecy to the runtime module.

  1. Separately.
  2. Yes I think so :slight_smile:

edit: When adding the runtime module to the editor module the error with not finding .generated.h doesn’t occur anymore

I got a .cpp file in my Editor Module that included a header from the runtime module, that’s why I had to statically link my runtime module to my editor module.

Now it works properly, thank you :slight_smile: