mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-04 08:50:33 +08:00
Object grammar fix
This commit is contained in:
23
dist/ueblueprint.js
vendored
23
dist/ueblueprint.js
vendored
@@ -353,13 +353,13 @@ class ObjectEntity extends Entity {
|
||||
Class: ObjectReferenceEntity,
|
||||
Name: "",
|
||||
bIsPureFunc: new TypeInitialization(false, false),
|
||||
VariableReference: new TypeInitialization(new VariableReferenceEntity(), false),
|
||||
FunctionReference: new TypeInitialization(new FunctionReferenceEntity(), false),
|
||||
TargetType: new TypeInitialization(new ObjectReferenceEntity(), false),
|
||||
VariableReference: new TypeInitialization(null, false, VariableReferenceEntity),
|
||||
FunctionReference: new TypeInitialization(null, false, FunctionReferenceEntity),
|
||||
TargetType: new TypeInitialization(null, false, ObjectReferenceEntity),
|
||||
NodePosX: Integer,
|
||||
NodePosY: Integer,
|
||||
NodeGuid: GuidEntity,
|
||||
CustomProperties: [PinEntity$1]
|
||||
CustomProperties: [new TypeInitialization(null, false, PinEntity$1)]
|
||||
}
|
||||
|
||||
getAttributes() {
|
||||
@@ -383,7 +383,7 @@ class Grammar {
|
||||
Word = _ => P.regex(/[a-zA-Z]+/).desc("a word")
|
||||
Guid = _ => P.regex(/[0-9a-zA-Z]{32}/).map(v => new GuidEntity({ value: v })).desc("32 digit hexadecimal (accepts all the letters for safety) value")
|
||||
PathSymbol = _ => P.regex(/[0-9a-zA-Z_]+/)
|
||||
ReferencePath = _ => P.seq(P.string("/"), r.PathSymbol.sepBy1(P.string(".")).tieWith("."))
|
||||
ReferencePath = r => P.seq(P.string("/"), r.PathSymbol.sepBy1(P.string(".")).tieWith("."))
|
||||
.tie()
|
||||
.atLeast(2)
|
||||
.tie()
|
||||
@@ -513,10 +513,21 @@ class Grammar {
|
||||
PinEntity$1,
|
||||
attributeKey => Utility.objectGet(PinEntity$1.attributes, attributeKey)
|
||||
)
|
||||
CustomProperties = r =>
|
||||
P.string("CustomProperties")
|
||||
.then(P.whitespace)
|
||||
.then(r.Pin)
|
||||
.map(pin => entity => {
|
||||
/** @type {Array} */
|
||||
let properties = Utility.objectGet(entity, ["CustomProperties"], []);
|
||||
properties.push(pin);
|
||||
Utility.objectSet(entity, ["CustomProperties"], properties, true);
|
||||
})
|
||||
|
||||
Object = r => P.seqMap(
|
||||
P.seq(P.string("Begin"), P.whitespace, P.string("Object"), P.whitespace),
|
||||
P.alt(
|
||||
Grammar.CreateAttributeGrammar(r, P.string("CustomProperties"), _ => ObjectEntity.attributes.CustomProperties, P.whitespace),
|
||||
r.CustomProperties,
|
||||
Grammar.CreateAttributeGrammar(r, r.AttributeName, attributeKey => Utility.objectGet(ObjectEntity.attributes, attributeKey))
|
||||
)
|
||||
.sepBy1(P.whitespace),
|
||||
|
||||
@@ -13,13 +13,13 @@ export default class ObjectEntity extends Entity {
|
||||
Class: ObjectReferenceEntity,
|
||||
Name: "",
|
||||
bIsPureFunc: new TypeInitialization(false, false),
|
||||
VariableReference: new TypeInitialization(new VariableReferenceEntity(), false),
|
||||
FunctionReference: new TypeInitialization(new FunctionReferenceEntity(), false),
|
||||
TargetType: new TypeInitialization(new ObjectReferenceEntity(), false),
|
||||
NodePosX: Integer,
|
||||
NodePosY: Integer,
|
||||
VariableReference: new TypeInitialization(null, false, VariableReferenceEntity),
|
||||
FunctionReference: new TypeInitialization(null, false, FunctionReferenceEntity),
|
||||
TargetType: new TypeInitialization(null, false, ObjectReferenceEntity),
|
||||
NodePosX: 0,
|
||||
NodePosY: 0,
|
||||
NodeGuid: GuidEntity,
|
||||
CustomProperties: [PinEntity]
|
||||
CustomProperties: [new TypeInitialization(null, false, PinEntity)]
|
||||
}
|
||||
|
||||
getAttributes() {
|
||||
|
||||
@@ -25,7 +25,7 @@ export default class Grammar {
|
||||
Word = _ => P.regex(/[a-zA-Z]+/).desc("a word")
|
||||
Guid = _ => P.regex(/[0-9a-zA-Z]{32}/).map(v => new GuidEntity({ value: v })).desc("32 digit hexadecimal (accepts all the letters for safety) value")
|
||||
PathSymbol = _ => P.regex(/[0-9a-zA-Z_]+/)
|
||||
ReferencePath = _ => P.seq(P.string("/"), r.PathSymbol.sepBy1(P.string(".")).tieWith("."))
|
||||
ReferencePath = r => P.seq(P.string("/"), r.PathSymbol.sepBy1(P.string(".")).tieWith("."))
|
||||
.tie()
|
||||
.atLeast(2)
|
||||
.tie()
|
||||
@@ -155,10 +155,21 @@ export default class Grammar {
|
||||
PinEntity,
|
||||
attributeKey => Utility.objectGet(PinEntity.attributes, attributeKey)
|
||||
)
|
||||
CustomProperties = r =>
|
||||
P.string("CustomProperties")
|
||||
.then(P.whitespace)
|
||||
.then(r.Pin)
|
||||
.map(pin => entity => {
|
||||
/** @type {Array} */
|
||||
let properties = Utility.objectGet(entity, ["CustomProperties"], [])
|
||||
properties.push(pin)
|
||||
Utility.objectSet(entity, ["CustomProperties"], properties, true)
|
||||
})
|
||||
|
||||
Object = r => P.seqMap(
|
||||
P.seq(P.string("Begin"), P.whitespace, P.string("Object"), P.whitespace),
|
||||
P.alt(
|
||||
Grammar.CreateAttributeGrammar(r, P.string("CustomProperties"), _ => ObjectEntity.attributes.CustomProperties, P.whitespace),
|
||||
r.CustomProperties,
|
||||
Grammar.CreateAttributeGrammar(r, r.AttributeName, attributeKey => Utility.objectGet(ObjectEntity.attributes, attributeKey))
|
||||
)
|
||||
.sepBy1(P.whitespace),
|
||||
|
||||
@@ -15,7 +15,18 @@
|
||||
<div>Hello</div>
|
||||
<script type="module">
|
||||
import { PinSerializer } from "./dist/ueblueprint.js"
|
||||
let pinEparsed = PinSerializer.grammar.Pin.parse(`Pin (PinId=DB96A96142631A1B113BC69C8B77B9BD,PinName="ReturnValue",PinToolTip="Return Value\nString\n\nReturns the string name of the current platform, to perform different behavior based on platform.\n(Platform names include Windows, Mac, IOS, Android, PS4, XboxOne, Linux)",Direction="EGPD_Output",PinType.PinCategory="string",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,LinkedTo=(K2Node_CommutativeAssociativeBinaryOperator_1 22257AFF4730E84DE3EF0DBA7A92E1EE,K2Node_CommutativeAssociativeBinaryOperator_1 81E183294B6CBC122C5E88A8C37F13A3,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)`)
|
||||
let path = PinSerializer.grammar.ReferencePath.parse(`/Script/BlueprintGraph.K2Node_CommutativeAssociativeBinaryOperator`)
|
||||
let pinEparsed = PinSerializer.grammar.Object.parse(`Begin Object Class=/Script/BlueprintGraph.K2Node_CommutativeAssociativeBinaryOperator Name="K2Node_CommutativeAssociativeBinaryOperator_1"
|
||||
bIsPureFunc=True
|
||||
FunctionReference=(MemberParent=Class'"/Script/Engine.KismetStringLibrary"',MemberName="Concat_StrStr")
|
||||
NodePosX=1856
|
||||
NodePosY=1792
|
||||
NodeGuid=43D899AC42EB640EF98BFCA1597FD6C9
|
||||
CustomProperties Pin (PinId=FB3490034B2B6127D29E1397E04F6BD6,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "Target", "Target"),PinToolTip="Target\nKismet String Library Object Reference",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=Class'"/Script/Engine.KismetStringLibrary"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=True,DefaultObject="/Script/Engine.Default__KismetStringLibrary",PersistentGuid=00000000000000000000000000000000,bHidden=True,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=22257AFF4730E84DE3EF0DBA7A92E1EE,PinName="A",PinToolTip="A\nString\n\nThe original string",PinType.PinCategory="string",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,LinkedTo=(K2Node_CallFunction_1 DB96A96142631A1B113BC69C8B77B9BD,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=81E183294B6CBC122C5E88A8C37F13A3,PinName="B",PinToolTip="B\nString\n\nThe string to append to A",PinType.PinCategory="string",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,LinkedTo=(K2Node_CallFunction_1 DB96A96142631A1B113BC69C8B77B9BD,),PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=E9BBB3A54DE64C213F52B2AFC8197637,PinName="ReturnValue",PinToolTip="Return Value\nString\n\nA new string which is the concatenation of A+B",Direction="EGPD_Output",PinType.PinCategory="string",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
End Object`)
|
||||
//let blueprint = new UEBlueprint()
|
||||
|
||||
//let node0 = new GraphNode(); node0.setLocation([985, 393]); let node1 = new GraphNode(); node1.setLocation([999, 114]); let node2 = new GraphNode(); node2.setLocation([811, 253]); let node3 = new GraphNode(); node3.setLocation([802, 146]); let node4 = new GraphNode(); node4.setLocation([597, 105]); let node5 = new GraphNode(); node5.setLocation([789, 233]); let node6 = new GraphNode(); node6.setLocation([549, 289]); let node7 = new GraphNode(); node7.setLocation([678, 193]); let node8 = new GraphNode(); node8.setLocation([1078, 244]); let node9 = new GraphNode(); node9.setLocation([751, 151]); let node10 = new GraphNode(); node10.setLocation([1046, -14]); let node11 = new GraphNode(); node11.setLocation([714, 267]); let node12 = new GraphNode(); node12.setLocation([767, 36]); let node13 = new GraphNode(); node13.setLocation([807, 219]); let node14 = new GraphNode(); node14.setLocation([1031, 70]); let node15 = new GraphNode(); node15.setLocation([906, 389]); let node16 = new GraphNode(); node16.setLocation([936, 131]); let node17 = new GraphNode(); node17.setLocation([689, 249]); let node18 = new GraphNode(); node18.setLocation([1153, 343]); let node19 = new GraphNode(); node19.setLocation([626, 209]); blueprint.addNode(node0, node1, node2, node3, node4, node5, node6, node7, node8, node9, node10, node11, node12, node13, node14, node15, node16, node17, node18, node19);
|
||||
|
||||
Reference in New Issue
Block a user