@VictorLerp
[USER=“9”]Stephen Ellis[/USER]
[USER=“4894”]Tim Hobson[/USER]
In case Python scripting team is still in trouble with this:
I have solved this problem on MagicNode plugin with custom serialization of pin type info to a temp *.node * file stored into project’s Intermediate folder.
Then in node’s Reconstruct() function, I restore pin data once to a in-memory struct from the file IF a node compilation happened or when Editor just launched.
I do the call to read the file from within “CreatePinsForScript()” in a case like this. Node is reconstructed successfully even though there isn’t any real UFunction existing at the time Unreal Editor is booting and Python nodes must be reconstructed… Blueprint serialization happens much later, so when the editor is finished launching, all serialized values are set back onto Pin->DefaultValue as if the pin always existed.
All hail the Json struct serializer:
void UKCS_MagicNode::PostReconstructNode()
{
Super::PostReconstructNode();
AllocateDefaultPins();
CreatePinsForScript(GetScriptSource());
}
“ScriptData” is the struct that was loaded from file at Editor startup, then I convert it back to pins:
Script->LoadIntermediateData(); // <-- reads pin type info from file into a struct..
for (auto Info : Script->GetScriptData().PropertyInfo)
{
if ( Info.ParamType == EParamType::Input )
{
if ( FindPin(Info.Name) == nullptr )
{
if ( UEdGraphPin * Pin = CreatePin( EGPD_Input, NAME_None, Info.Name ))
{
SetPinArchetype( Pin, Info.DataType );
NewClassPins.Add( Pin );
///... ...
}
}
K2_Schema->SetPinAutogeneratedDefaultValue( FindPin( Info.Name ), Info.DefaultValue );