WITH_EDITOR vs WITH_EDITORONLY_DATA?

I know what is WITH_EDITOR for.
But wtf is WITH_EDITORONLY_DATA for?

1 Like

WITH_EDITORONLY_DATA is used for programs that are not the Editor, but need the Editor data, such as UHT, etc.

Why in Development Editor compilation WITH_EDITORONLY_DATA == 0 then? I am compiling Editor, so i suppose to need Editor Data, no?

I mean, i am compiling “Editor” using visual studio UE4.1.0 source codes with “Development Editor” solution configuration.

But IntelliSense shows me, that WITH_EDITORONLY_DATA is not defined, while WITH_EDITOR is defined. So i am curious, why WITH_EDITORONLY_DATA is NOT defined for “EDITOR” inside visual studio solution (not inside UnrealBuildTool), because that makes not sence, how can be Editor be compiled without EditorData…

I understand, that UnrealBuildTool will “TURN ON” WITH_EDITORONLY_DATA and Editor will be compiled with EditorData. But i dont understand, why they didnt make WITH_EDITORONLY_DATA=1 for VisualStudio “Editor Configuration” by default. So i think there is one of two reasons:

  1. They made a mistake, which is NOT critical but annoying, because IntelliSense doesnt see EditorData for Editor project.

  2. They made it on purpose. So i wanna know what exactly purpose.

PS: also i would like to see example of using (WITH_EDITORONLY_DATA=1 && WITH_EDITOR=0) for exact understanding of my initial question.

I’m not sure what you mean, looking at UEBuildTarget.cs in Engine/Source/Programs/UnrealBuildTool/Configuration, Editor build should get getting WITH_EDITORONLY_DATA=1.

See https://github.com/EpicGames/UnrealEngine/blob/master/Engine/Source/Programs/UnrealBuildTool/Configuration/UEBuildTarget.cs#L2245

I can’t really say whether Epic made a mistake or not in 4.1 and VS with this, as I don’t have enough information.

Here’s an example in UHT where they define them both for building: https://github.com/EpicGames/UnrealEngine/blob/master/Engine/Source/Programs/UnrealHeaderTool/UnrealHeaderTool.Target.cs#L53

Else you can always do: “git grep WITH_EDITORONLY_DATA” and see where it appears in the code.

I’m not sure if it is on purpose, but I do like the greyed out colour indication that the code will be compiled out of the game.

Today i changed WITH_EDITORONLY_DATA to =1 for “Development Editor”, well, actually IntellSense probably become better, but overall it still the same, have some errors, for example it still cant show me definition (F12) of function ABrush::InitPosRotScale or ABrush::CopyPosRotScaleFrom etc, so i have to find them myself inside Brush.cpp, or with Search tool.

But i think now i understand, why developers turned off WITH_EDITORONLY_DATA by default, because actually “Development Editor” config means “Development with Editor”, but not “Development of Editor”, so you dont need mess with EditorData when you just creating game with editor support.

So, the basic rule i suppose: WITH_EDITOR used for methods(except cases when that methods needs some strictly related fields), and WITH_EDITORONLY_DATA used for fields(except cases when that fields needs some strictly related methods, for example Getter/Setter).

1 Like