Hi, I’m creating a plugin where I want to use the Graph Editor. It all works great but now I want to customize the actual nodes. I’m completely stuck at trying to create the SGraphNode object.
Here’s my code:
Header:
#include "CoreMinimal.h"
#include "EdGraph/EdGraphNode.h"
#include "EdGraph/EdGraphPin.h"
#include "SGraphNode.h"
class SDialogGraphNodeWidget : public SGraphNode
{
public:
SLATE_BEGIN_ARGS(SDialogGraphNodeWidget)
{}
SLATE_END_ARGS()
void Construct(const FArguments& inArgs, UEdGraphNode* inNode);
};
cpp:
#include "DialogGraph/DialogGraphNodeWidget.h"
void SDialogGraphNodeWidget::Construct(const FArguments& inArgs, UEdGraphNode* inNode)
{
// What do I put here?????????
}
I’m at a complete loss at what to put in the definition. All of the places I have looked suggest something like this:
Super::Construct(Super::FArguments(), inNode);
No matter what I try I get error like these:
0>SGraphPanel.h(92): Warning C4263 : 'void SGraphPanel::Construct(const SGraphPanel::FArguments &)': member function does not override any base class virtual member function
0>SGraphPanel.h(334): Warning C4264 : 'void SNodePanel::Construct(void)': no override available for virtual member function from base 'SNodePanel'; function is hidden
0>SNodePanel.h(713): Reference C4264 : see declaration of 'SNodePanel::Construct'
0>SNodePanel.h(265): Reference C4264 : see declaration of 'SNodePanel'
0>DialogGraphNodeWidget.h(18): Warning C4263 : 'void SDialogGraphNodeWidget::Construct(const SDialogGraphNodeWidget::FArguments &,UEdGraphNode *)': member function does not override any base class virtual member function
0>DialogGraphNodeWidget.h(19): Warning C4264 : 'void SPanel::Construct(void)': no override available for virtual member function from base 'SPanel'; function is hidden
0>SPanel.h(59): Reference C4264 : see declaration of 'SPanel::Construct'
0>SPanel.h(22): Reference C4264 : see declaration of 'SPanel'
[2/4] UE4Editor-DialogEditor.lib
Creating library C:\Users\Sarlack\Documents\Unreal Projects\RPGFrameworkV2\Plugins\DialogEditor\Intermediate\Build\Win64\UE4Editor\Development\DialogEditor\UE4Editor-DialogEditor.lib and object C:\Users\Sarlack\Documents\Unreal Projects\RPGFrameworkV2\Plugins\DialogEditor\Intermediate\Build\Win64\UE4Editor\Development\DialogEditor\UE4Editor-DialogEditor.exp
[3/4] UE4Editor-DialogEditor.dll
Creating library C:\Users\Sarlack\Documents\Unreal Projects\RPGFrameworkV2\Plugins\DialogEditor\Intermediate\Build\Win64\UE4Editor\Development\DialogEditor\UE4Editor-DialogEditor.suppressed.lib and object C:\Users\Sarlack\Documents\Unreal Projects\RPGFrameworkV2\Plugins\DialogEditor\Intermediate\Build\Win64\UE4Editor\Development\DialogEditor\UE4Editor-DialogEditor.suppressed.exp
0>Module.DialogEditor.cpp.obj: Error LNK2019 : unresolved external symbol "__declspec(dllimport) public: static struct FSlateBrush const * __cdecl FEditorStyle::GetBrush(class FName,char const *)" (__imp_?GetBrush@FEditorStyle@@SAPEBUFSlateBrush@@VFName@@PEBD@Z) referenced in function "public: virtual struct FSlateBrush const * __cdecl SNodePanel::SNode::GetShadowBrush(bool)const " (?GetShadowBrush@SNode@SNodePanel@@UEBAPEBUFSlateBrush@@_N@Z)
Hint on symbols that are defined and could potentially match:
"__declspec(dllimport) public: virtual struct FSlateBrush const * __cdecl FSlateStyleSet::GetBrush(class FName,char const *)const " (__imp_?GetBrush@FSlateStyleSet@@UEBAPEBUFSlateBrush@@VFName@@PEBD@Z)
0>Module.DialogEditor.cpp.obj: Error LNK2001 : unresolved external symbol "public: virtual void __cdecl SPanel::Construct(void)" (?Construct@SPanel@@UEAAXXZ)
0>UE4Editor-DialogEditor.dll: Error LNK1120 : 2 unresolved externals
0>Microsoft.MakeFile.Targets(44,5): Error MSB3073 : The command ""C:\Program Files\Epic Games\UE_4.27\Engine\Build\BatchFiles\Build.bat" RPGFrameworkV2Editor Win64 Development -Project="C:\Users\Sarlack\Documents\Unreal Projects\RPGFrameworkV2\RPGFrameworkV2.uproject" -WaitMutex -FromMsBuild" exited with code 6.
Which suggest some missing implementation. There’s literally zero documentation about this anywhere on the internet and only a scarce few people (like 2 people) have actually written about this topic, from an extensive search on google.
Can someone please nudge me in the right direction?
I tried some more. For a moment I was allowed to use
void Construct() override;
which I think is the proper one? But now I get this error:
0>SGraphPanel.h(92): Warning C4263 : 'void SGraphPanel::Construct(const SGraphPanel::FArguments &)': member function does not override any base class virtual member function
0>SGraphPanel.h(334): Warning C4264 : 'void SNodePanel::Construct(void)': no override available for virtual member function from base 'SNodePanel'; function is hidden
0>SNodePanel.h(713): Reference C4264 : see declaration of 'SNodePanel::Construct'
0>SNodePanel.h(265): Reference C4264 : see declaration of 'SNodePanel'
[3/5] UE4Editor-DialogEditor.lib
Creating library C:\Users\Sarlack\Documents\Unreal Projects\RPGFrameworkV2\Plugins\DialogEditor\Intermediate\Build\Win64\UE4Editor\Development\DialogEditor\UE4Editor-DialogEditor.lib and object C:\Users\Sarlack\Documents\Unreal Projects\RPGFrameworkV2\Plugins\DialogEditor\Intermediate\Build\Win64\UE4Editor\Development\DialogEditor\UE4Editor-DialogEditor.exp
[4/5] UE4Editor-DialogEditor.dll
Creating library C:\Users\Sarlack\Documents\Unreal Projects\RPGFrameworkV2\Plugins\DialogEditor\Intermediate\Build\Win64\UE4Editor\Development\DialogEditor\UE4Editor-DialogEditor.suppressed.lib and object C:\Users\Sarlack\Documents\Unreal Projects\RPGFrameworkV2\Plugins\DialogEditor\Intermediate\Build\Win64\UE4Editor\Development\DialogEditor\UE4Editor-DialogEditor.suppressed.exp
0>Module.DialogEditor.cpp.obj: Error LNK2001 : unresolved external symbol "public: virtual void __cdecl SPanel::Construct(void)" (?Construct@SPanel@@UEAAXXZ)
0>UE4Editor-DialogEditor.dll: Error LNK1120 : 1 unresolved externals
0>Microsoft.MakeFile.Targets(44,5): Error MSB3073 : The command ""C:\Program Files\Epic Games\UE_4.27\Engine\Build\BatchFiles\Build.bat" RPGFrameworkV2Editor Win64 Development -Project="C:\Users\Sarlack\Documents\Unreal Projects\RPGFrameworkV2\RPGFrameworkV2.uproject" -WaitMutex -FromMsBuild" exited with code 6.
I looked into the SGraphNode source and it has no Construct function. SNodePanel (the parent class), does though and that function looks like I just described above. It still doesn’t work. This is driving me nuts. The error messages doesn’t really help much because they tell me something is wrong somewhere, but not what the problem is with my code. Unresolved external can have like 20 different causes and it doesn’t tell me what it is?
This is super weird.
SGraphNode have no Construc()
The definition in SPanel.h looks like:
/**
* Most panels do not create widgets as part of their implementation, so
* they do not need to implement a Construct()
*/
virtual void Construct() { }
I have tried (the EXACT same definition):
virtual void Construct() override;
with this in .cpp
void SDialogGraphNodeWidget::Construct()
{
SGraphNode::Construct();
}
I have also tried:
virtual void Construct() override {}
I have all of this in my dependencies:
"CoreUObject",
"Engine",
"Slate",
"SlateCore",
"DialogRuntime",
"AssetTools",
"UnrealEd",
"PropertyEditor",
"Projects",
"ToolMenus",
"GraphEditor",
"BlueprintGraph"
None of this works. Why?
These two errors make it seem like there are two definitions that I need to take into account:
0>SGraphPanel.h(92): Warning C4263 : 'void SGraphPanel::Construct(const SGraphPanel::FArguments &)': member function does not override any base class virtual member function0>SGraphPanel.h(334): Warning C4264 : 'void SNodePanel::Construct(void)': no override available for virtual member function from base 'SNodePanel'; function is hidden
But I can only use one definition in my class. What do they mean the function is hidden? From what? Why does the compiler complain to me that SGraphPanel can’t override something in their base class? Why should I care?
I think this is a bug in the source code. I’m absolutely convinced of that. I guess I’ll just give up on this and do something else with my time. Absolutely horrible stuff.
Ok I found the “solution”. This is mind boggling. For some godforsaken reason, the context menu in Rider had a “suggestion” to change the signature of SPanel::Construct from void Construct() to virtual void Construct(). That completely blew up the whole compilation and gave me that weird error.
I only found out about it by going into the history of the engine source code and there it was, some change to the source from three hours ago that the IDE didn’t warn me about. Crazy stuff.
So, in a way I was right that it was the engine source code that was faulty. Just not in the way I thought.