Fix format text serialization, LineTrace node name

This commit is contained in:
barsdeveloper
2023-04-23 15:43:57 +02:00
parent 26a4419a2a
commit bf1a5ca65c
10 changed files with 377 additions and 211 deletions

View File

@@ -258,6 +258,89 @@ const tests = [
delegate: false,
development: false,
},
{
name: "Line Trace For Objects",
value: String.raw`
Begin Object Class=/Script/BlueprintGraph.K2Node_CallFunction Name="K2Node_CallFunction_8"
FunctionReference=(MemberParent=/Script/CoreUObject.Class'"/Script/Engine.KismetSystemLibrary"',MemberName="LineTraceSingleForObjects")
NodePosX=-208
NodePosY=-352
AdvancedPinDisplay=Shown
ErrorType=1
NodeGuid=3EE71DDB1BD944DE961519875B895319
CustomProperties Pin (PinId=96A094494D762C998E774ABB929EB41C,PinName="execute",PinToolTip="\nExec",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=718E43E94384B5B10074D6BD04E74488,PinName="then",PinToolTip="\nExec",Direction="EGPD_Output",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=0DB3EEE24A4161EE635A9A9D33EC9512,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "Target", "Target"),PinToolTip="Target\nKismet System Library Object Reference",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.Class'"/Script/Engine.KismetSystemLibrary"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultObject="/Script/Engine.Default__KismetSystemLibrary",PersistentGuid=00000000000000000000000000000000,bHidden=True,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=124D88C54AF09D670C3A42A2576E8454,PinName="WorldContextObject",PinToolTip="World Context Object\nObject Reference",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.Class'"/Script/CoreUObject.Object"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=True,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=True,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=9884A8D5423FB15AE0A4ECA2C08F258E,PinName="Start",PinToolTip="Start\nVector\n\nStart of line segment.",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/CoreUObject.Vector"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=True,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="0, 0, 0",AutogeneratedDefaultValue="0, 0, 0",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=A4C186FF494EFAF15578EF9A0453DB39,PinName="End",PinToolTip="End\nVector\n\nEnd of line segment.",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/CoreUObject.Vector"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=True,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="0, 0, 0",AutogeneratedDefaultValue="0, 0, 0",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=4BED576E40A832A6F31237AEFBACBB71,PinName="ObjectTypes",PinToolTip="Object Types\nArray of EObjectTypeQuery Enums\n\nArray of Object Types to trace",PinType.PinCategory="byte",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.Enum'"/Script/Engine.EObjectTypeQuery"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=Array,PinType.bIsReference=True,PinType.bIsConst=True,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="ObjectTypeQuery1",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=True,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=A8296F984AFE64743DAB3E897CC3DF47,PinName="bTraceComplex",PinToolTip="Trace Complex\nBoolean\n\nTrue to test against complex collision, false to test against simplified collision.",PinType.PinCategory="bool",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="false",AutogeneratedDefaultValue="false",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=A19DB65F47B607A3AAF50EA382815B7D,PinName="ActorsToIgnore",PinToolTip="Actors to Ignore\nArray of Actor Object References",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.Class'"/Script/Engine.Actor"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=Array,PinType.bIsReference=True,PinType.bIsConst=True,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=True,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=A3E482A7474A05E0E58F6AAA6E4734CD,PinName="DrawDebugType",PinToolTip="Draw Debug Type\nEDrawDebugTrace Enum",PinType.PinCategory="byte",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.Enum'"/Script/Engine.EDrawDebugTrace"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="ForOneFrame",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=FE2B25154C824BB9EAF9E9A2ADA5943E,PinName="OutHit",PinToolTip="Out Hit\nHit Result Structure\n\nProperties of the trace hit.",Direction="EGPD_Output",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/Engine.HitResult"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,SubPins=(K2Node_CallFunction_8 D06FD3BB41F114BBF8C89DB38EAC0761,K2Node_CallFunction_8 B45FC53E42E98D2933D7A6A33722F4D8,K2Node_CallFunction_8 4DB0E6CC46E5A3C80AC6C1A5FA3E5129,K2Node_CallFunction_8 3A3C030840A593D2D379B2B716F271AB,K2Node_CallFunction_8 4466B24F480077A3458BF49C92FC9BAA,K2Node_CallFunction_8 F25B18164D6964B12DFEABADDB74919E,K2Node_CallFunction_8 71CB4433415AB77E32B1709BBD6573C4,K2Node_CallFunction_8 7AA02A024FF3C7D1429BE89272EB95A9,K2Node_CallFunction_8 4520C8C14542EBD0F7E6F49B25374A3A,K2Node_CallFunction_8 0D36352148C729A423CAD69546B499D3,K2Node_CallFunction_8 70B373F6489AD4ACF61A95BA7D172DA8,K2Node_CallFunction_8 70B601B342FDB51653A3069BE9ED80C1,K2Node_CallFunction_8 B0B9765C4B5539AC163A42B1C71EB743,K2Node_CallFunction_8 64F90D394DB9CA34EB4EA09AFF22C35B,K2Node_CallFunction_8 421966B241843C5AC06C179E9FDCBF59,K2Node_CallFunction_8 F2AC86054C34D620A396B48266CE6555,K2Node_CallFunction_8 C6128AA849ED10F1A91BB78A480187B4,K2Node_CallFunction_8 0624877E4E2FE8DEFAD2BB848F637811,),PersistentGuid=00000000000000000000000000000000,bHidden=True,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=D06FD3BB41F114BBF8C89DB38EAC0761,PinName="OutHit_bBlockingHit",PinFriendlyName=LOCGEN_FORMAT_NAMED(NSLOCTEXT("KismetSchema", "SplitPinFriendlyNameFormat", "{PinDisplayName} {ProtoPinDisplayName}"), "PinDisplayName", "Out Hit", "ProtoPinDisplayName", "Blocking Hit"),PinToolTip="Out Hit Blocking Hit\nBoolean",Direction="EGPD_Output",PinType.PinCategory="bool",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="false",AutogeneratedDefaultValue="false",ParentPin=K2Node_CallFunction_8 FE2B25154C824BB9EAF9E9A2ADA5943E,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=B45FC53E42E98D2933D7A6A33722F4D8,PinName="OutHit_bInitialOverlap",PinFriendlyName=LOCGEN_FORMAT_NAMED(NSLOCTEXT("KismetSchema", "SplitPinFriendlyNameFormat", "{PinDisplayName} {ProtoPinDisplayName}"), "PinDisplayName", "Out Hit", "ProtoPinDisplayName", "Initial Overlap"),PinToolTip="Out Hit Initial Overlap\nBoolean",Direction="EGPD_Output",PinType.PinCategory="bool",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="false",AutogeneratedDefaultValue="false",ParentPin=K2Node_CallFunction_8 FE2B25154C824BB9EAF9E9A2ADA5943E,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=4DB0E6CC46E5A3C80AC6C1A5FA3E5129,PinName="OutHit_Time",PinFriendlyName=LOCGEN_FORMAT_NAMED(NSLOCTEXT("KismetSchema", "SplitPinFriendlyNameFormat", "{PinDisplayName} {ProtoPinDisplayName}"), "PinDisplayName", "Out Hit", "ProtoPinDisplayName", "Time"),PinToolTip="Out Hit Time\nFloat (single-precision)",Direction="EGPD_Output",PinType.PinCategory="real",PinType.PinSubCategory="float",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="0.0",AutogeneratedDefaultValue="0.0",ParentPin=K2Node_CallFunction_8 FE2B25154C824BB9EAF9E9A2ADA5943E,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=3A3C030840A593D2D379B2B716F271AB,PinName="OutHit_Distance",PinFriendlyName=LOCGEN_FORMAT_NAMED(NSLOCTEXT("KismetSchema", "SplitPinFriendlyNameFormat", "{PinDisplayName} {ProtoPinDisplayName}"), "PinDisplayName", "Out Hit", "ProtoPinDisplayName", "Distance"),PinToolTip="Out Hit Distance\nFloat (single-precision)",Direction="EGPD_Output",PinType.PinCategory="real",PinType.PinSubCategory="float",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="0.0",AutogeneratedDefaultValue="0.0",ParentPin=K2Node_CallFunction_8 FE2B25154C824BB9EAF9E9A2ADA5943E,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=4466B24F480077A3458BF49C92FC9BAA,PinName="OutHit_Location",PinFriendlyName=LOCGEN_FORMAT_NAMED(NSLOCTEXT("KismetSchema", "SplitPinFriendlyNameFormat", "{PinDisplayName} {ProtoPinDisplayName}"), "PinDisplayName", "Out Hit", "ProtoPinDisplayName", "Location"),PinToolTip="Out Hit Location\nVector",Direction="EGPD_Output",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/CoreUObject.Vector"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="0, 0, 0",AutogeneratedDefaultValue="0, 0, 0",ParentPin=K2Node_CallFunction_8 FE2B25154C824BB9EAF9E9A2ADA5943E,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=F25B18164D6964B12DFEABADDB74919E,PinName="OutHit_ImpactPoint",PinFriendlyName=LOCGEN_FORMAT_NAMED(NSLOCTEXT("KismetSchema", "SplitPinFriendlyNameFormat", "{PinDisplayName} {ProtoPinDisplayName}"), "PinDisplayName", "Out Hit", "ProtoPinDisplayName", "Impact Point"),PinToolTip="Out Hit Impact Point\nVector",Direction="EGPD_Output",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/CoreUObject.Vector"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="0, 0, 0",AutogeneratedDefaultValue="0, 0, 0",ParentPin=K2Node_CallFunction_8 FE2B25154C824BB9EAF9E9A2ADA5943E,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=71CB4433415AB77E32B1709BBD6573C4,PinName="OutHit_Normal",PinFriendlyName=LOCGEN_FORMAT_NAMED(NSLOCTEXT("KismetSchema", "SplitPinFriendlyNameFormat", "{PinDisplayName} {ProtoPinDisplayName}"), "PinDisplayName", "Out Hit", "ProtoPinDisplayName", "Normal"),PinToolTip="Out Hit Normal\nVector",Direction="EGPD_Output",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/CoreUObject.Vector"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="0, 0, 0",AutogeneratedDefaultValue="0, 0, 0",ParentPin=K2Node_CallFunction_8 FE2B25154C824BB9EAF9E9A2ADA5943E,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=7AA02A024FF3C7D1429BE89272EB95A9,PinName="OutHit_ImpactNormal",PinFriendlyName=LOCGEN_FORMAT_NAMED(NSLOCTEXT("KismetSchema", "SplitPinFriendlyNameFormat", "{PinDisplayName} {ProtoPinDisplayName}"), "PinDisplayName", "Out Hit", "ProtoPinDisplayName", "Impact Normal"),PinToolTip="Out Hit Impact Normal\nVector",Direction="EGPD_Output",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/CoreUObject.Vector"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="0, 0, 0",AutogeneratedDefaultValue="0, 0, 0",ParentPin=K2Node_CallFunction_8 FE2B25154C824BB9EAF9E9A2ADA5943E,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=4520C8C14542EBD0F7E6F49B25374A3A,PinName="OutHit_PhysMat",PinFriendlyName=LOCGEN_FORMAT_NAMED(NSLOCTEXT("KismetSchema", "SplitPinFriendlyNameFormat", "{PinDisplayName} {ProtoPinDisplayName}"), "PinDisplayName", "Out Hit", "ProtoPinDisplayName", "Phys Mat"),PinToolTip="Out Hit Phys Mat\nPhysical Material Object Reference",Direction="EGPD_Output",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.Class'"/Script/PhysicsCore.PhysicalMaterial"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,ParentPin=K2Node_CallFunction_8 FE2B25154C824BB9EAF9E9A2ADA5943E,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=0D36352148C729A423CAD69546B499D3,PinName="OutHit_HitActor",PinFriendlyName=LOCGEN_FORMAT_NAMED(NSLOCTEXT("KismetSchema", "SplitPinFriendlyNameFormat", "{PinDisplayName} {ProtoPinDisplayName}"), "PinDisplayName", "Out Hit", "ProtoPinDisplayName", "Hit Actor"),PinToolTip="Out Hit Hit Actor\nActor Object Reference",Direction="EGPD_Output",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.Class'"/Script/Engine.Actor"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,ParentPin=K2Node_CallFunction_8 FE2B25154C824BB9EAF9E9A2ADA5943E,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=70B373F6489AD4ACF61A95BA7D172DA8,PinName="OutHit_HitComponent",PinFriendlyName=LOCGEN_FORMAT_NAMED(NSLOCTEXT("KismetSchema", "SplitPinFriendlyNameFormat", "{PinDisplayName} {ProtoPinDisplayName}"), "PinDisplayName", "Out Hit", "ProtoPinDisplayName", "Hit Component"),PinToolTip="Out Hit Hit Component\nPrimitive Component Object Reference",Direction="EGPD_Output",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.Class'"/Script/Engine.PrimitiveComponent"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,ParentPin=K2Node_CallFunction_8 FE2B25154C824BB9EAF9E9A2ADA5943E,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=70B601B342FDB51653A3069BE9ED80C1,PinName="OutHit_HitBoneName",PinFriendlyName=LOCGEN_FORMAT_NAMED(NSLOCTEXT("KismetSchema", "SplitPinFriendlyNameFormat", "{PinDisplayName} {ProtoPinDisplayName}"), "PinDisplayName", "Out Hit", "ProtoPinDisplayName", "Hit Bone Name"),PinToolTip="Out Hit Hit Bone Name\nName",Direction="EGPD_Output",PinType.PinCategory="name",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="None",AutogeneratedDefaultValue="None",ParentPin=K2Node_CallFunction_8 FE2B25154C824BB9EAF9E9A2ADA5943E,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=B0B9765C4B5539AC163A42B1C71EB743,PinName="OutHit_BoneName",PinFriendlyName=LOCGEN_FORMAT_NAMED(NSLOCTEXT("KismetSchema", "SplitPinFriendlyNameFormat", "{PinDisplayName} {ProtoPinDisplayName}"), "PinDisplayName", "Out Hit", "ProtoPinDisplayName", "Bone Name"),PinToolTip="Out Hit Bone Name\nName",Direction="EGPD_Output",PinType.PinCategory="name",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="None",AutogeneratedDefaultValue="None",ParentPin=K2Node_CallFunction_8 FE2B25154C824BB9EAF9E9A2ADA5943E,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=64F90D394DB9CA34EB4EA09AFF22C35B,PinName="OutHit_HitItem",PinFriendlyName=LOCGEN_FORMAT_NAMED(NSLOCTEXT("KismetSchema", "SplitPinFriendlyNameFormat", "{PinDisplayName} {ProtoPinDisplayName}"), "PinDisplayName", "Out Hit", "ProtoPinDisplayName", "Hit Item"),PinToolTip="Out Hit Hit Item\nInteger",Direction="EGPD_Output",PinType.PinCategory="int",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="0",AutogeneratedDefaultValue="0",ParentPin=K2Node_CallFunction_8 FE2B25154C824BB9EAF9E9A2ADA5943E,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=421966B241843C5AC06C179E9FDCBF59,PinName="OutHit_ElementIndex",PinFriendlyName=LOCGEN_FORMAT_NAMED(NSLOCTEXT("KismetSchema", "SplitPinFriendlyNameFormat", "{PinDisplayName} {ProtoPinDisplayName}"), "PinDisplayName", "Out Hit", "ProtoPinDisplayName", "Element Index"),PinToolTip="Out Hit Element Index\nInteger",Direction="EGPD_Output",PinType.PinCategory="int",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="0",AutogeneratedDefaultValue="0",ParentPin=K2Node_CallFunction_8 FE2B25154C824BB9EAF9E9A2ADA5943E,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=F2AC86054C34D620A396B48266CE6555,PinName="OutHit_FaceIndex",PinFriendlyName=LOCGEN_FORMAT_NAMED(NSLOCTEXT("KismetSchema", "SplitPinFriendlyNameFormat", "{PinDisplayName} {ProtoPinDisplayName}"), "PinDisplayName", "Out Hit", "ProtoPinDisplayName", "Face Index"),PinToolTip="Out Hit Face Index\nInteger",Direction="EGPD_Output",PinType.PinCategory="int",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="0",AutogeneratedDefaultValue="0",ParentPin=K2Node_CallFunction_8 FE2B25154C824BB9EAF9E9A2ADA5943E,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=C6128AA849ED10F1A91BB78A480187B4,PinName="OutHit_TraceStart",PinFriendlyName=LOCGEN_FORMAT_NAMED(NSLOCTEXT("KismetSchema", "SplitPinFriendlyNameFormat", "{PinDisplayName} {ProtoPinDisplayName}"), "PinDisplayName", "Out Hit", "ProtoPinDisplayName", "Trace Start"),PinToolTip="Out Hit Trace Start\nVector",Direction="EGPD_Output",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/CoreUObject.Vector"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="0, 0, 0",AutogeneratedDefaultValue="0, 0, 0",ParentPin=K2Node_CallFunction_8 FE2B25154C824BB9EAF9E9A2ADA5943E,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=0624877E4E2FE8DEFAD2BB848F637811,PinName="OutHit_TraceEnd",PinFriendlyName=LOCGEN_FORMAT_NAMED(NSLOCTEXT("KismetSchema", "SplitPinFriendlyNameFormat", "{PinDisplayName} {ProtoPinDisplayName}"), "PinDisplayName", "Out Hit", "ProtoPinDisplayName", "Trace End"),PinToolTip="Out Hit Trace End\nVector",Direction="EGPD_Output",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/CoreUObject.Vector"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="0, 0, 0",AutogeneratedDefaultValue="0, 0, 0",ParentPin=K2Node_CallFunction_8 FE2B25154C824BB9EAF9E9A2ADA5943E,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=297204E248B1AE9336367F9F0A184BC8,PinName="bIgnoreSelf",PinToolTip="Ignore Self\nBoolean",PinType.PinCategory="bool",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="true",AutogeneratedDefaultValue="true",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=DAB5394745AA51AAE6033EB7CCF1C095,PinName="TraceColor",PinToolTip="Trace Color\nLinear Color Structure",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/CoreUObject.LinearColor"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="(R=1.000000,G=0.000000,B=0.000000,A=1.000000)",AutogeneratedDefaultValue="(R=1.000000,G=0.000000,B=0.000000,A=1.000000)",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=True,bOrphanedPin=False,)
CustomProperties Pin (PinId=8CD5CC5E4F927E9CBBFF58B0872C0546,PinName="TraceHitColor",PinToolTip="Trace Hit Color\nLinear Color Structure",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/CoreUObject.LinearColor"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="(R=0.000000,G=1.000000,B=0.000000,A=1.000000)",AutogeneratedDefaultValue="(R=0.000000,G=1.000000,B=0.000000,A=1.000000)",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=True,bOrphanedPin=False,)
CustomProperties Pin (PinId=FB76ED6F40844C82A75DA4A4A5A73820,PinName="DrawTime",PinToolTip="Draw Time\nFloat (single-precision)",PinType.PinCategory="real",PinType.PinSubCategory="float",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="5.000000",AutogeneratedDefaultValue="5.000000",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=True,bOrphanedPin=False,)
CustomProperties Pin (PinId=54F6EF174A02D88C99CAFFBCF1E05B6E,PinName="ReturnValue",PinToolTip="Return Value\nBoolean\n\nTrue if there was a hit, false otherwise.",Direction="EGPD_Output",PinType.PinCategory="bool",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="false",AutogeneratedDefaultValue="false",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
`,
color: Configuration.nodeColors.blue,
icon: SVGIcon.functionSymbol,
pins: 31,
pinNames: [
"Start",
"End",
"Object Types",
"Trace Complex",
"Actors to Ignore",
"Draw Debug Type",
"Ignore Self",
"Trace Color",
"Trace Hit Color",
"Draw Time",
"Out Hit Blocking Hit",
"Out Hit Initial Overlap",
"Out Hit Time",
"Out Hit Distance",
"Out Hit Location",
"Out Hit Impact Point",
"Out Hit Normal",
"Out Hit Impact Normal",
"Out Hit Phys Mat",
"Out Hit Hit Actor",
"Out Hit Hit Component",
"Out Hit Hit Bone Name",
"Out Hit Bone Name",
"Out Hit Hit Item",
"Out Hit Element Index",
"Out Hit Face Index",
"Out Hit Trace Start",
"Out Hit Trace End",
"Return Value",
],
delegate: false,
development: false,
},
]
/** @type {Blueprint} */

View File

@@ -1,5 +1,6 @@
/// <reference types="cypress" />
import FormatTextEntity from "../../js/entity/FormatTextEntity.js"
import Grammar from "../../js/serialization/Grammar.js"
import GuidEntity from "../../js/entity/GuidEntity.js"
import initializeSerializerFactory from "../../js/serialization/initializeSerializerFactory.js"
@@ -28,6 +29,51 @@ describe("Serializer", () => {
it("Parses False", () => expect(serializer.read("False")).to.be.false)
})
context("FormatTextEntity", () => {
let serializer = SerializerFactory.getSerializer(FormatTextEntity)
it("Test 1", () => expect(
serializer.read(`LOCGEN_FORMAT_NAMED(NSLOCTEXT("KismetSchema", "SplitPinFriendlyNameFormat", "{PinDisplayName} {ProtoPinDisplayName}"), "PinDisplayName", "Out Hit", "ProtoPinDisplayName", "Blocking Hit")`)
.toString()
).to.be.equal("Out Hit Blocking Hit"))
it("Test 2", () => expect(
serializer.read(`LOCGEN_FORMAT_NAMED(NSLOCTEXT("KismetSchema", "SplitPinFriendlyNameFormat", "{PinDisplayName} {ProtoPinDisplayName}"), "PinDisplayName", "Out Hit", "ProtoPinDisplayName", "Hit Bone Name")`)
.toString()
).to.be.equal("Out Hit Hit Bone Name"))
})
context("GuidEntity", () => {
let serializer = SerializerFactory.getSerializer(GuidEntity)
it("Parses 0556a3ecabf648d0a5c07b2478e9dd32", () =>
expect(serializer.read("0556a3ecabf648d0a5c07b2478e9dd32"))
.to.be.instanceOf(GuidEntity)
.and.property("value").to.be.equal("0556a3ecabf648d0a5c07b2478e9dd32")
)
it("Parses 64023BC344E0453DBB583FAC411489BC", () =>
expect(serializer.read("64023BC344E0453DBB583FAC411489BC"))
.to.be.instanceOf(GuidEntity)
.and.property("value").to.be.equal("64023BC344E0453DBB583FAC411489BC")
)
it("Parses 6edC4a425ca948da8bC78bA52DED6C6C", () =>
expect(serializer.read("6edC4a425ca948da8bC78bA52DED6C6C"))
.to.be.instanceOf(GuidEntity)
.and.property("value").to.be.equal("6edC4a425ca948da8bC78bA52DED6C6C")
)
it("Throws when finding space", () =>
expect(() => serializer.read("172087193 9B04362973544B3564FDB2C"))
.to.throw()
)
it("Throws when shorter by 1", () =>
expect(() => serializer.read("E25F14F8F3E9441AB07153E7DA2BA2B"))
.to.throw()
)
it("Throws when longer by 1", () =>
expect(() => serializer.read("A78988B0097E48418C8CB87EC5A67ABF7"))
.to.throw()
)
})
context("IntegerEntity", () => {
let serializer = SerializerFactory.getSerializer(IntegerEntity)
@@ -62,33 +108,6 @@ describe("Serializer", () => {
it("Throws when not an integer", () => expect(() => serializer.read("1.2").value).to.throw())
})
context("Number", () => {
let serializer = SerializerFactory.getSerializer(Number)
it("Parses 0", () => expect(serializer.read("0")).to.be.approximately(0, 0.00001))
it("Parses +0", () => expect(serializer.read("+0")).to.be.approximately(0, 0.00001))
it("Parses -0", () => expect(serializer.read("-0")).to.be.approximately(0, 0.00001))
it("Parses 5", () => expect(serializer.read("5")).to.be.approximately(5, 0.00001))
it("Parses 0.05", () => expect(serializer.read("0.05")).to.be.approximately(0.05, 0.00001))
it("Parses -999.666", () => expect(serializer.read("-999.666")).to.be.approximately(-999.666, 0.001))
it("Parses +45.4545", () => expect(serializer.read("+45.4545")).to.be.approximately(45.4545, 0.001))
it("Parses +1000000000", () => expect(serializer.read("+1000000000")).to.be.approximately(1E9, 0.1))
it("Throws when not numeric", () => expect(() => serializer.read("alpha")).to.throw())
})
context("String", () => {
let serializer = SerializerFactory.getSerializer(String)
it('Parses ""', () => expect(serializer.read('""')).to.be.equal(""))
it('Parses "hello"', () => expect(serializer.read('"hello"')).to.be.equal("hello"))
it('Parses "hello world 123 - éèàò@ç ^ ^^^"', () =>
expect(serializer.read('"hello world 123 - éèàò@ç ^ ^^^"'))
.to.be.equal("hello world 123 - éèàò@ç ^ ^^^")
)
it('Parses "\\""', () => expect(serializer.read('"\\""')).to.be.equal('"'))
it('Throws when not a string', () => expect(() => serializer.read("Hello")).to.throw())
})
context("KeyBindingEntity", () => {
let serializer = SerializerFactory.getSerializer(KeyBindingEntity)
@@ -114,6 +133,70 @@ describe("Serializer", () => {
)
})
context("LinearColorEntity", () => {
let serializer = SerializerFactory.getSerializer(LinearColorEntity)
it("check white color", () => {
const result = LinearColorEntity.getWhite()
expect(result.toRGBA()).to.be.deep.equal([255, 255, 255, 255])
expect(result.toRGBAString()).to.be.equal("FFFFFFFF")
expect(result.toNumber()).to.be.equal(-1)
expect(result.toHSVA()).to.be.deep.equal([0, 0, 1, 1])
})
it("Parses red color", () => {
const result = serializer.read("(R=1,G=0,B=0)")
expect(result.toRGBA()).to.be.deep.equal([255, 0, 0, 255])
expect(result.toRGBAString()).to.be.equal("FF0000FF")
expect(result.toNumber()).to.be.equal(-16776961)
expect(result.toHSVA()).to.be.deep.equal([0, 1, 1, 1])
})
it("Parses simple color", () => {
const result = serializer.read("(R=0.000000,G=0.660000,B=1.000000,A=1.000000)")
expect(result.toRGBA()).to.be.deep.equal([0, 168, 255, 255])
expect(result.toRGBAString()).to.be.equal("00A8FFFF")
expect(result.toNumber()).to.be.equal(11075583)
expect(result.toHSVA()).to.be.deep.equal([0.55666666666666666666, 1, 1, 1])
})
it("Parses wrong order keys", () => {
const result = serializer.read("(B=0.04394509003266556,G=0.026789300067696642,A=0.83663232408635,R=0.6884158028074934,)")
expect(result.toRGBA()).to.be.deep.equal([176, 7, 11, 213])
expect(result.toRGBAString()).to.be.equal("B0070BD5")
expect(result.toNumber()).to.be.equal(-1341715499)
expect(result.toHSVA().map(v => Utility.roundDecimals(v, 3))).to.be.deep.equal([0.996, 0.961, 0.688, 0.837])
})
it("Parses weird spaces", () => {
const result = serializer.read(`(
A = 0.327 ,
R=0.530 , G = 0.685
,B
= 0.9 ,)`)
expect(result.toRGBA()).to.be.deep.equal([135, 175, 230, 83])
expect(result.toRGBAString()).to.be.equal("87AFE653")
expect(result.toNumber()).to.be.equal(-2018515373)
expect(result.toHSVA().map(v => Utility.roundDecimals(v, 3))).to.be.deep.equal([0.597, 0.411, 0.9, 0.327])
})
it("Throws when missing an expected key", () => expect(() => serializer.read("(R=0.000000,G=0.660000,A=1.000000)"))
.to.throw()
)
it("Throws when unexpected types", () => expect(() => serializer.read("(R=0.000000,G=\"hello\",A=1.000000)"))
.to.throw()
)
})
context("Number", () => {
let serializer = SerializerFactory.getSerializer(Number)
it("Parses 0", () => expect(serializer.read("0")).to.be.approximately(0, 0.00001))
it("Parses +0", () => expect(serializer.read("+0")).to.be.approximately(0, 0.00001))
it("Parses -0", () => expect(serializer.read("-0")).to.be.approximately(0, 0.00001))
it("Parses 5", () => expect(serializer.read("5")).to.be.approximately(5, 0.00001))
it("Parses 0.05", () => expect(serializer.read("0.05")).to.be.approximately(0.05, 0.00001))
it("Parses -999.666", () => expect(serializer.read("-999.666")).to.be.approximately(-999.666, 0.001))
it("Parses +45.4545", () => expect(serializer.read("+45.4545")).to.be.approximately(45.4545, 0.001))
it("Parses +1000000000", () => expect(serializer.read("+1000000000")).to.be.approximately(1E9, 0.1))
it("Throws when not numeric", () => expect(() => serializer.read("alpha")).to.throw())
})
context("ObjectReferenceEntity", () => {
let serializer = SerializerFactory.getSerializer(ObjectReferenceEntity)
@@ -159,35 +242,86 @@ describe("Serializer", () => {
)
})
context("GuidEntity", () => {
let serializer = SerializerFactory.getSerializer(GuidEntity)
context("String", () => {
let serializer = SerializerFactory.getSerializer(String)
it("Parses 0556a3ecabf648d0a5c07b2478e9dd32", () =>
expect(serializer.read("0556a3ecabf648d0a5c07b2478e9dd32"))
.to.be.instanceOf(GuidEntity)
.and.property("value").to.be.equal("0556a3ecabf648d0a5c07b2478e9dd32")
it('Parses ""', () => expect(serializer.read('""')).to.be.equal(""))
it('Parses "hello"', () => expect(serializer.read('"hello"')).to.be.equal("hello"))
it('Parses "hello world 123 - éèàò@ç ^ ^^^"', () =>
expect(serializer.read('"hello world 123 - éèàò@ç ^ ^^^"'))
.to.be.equal("hello world 123 - éèàò@ç ^ ^^^")
)
it("Parses 64023BC344E0453DBB583FAC411489BC", () =>
expect(serializer.read("64023BC344E0453DBB583FAC411489BC"))
.to.be.instanceOf(GuidEntity)
.and.property("value").to.be.equal("64023BC344E0453DBB583FAC411489BC")
it('Parses "\\""', () => expect(serializer.read('"\\""')).to.be.equal('"'))
it('Throws when not a string', () => expect(() => serializer.read("Hello")).to.throw())
})
context("UnknownKeysValue", () => {
let parser = Grammar.unknownValue
it("Parses String", () => expect(parser.parse('"Hello"').value.constructor).equals(String))
it("Parses null", () => expect(parser.parse("()").value).to.be.null)
it("Parses Number", () => expect(parser.parse("8345").value.constructor).equals(Number))
it("Parses Boolean", () => expect(parser.parse("True").value.constructor).equals(Boolean))
it("Parses Boolean 2", () => expect(parser.parse("False").value.constructor).equals(Boolean))
it("Parses GuidEntity", () =>
expect(parser.parse("F0223D3742E67C0D9FEFB2A64946B7F0").value.constructor).equals(GuidEntity)
)
it("Parses 6edC4a425ca948da8bC78bA52DED6C6C", () =>
expect(serializer.read("6edC4a425ca948da8bC78bA52DED6C6C"))
.to.be.instanceOf(GuidEntity)
.and.property("value").to.be.equal("6edC4a425ca948da8bC78bA52DED6C6C")
it("Parses SymbolEntity", () => expect(parser.parse("SYMBOL1").value.constructor).equals(SymbolEntity))
it("Parses SymbolEntity 2", () => expect(parser.parse("Symbol_2_3_4").value.constructor).equals(SymbolEntity))
it("Parses Vector2DEntity", () =>
expect(parser.parse("(X=-0.495, Y=0, )").value.constructor).equals(Vector2DEntity)
)
it("Throws when finding space", () =>
expect(() => serializer.read("172087193 9B04362973544B3564FDB2C"))
.to.throw()
it("Parses VectorEntity", () =>
expect(parser.parse("(X=-0.495,Y=+765.0,Z=7)").value.constructor).equals(VectorEntity)
)
it("Throws when shorter by 1", () =>
expect(() => serializer.read("E25F14F8F3E9441AB07153E7DA2BA2B"))
.to.throw()
it("Parses RotatorEntity", () =>
expect(parser.parse("(R=1.000000,P=7.6,Y=+88.99)").value.constructor).equals(RotatorEntity)
)
it("Throws when longer by 1", () =>
expect(() => serializer.read("A78988B0097E48418C8CB87EC5A67ABF7"))
.to.throw()
it("Parses LinearColorEntity", () =>
expect(parser.parse("(R=0.000000,G=0.660000,B=1.000000,A=1.000000)").value.constructor)
.equals(LinearColorEntity)
)
it("Parses ObjectReferenceEntity", () =>
expect(parser.parse(`Class'"/Script/Engine.KismetSystemLibrary"'`).value.constructor)
.equals(ObjectReferenceEntity)
)
it("Parses Numbers array", () =>
expect(parser.parse("(1,2,3,4,5,6,7,8,9)").value).to.be.deep.equal([1, 2, 3, 4, 5, 6, 7, 8, 9])
)
it("Parses Strings array", () =>
expect(parser.parse(`( "Hello", "World", )`).value).to.be.deep.equal(["Hello", "World"])
)
it("Parses Heterogeneous array", () =>
expect(parser.parse(`( "Alpha", 123, Beta, "Gamma", "Delta", 99 )`).value)
.to.be.deep.equal(["Alpha", 123, { value: "Beta" }, "Gamma", "Delta", 99])
)
})
context("UnknownKeysEntity", () => {
let serializer = SerializerFactory.getSerializer(UnknownKeysEntity)
it('Parses LookbehindValue(FirstKey=1,SecondKey=SOME_SYMBOL2,ThirdKey="Hello")', () =>
expect(serializer.read('LookbehindValue(FirstKey=1,SecondKey=SOME_SYMBOL2,ThirdKey="Hello")').equals(
new UnknownKeysEntity({
lookbehind: "LookbehindValue",
FirstKey: 1,
SecondKey: new SymbolEntity("SOME_SYMBOL2"),
ThirdKey: "Hello",
})
)).to.be.true
)
it('Parses (A = (-1,-2,-3), B = SomeFunction(B1 = "b1", B2 = (X=101,Y=102,Z=103)))', () =>
expect(serializer.read('(A = (-1,-2,-3), B = SomeFunction(B1 = "b1", B2 = (X=101,Y=102,Z=103)))').equals(
new UnknownKeysEntity({
lookbehind: "",
A: [-1, -2, -3],
B: new UnknownKeysEntity({
lookbehind: "SomeFunction",
B1: "b1",
B2: new VectorEntity({ X: 101, Y: 102, Z: 103 }),
}),
})
)).to.be.true
)
})
@@ -271,124 +405,4 @@ describe("Serializer", () => {
.to.throw()
)
})
context("LinearColorEntity", () => {
let serializer = SerializerFactory.getSerializer(LinearColorEntity)
it("check white color", () => {
const result = LinearColorEntity.getWhite()
expect(result.toRGBA()).to.be.deep.equal([255, 255, 255, 255])
expect(result.toRGBAString()).to.be.equal("FFFFFFFF")
expect(result.toNumber()).to.be.equal(-1)
expect(result.toHSVA()).to.be.deep.equal([0, 0, 1, 1])
})
it("Parses red color", () => {
const result = serializer.read("(R=1,G=0,B=0)")
expect(result.toRGBA()).to.be.deep.equal([255, 0, 0, 255])
expect(result.toRGBAString()).to.be.equal("FF0000FF")
expect(result.toNumber()).to.be.equal(-16776961)
expect(result.toHSVA()).to.be.deep.equal([0, 1, 1, 1])
})
it("Parses simple color", () => {
const result = serializer.read("(R=0.000000,G=0.660000,B=1.000000,A=1.000000)")
expect(result.toRGBA()).to.be.deep.equal([0, 168, 255, 255])
expect(result.toRGBAString()).to.be.equal("00A8FFFF")
expect(result.toNumber()).to.be.equal(11075583)
expect(result.toHSVA()).to.be.deep.equal([0.55666666666666666666, 1, 1, 1])
})
it("Parses wrong order keys", () => {
const result = serializer.read("(B=0.04394509003266556,G=0.026789300067696642,A=0.83663232408635,R=0.6884158028074934,)")
expect(result.toRGBA()).to.be.deep.equal([176, 7, 11, 213])
expect(result.toRGBAString()).to.be.equal("B0070BD5")
expect(result.toNumber()).to.be.equal(-1341715499)
expect(result.toHSVA().map(v => Utility.roundDecimals(v, 3))).to.be.deep.equal([0.996, 0.961, 0.688, 0.837])
})
it("Parses weird spaces", () => {
const result = serializer.read(`(
A = 0.327 ,
R=0.530 , G = 0.685
,B
= 0.9 ,)`)
expect(result.toRGBA()).to.be.deep.equal([135, 175, 230, 83])
expect(result.toRGBAString()).to.be.equal("87AFE653")
expect(result.toNumber()).to.be.equal(-2018515373)
expect(result.toHSVA().map(v => Utility.roundDecimals(v, 3))).to.be.deep.equal([0.597, 0.411, 0.9, 0.327])
})
it("Throws when missing an expected key", () => expect(() => serializer.read("(R=0.000000,G=0.660000,A=1.000000)"))
.to.throw()
)
it("Throws when unexpected types", () => expect(() => serializer.read("(R=0.000000,G=\"hello\",A=1.000000)"))
.to.throw()
)
})
context("UnknownKeysValue", () => {
let parser = Grammar.unknownValue
it("Parses String", () => expect(parser.parse('"Hello"').value.constructor).equals(String))
it("Parses null", () => expect(parser.parse("()").value).to.be.null)
it("Parses Number", () => expect(parser.parse("8345").value.constructor).equals(Number))
it("Parses Boolean", () => expect(parser.parse("True").value.constructor).equals(Boolean))
it("Parses Boolean 2", () => expect(parser.parse("False").value.constructor).equals(Boolean))
it("Parses GuidEntity", () =>
expect(parser.parse("F0223D3742E67C0D9FEFB2A64946B7F0").value.constructor).equals(GuidEntity)
)
it("Parses SymbolEntity", () => expect(parser.parse("SYMBOL1").value.constructor).equals(SymbolEntity))
it("Parses SymbolEntity 2", () => expect(parser.parse("Symbol_2_3_4").value.constructor).equals(SymbolEntity))
it("Parses Vector2DEntity", () =>
expect(parser.parse("(X=-0.495, Y=0, )").value.constructor).equals(Vector2DEntity)
)
it("Parses VectorEntity", () =>
expect(parser.parse("(X=-0.495,Y=+765.0,Z=7)").value.constructor).equals(VectorEntity)
)
it("Parses RotatorEntity", () =>
expect(parser.parse("(R=1.000000,P=7.6,Y=+88.99)").value.constructor).equals(RotatorEntity)
)
it("Parses LinearColorEntity", () =>
expect(parser.parse("(R=0.000000,G=0.660000,B=1.000000,A=1.000000)").value.constructor)
.equals(LinearColorEntity)
)
it("Parses ObjectReferenceEntity", () =>
expect(parser.parse(`Class'"/Script/Engine.KismetSystemLibrary"'`).value.constructor)
.equals(ObjectReferenceEntity)
)
it("Parses Numbers array", () =>
expect(parser.parse("(1,2,3,4,5,6,7,8,9)").value).to.be.deep.equal([1, 2, 3, 4, 5, 6, 7, 8, 9])
)
it("Parses Strings array", () =>
expect(parser.parse(`( "Hello", "World", )`).value).to.be.deep.equal(["Hello", "World"])
)
it("Parses Heterogeneous array", () =>
expect(parser.parse(`( "Alpha", 123, Beta, "Gamma", "Delta", 99 )`).value)
.to.be.deep.equal(["Alpha", 123, { value: "Beta" }, "Gamma", "Delta", 99])
)
})
context("UnknownKeysEntity", () => {
let serializer = SerializerFactory.getSerializer(UnknownKeysEntity)
it('Parses LookbehindValue(FirstKey=1,SecondKey=SOME_SYMBOL2,ThirdKey="Hello")', () =>
expect(serializer.read('LookbehindValue(FirstKey=1,SecondKey=SOME_SYMBOL2,ThirdKey="Hello")').equals(
new UnknownKeysEntity({
lookbehind: "LookbehindValue",
FirstKey: 1,
SecondKey: new SymbolEntity("SOME_SYMBOL2"),
ThirdKey: "Hello",
})
)).to.be.true
)
it('Parses (A = (-1,-2,-3), B = SomeFunction(B1 = "b1", B2 = (X=101,Y=102,Z=103)))', () =>
expect(serializer.read('(A = (-1,-2,-3), B = SomeFunction(B1 = "b1", B2 = (X=101,Y=102,Z=103)))').equals(
new UnknownKeysEntity({
lookbehind: "",
A: [-1, -2, -3],
B: new UnknownKeysEntity({
lookbehind: "SomeFunction",
B1: "b1",
B2: new VectorEntity({ X: 101, Y: 102, Z: 103 }),
}),
})
)).to.be.true
)
})
})

72
dist/ueblueprint.js vendored
View File

@@ -70,9 +70,10 @@ class Configuration {
static gridShrinkThreshold = 4 // exceding size factor threshold to cause a shrink event
static gridSize = 16 // px
static hexColorRegex = /^\s*#(?<r>[0-9a-fA-F]{2})(?<g>[0-9a-fA-F]{2})(?<b>[0-9a-fA-F]{2})([0-9a-fA-F]{2})?|#(?<rs>[0-9a-fA-F])(?<gs>[0-9a-fA-F])(?<bs>[0-9a-fA-F])\s*$/
static keysSeparator = /[\.\(\)]/
static indentation = " "
static keysSeparator = /[\.\(\)]/
static knotOffset = [-26, -16]
static lineTracePattern = /LineTrace(Single|Multi)(\w*)/
static linkCurveHeight = 15 // px
static linkCurveWidth = 80 // px
static linkMinWidth = 100 // px
@@ -99,8 +100,8 @@ class Configuration {
static mouseClickButton = 0
static mouseRightClickButton = 2
static mouseWheelFactor = 0.2
static nodeDragGeneralEventName = "ueb-node-drag-general"
static nodeDragEventName = "ueb-node-drag"
static nodeDragGeneralEventName = "ueb-node-drag-general"
static nodeName = (name, counter) => `${name}_${counter}`
static nodeRadius = 8 // px
static nodeReflowEventName = "ueb-node-reflow"
@@ -1314,7 +1315,7 @@ class FormatTextEntity extends IEntity {
static lookbehind = "LOCGEN_FORMAT_NAMED"
static attributes = {
value: {
type: [new UnionType(LocalizedTextEntity, String, InvariantTextEntity, FormatTextEntity)],
type: [new UnionType(String, LocalizedTextEntity, InvariantTextEntity, FormatTextEntity)],
},
}
@@ -1324,7 +1325,21 @@ class FormatTextEntity extends IEntity {
constructor(values) {
super(values);
/** @type {String} */ this.value;
/** @type {(String | LocalizedTextEntity | InvariantTextEntity | FormatTextEntity)[]} */ this.value;
}
toString() {
const pattern = this.value?.[0]?.toString(); // The pattern is always the first element of the array
if (!pattern) {
return ""
}
const values = this.value.slice(1).map(v => v.toString());
return pattern.replaceAll(/\{([a-zA-Z]\w*)\}/g, (substring, arg) => {
const argLocation = values.indexOf(arg) + 1;
return argLocation > 0 && argLocation < values.length
? values[argLocation]
: substring
})
}
}
@@ -3250,19 +3265,20 @@ class ObjectEntity extends IEntity {
let memberName = this.FunctionReference?.MemberName;
if (memberName) {
const memberParent = this.FunctionReference.MemberParent?.path ?? "";
switch (memberName) {
case "AddKey":
{
let result = memberParent.match(ObjectEntity.sequencerScriptingNameRegex);
if (result) {
return `Add Key (${Utility.formatStringName(result[1])})`
}
}
break
case "LineTraceSingle":
return "Line Trace By Channel"
case "LineTraceSingleByProfile":
return "Line Trace By Profile"
if (memberName === "AddKey") {
let result = memberParent.match(ObjectEntity.sequencerScriptingNameRegex);
if (result) {
return `Add Key (${Utility.formatStringName(result[1])})`
}
}
const memberNameTraceLineMatch = memberName.match(Configuration.lineTracePattern);
if (memberNameTraceLineMatch) {
return "Line Trace"
+ (memberNameTraceLineMatch[1] === "Multi" ? " Multi " : " ")
+ (memberNameTraceLineMatch[2] === ""
? "By Channel"
: Utility.formatStringName(memberNameTraceLineMatch[2])
)
}
switch (memberParent) {
case "/Script/Engine.KismetMathLibrary":
@@ -3742,7 +3758,8 @@ class Grammar {
}
/**
* @param {EntityConstructor} entityType
* @template {AnyValue} T
* @param {AnyValueConstructor<T>} entityType
* @param {String[]} key
* @returns {AttributeInformation}
*/
@@ -3757,6 +3774,7 @@ class Grammar {
}
}
if (entityType instanceof IEntity.constructor) {
// @ts-expect-error
result = entityType.attributes[key[0]];
type = result?.type;
} else if (entityType instanceof Array) {
@@ -3830,6 +3848,7 @@ class Grammar {
P.regex(new RegExp(`${FormatTextEntity.lookbehind}\\s*`)),
this.grammarFor(FormatTextEntity.attributes.value)
)
.map(([_0, values]) => new FormatTextEntity(values))
)
static functionReferenceEntity = P.lazy(() => this.createEntityGrammar(FunctionReferenceEntity))
@@ -7864,7 +7883,7 @@ class NodeElement extends ISelectableDraggableElement {
|| nodeEntity.getClass() === Configuration.nodeType.commutativeAssociativeBinaryOperator
|| nodeEntity.getClass() === Configuration.nodeType.callArrayFunction
) {
const memberParent = nodeEntity.FunctionReference.MemberParent?.path ?? "";
const memberParent = nodeEntity.FunctionReference?.MemberParent?.path ?? "";
if (
memberParent === "/Script/Engine.KismetMathLibrary"
|| memberParent === "/Script/Engine.KismetArrayLibrary"
@@ -10687,6 +10706,21 @@ function initializeSerializerFactory() {
new ToStringSerializer(EnumEntity)
);
SerializerFactory.registerSerializer(
FormatTextEntity,
new CustomSerializer(
(v, insideString) => {
let result = FormatTextEntity.lookbehind + "("
+ v.value.map(v =>
// @ts-expect-error
SerializerFactory.getSerializer(Utility.getType(v)).write(v, insideString)
).join(", ")
+ ")";
return result
},
FormatTextEntity)
);
SerializerFactory.registerSerializer(
FunctionReferenceEntity,
new Serializer(FunctionReferenceEntity, Serializer.bracketsWrapped)

File diff suppressed because one or more lines are too long

View File

@@ -46,9 +46,10 @@ export default class Configuration {
static gridShrinkThreshold = 4 // exceding size factor threshold to cause a shrink event
static gridSize = 16 // px
static hexColorRegex = /^\s*#(?<r>[0-9a-fA-F]{2})(?<g>[0-9a-fA-F]{2})(?<b>[0-9a-fA-F]{2})([0-9a-fA-F]{2})?|#(?<rs>[0-9a-fA-F])(?<gs>[0-9a-fA-F])(?<bs>[0-9a-fA-F])\s*$/
static keysSeparator = /[\.\(\)]/
static indentation = " "
static keysSeparator = /[\.\(\)]/
static knotOffset = [-26, -16]
static lineTracePattern = /LineTrace(Single|Multi)(\w*)/
static linkCurveHeight = 15 // px
static linkCurveWidth = 80 // px
static linkMinWidth = 100 // px
@@ -75,8 +76,8 @@ export default class Configuration {
static mouseClickButton = 0
static mouseRightClickButton = 2
static mouseWheelFactor = 0.2
static nodeDragGeneralEventName = "ueb-node-drag-general"
static nodeDragEventName = "ueb-node-drag"
static nodeDragGeneralEventName = "ueb-node-drag-general"
static nodeName = (name, counter) => `${name}_${counter}`
static nodeRadius = 8 // px
static nodeReflowEventName = "ueb-node-reflow"

View File

@@ -105,7 +105,7 @@ export default class NodeElement extends ISelectableDraggableElement {
|| nodeEntity.getClass() === Configuration.nodeType.commutativeAssociativeBinaryOperator
|| nodeEntity.getClass() === Configuration.nodeType.callArrayFunction
) {
const memberParent = nodeEntity.FunctionReference.MemberParent?.path ?? ""
const memberParent = nodeEntity.FunctionReference?.MemberParent?.path ?? ""
if (
memberParent === "/Script/Engine.KismetMathLibrary"
|| memberParent === "/Script/Engine.KismetArrayLibrary"

View File

@@ -8,7 +8,7 @@ export default class FormatTextEntity extends IEntity {
static lookbehind = "LOCGEN_FORMAT_NAMED"
static attributes = {
value: {
type: [new UnionType(LocalizedTextEntity, String, InvariantTextEntity, FormatTextEntity)],
type: [new UnionType(String, LocalizedTextEntity, InvariantTextEntity, FormatTextEntity)],
},
}
@@ -18,6 +18,20 @@ export default class FormatTextEntity extends IEntity {
constructor(values) {
super(values)
/** @type {String} */ this.value
/** @type {(String | LocalizedTextEntity | InvariantTextEntity | FormatTextEntity)[]} */ this.value
}
toString() {
const pattern = this.value?.[0]?.toString() // The pattern is always the first element of the array
if (!pattern) {
return ""
}
const values = this.value.slice(1).map(v => v.toString())
return pattern.replaceAll(/\{([a-zA-Z]\w*)\}/g, (substring, arg) => {
const argLocation = values.indexOf(arg) + 1
return argLocation > 0 && argLocation < values.length
? values[argLocation]
: substring
})
}
}

View File

@@ -547,19 +547,20 @@ export default class ObjectEntity extends IEntity {
let memberName = this.FunctionReference?.MemberName
if (memberName) {
const memberParent = this.FunctionReference.MemberParent?.path ?? ""
switch (memberName) {
case "AddKey":
{
let result = memberParent.match(ObjectEntity.sequencerScriptingNameRegex)
if (result) {
return `Add Key (${Utility.formatStringName(result[1])})`
}
}
break
case "LineTraceSingle":
return "Line Trace By Channel"
case "LineTraceSingleByProfile":
return "Line Trace By Profile"
if (memberName === "AddKey") {
let result = memberParent.match(ObjectEntity.sequencerScriptingNameRegex)
if (result) {
return `Add Key (${Utility.formatStringName(result[1])})`
}
}
const memberNameTraceLineMatch = memberName.match(Configuration.lineTracePattern)
if (memberNameTraceLineMatch) {
return "Line Trace"
+ (memberNameTraceLineMatch[1] === "Multi" ? " Multi " : " ")
+ (memberNameTraceLineMatch[2] === ""
? "By Channel"
: Utility.formatStringName(memberNameTraceLineMatch[2])
)
}
switch (memberParent) {
case "/Script/Engine.KismetMathLibrary":

View File

@@ -292,7 +292,8 @@ export default class Grammar {
}
/**
* @param {EntityConstructor} entityType
* @template {AnyValue} T
* @param {AnyValueConstructor<T>} entityType
* @param {String[]} key
* @returns {AttributeInformation}
*/
@@ -307,6 +308,7 @@ export default class Grammar {
}
}
if (entityType instanceof IEntity.constructor) {
// @ts-expect-error
result = entityType.attributes[key[0]]
type = result?.type
} else if (entityType instanceof Array) {
@@ -380,6 +382,7 @@ export default class Grammar {
P.regex(new RegExp(`${FormatTextEntity.lookbehind}\\s*`)),
this.grammarFor(FormatTextEntity.attributes.value)
)
.map(([_0, values]) => new FormatTextEntity(values))
)
static functionReferenceEntity = P.lazy(() => this.createEntityGrammar(FunctionReferenceEntity))

View File

@@ -1,13 +1,13 @@
import ByteEntity from "../entity/ByteEntity.js"
import CustomSerializer from "./CustomSerializer.js"
import EnumEntity from "../entity/EnumEntity.js"
import FormatTextEntity from "../entity/FormatTextEntity.js"
import FunctionReferenceEntity from "../entity/FunctionReferenceEntity.js"
import GuidEntity from "../entity/GuidEntity.js"
import IdentifierEntity from "../entity/IdentifierEntity.js"
import Integer64Entity from "../entity/Integer64Entity.js"
import IntegerEntity from "../entity/IntegerEntity.js"
import InvariantTextEntity from "../entity/InvariantTextEntity.js"
import Serializer from "./Serializer.js"
import KeyBindingEntity from "../entity/KeyBindingEntity.js"
import LinearColorEntity from "../entity/LinearColorEntity.js"
import LocalizedTextEntity from "../entity/LocalizedTextEntity.js"
@@ -20,6 +20,7 @@ import PinEntity from "../entity/PinEntity.js"
import PinReferenceEntity from "../entity/PinReferenceEntity.js"
import RealUnitEntity from "../entity/UnitRealEntity.js"
import RotatorEntity from "../entity/RotatorEntity.js"
import Serializer from "./Serializer.js"
import SerializerFactory from "./SerializerFactory.js"
import SimpleSerializationRotatorEntity from "../entity/SimpleSerializationRotatorEntity.js"
import SimpleSerializationVector2DEntity from "../entity/SimpleSerializationVector2DEntity.js"
@@ -91,6 +92,21 @@ export default function initializeSerializerFactory() {
new ToStringSerializer(EnumEntity)
)
SerializerFactory.registerSerializer(
FormatTextEntity,
new CustomSerializer(
(v, insideString) => {
let result = FormatTextEntity.lookbehind + "("
+ v.value.map(v =>
// @ts-expect-error
SerializerFactory.getSerializer(Utility.getType(v)).write(v, insideString)
).join(", ")
+ ")"
return result
},
FormatTextEntity)
)
SerializerFactory.registerSerializer(
FunctionReferenceEntity,
new Serializer(FunctionReferenceEntity, Serializer.bracketsWrapped)