mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-03 23:55:04 +08:00
Switch on enum and indexed array parse
This commit is contained in:
@@ -205,6 +205,45 @@ const tests = [
|
||||
delegate: false,
|
||||
development: false,
|
||||
},
|
||||
{
|
||||
name: "Switch on EConstantQFFTSizeEnum",
|
||||
value: String.raw`
|
||||
Begin Object Class=/Script/BlueprintGraph.K2Node_SwitchEnum Name="K2Node_SwitchEnum_0"
|
||||
Enum=/Script/CoreUObject.Enum'"/Script/AudioSynesthesia.EConstantQFFTSizeEnum"'
|
||||
EnumEntries(0)="Min"
|
||||
EnumEntries(1)="XXSmall"
|
||||
EnumEntries(2)="XSmall"
|
||||
EnumEntries(3)="Small"
|
||||
EnumEntries(4)="Medium"
|
||||
EnumEntries(5)="Large"
|
||||
EnumEntries(6)="XLarge"
|
||||
EnumEntries(7)="XXLarge"
|
||||
EnumEntries(8)="Max"
|
||||
NodePosX=16
|
||||
NodePosY=704
|
||||
AdvancedPinDisplay=Hidden
|
||||
NodeGuid=9DCDC46C72FF47CE91F86A8045F0033E
|
||||
CustomProperties Pin (PinId=1593030F27084BFD85F54D30CD32C5B8,PinName="execute",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=17161A0F216A4F2FB64374200F51E83D,PinName="Selection",PinType.PinCategory="byte",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.Enum'"/Script/AudioSynesthesia.EConstantQFFTSizeEnum"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="Min",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=B14C4298DE3249649D40116D72461E25,PinName="NotEqual_ByteByte",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.Class'"/Script/Engine.KismetMathLibrary"',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__KismetMathLibrary",PersistentGuid=00000000000000000000000000000000,bHidden=True,bNotConnectable=True,bDefaultValueIsReadOnly=True,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=3B40821CA7C749BFAA558A8CF4402B55,PinName="Min",PinFriendlyName=NSLOCTEXT("UObjectDisplayNames", "EConstantQFFTSizeEnum.Min", "Min"),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=B95FFACBCBD040B2AAB48011BC143625,PinName="XXSmall",PinFriendlyName=NSLOCTEXT("UObjectDisplayNames", "EConstantQFFTSizeEnum.XXSmall", "XXSmall"),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=340171B1D59F422E96B45F9B1E11892A,PinName="XSmall",PinFriendlyName=NSLOCTEXT("UObjectDisplayNames", "EConstantQFFTSizeEnum.XSmall", "XSmall"),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=BD0B6BF19D6C4BA487498C4A768FF500,PinName="Small",PinFriendlyName=NSLOCTEXT("UObjectDisplayNames", "EConstantQFFTSizeEnum.Small", "Small"),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=True,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=58E2F332700044E88E8A591FFBE5DEDB,PinName="Medium",PinFriendlyName=NSLOCTEXT("UObjectDisplayNames", "EConstantQFFTSizeEnum.Medium", "Medium"),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=True,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=94B36AB248454AE2884C39DDBBBE55E2,PinName="Large",PinFriendlyName=NSLOCTEXT("UObjectDisplayNames", "EConstantQFFTSizeEnum.Large", "Large"),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=True,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=9F6110F3DE5D42B69DAEDD2BA1F83908,PinName="XLarge",PinFriendlyName=NSLOCTEXT("UObjectDisplayNames", "EConstantQFFTSizeEnum.XLarge", "XLarge"),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=True,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=42A13039E2144897A11DC3A5B96CA8C4,PinName="XXLarge",PinFriendlyName=NSLOCTEXT("UObjectDisplayNames", "EConstantQFFTSizeEnum.XXLarge", "XXLarge"),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=True,bOrphanedPin=False,)
|
||||
CustomProperties Pin (PinId=A064703325A4454EA72392A6C725CCC4,PinName="Max",PinFriendlyName=NSLOCTEXT("UObjectDisplayNames", "EConstantQFFTSizeEnum.Max", "Max"),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=True,bOrphanedPin=False,)
|
||||
End Object
|
||||
`,
|
||||
color: Configuration.nodeColors.lime,
|
||||
icon: SVGIcon.switch,
|
||||
pins: 11,
|
||||
pinName: ["Selection", "Min", "XXSmall", "XSmall", "Small", "Medium", "Large", "XLarge", "XXLarge", "Max"],
|
||||
delegate: false,
|
||||
development: false,
|
||||
},
|
||||
]
|
||||
|
||||
/** @type {Blueprint} */
|
||||
|
||||
@@ -231,7 +231,7 @@ const tests = [
|
||||
icon: SVGIcon.node,
|
||||
pins: 2,
|
||||
pinNames: ["Object", "Event"],
|
||||
delete: false,
|
||||
delegate: false,
|
||||
development: false,
|
||||
},
|
||||
]
|
||||
|
||||
57
dist/ueblueprint.js
vendored
57
dist/ueblueprint.js
vendored
@@ -35,6 +35,7 @@ class Configuration {
|
||||
blue: i$3`84, 122, 156`,
|
||||
gray: i$3`150,150,150`,
|
||||
green: i$3`95, 129, 90`,
|
||||
lime: i$3`150, 160, 30`,
|
||||
red: i$3`151, 33, 32`,
|
||||
turquoise: i$3`46, 104, 106`,
|
||||
}
|
||||
@@ -140,6 +141,7 @@ class Configuration {
|
||||
promotableOperator: "/Script/BlueprintGraph.K2Node_PromotableOperator",
|
||||
reverseForEachLoop: "/Engine/EditorBlueprintResources/StandardMacros.StandardMacros:ReverseForEachLoop",
|
||||
select: "/Script/BlueprintGraph.K2Node_Select",
|
||||
switchEnum: "/Script/BlueprintGraph.K2Node_SwitchEnum",
|
||||
userDefinedEnum: "/Script/Engine.UserDefinedEnum",
|
||||
variableGet: "/Script/BlueprintGraph.K2Node_VariableGet",
|
||||
variableSet: "/Script/BlueprintGraph.K2Node_VariableSet",
|
||||
@@ -2367,7 +2369,7 @@ class SVGIcon {
|
||||
`
|
||||
|
||||
static gamepad = y`
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill="white" d="m 15.2107 8.525 c -0.6619 -1.7207 -1.9856 -4.8978 -3.3094 -4.8978 c -1.9856 0 -1.9856 1.8532 -2.7799 1.8532 c -0.3971 0 -1.8532 0 -2.3827 0 c -0.7943 0 -0.7943 -1.8532 -2.6475 -1.8532 c -1.3238 0 -2.6475 3.0446 -3.3094 4.8978 c -1.059 3.3094 -1.1914 4.8979 1.1914 4.8979 c 2.6475 0 2.6475 -3.0445 5.9569 -3.0445 c 3.3094 0 3.4418 3.0445 5.9569 3.0445 c 2.5151 0 2.5151 -1.5885 1.3238 -4.8979 z m -8.472 0 h -1.3238 v 1.3238 h -1.3238 v -1.3238 h -1.3238 v -1.3238 h 1.3238 v -1.3238 h 1.3238 v 1.3238 h 1.3238 v 1.3238 z m 4.6331 1.5887 c -1.1914 0 -2.2504 -0.9268 -2.2504 -2.2505 c 0 -1.1913 0.9267 -2.2503 2.2504 -2.2503 c 1.3238 0 2.2504 0.9266 2.2504 2.2503 c 0 1.1915 -1.059 2.2505 -2.2504 2.2505 z m -0.0001 -2.9124 c -0.3971 0 -0.6619 0.2648 -0.6619 0.6619 c 0 0.3971 0.2648 0.6619 0.6619 0.6619 c 0.3971 0 0.6619 -0.2648 0.6619 -0.6619 c 0 -0.3971 -0.2648 -0.6619 -0.6619 -0.6619 z" />
|
||||
</svg>
|
||||
`
|
||||
@@ -2473,14 +2475,14 @@ class SVGIcon {
|
||||
`
|
||||
|
||||
static mouse = y`
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path opacity="0.5" fill-rule="evenodd" clip-rule="evenodd" d="M8.85714 8.34043H14L13.9143 6.6383H8.85714V0H7.14286V6.6383H2.08571L2 8.34043H7.14286H8.85714Z" fill="white"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.85714 0C11 0.595745 13.4 3.31915 13.9143 6.6383H8.85714V0ZM7.14286 0C5 0.595745 2.6 3.31915 2.08571 6.6383H7.14286V0ZM8.85714 8.34043H7.14286H2C2 12.5957 3.02857 16 8 16C12.9714 16 14 12.5957 14 8.34043H8.85714Z" fill="white"/>
|
||||
</svg>
|
||||
`
|
||||
|
||||
static node = y`
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="16" height="15" rx="1" fill="white" fill-opacity="0.5"/>
|
||||
<rect x="0.5" y="0.5" width="15" height="14" rx="0.5" stroke="white"/>
|
||||
<rect x="1" width="14" height="5" fill="white"/>
|
||||
@@ -2539,6 +2541,17 @@ class SVGIcon {
|
||||
</svg>
|
||||
`
|
||||
|
||||
static switch = y`
|
||||
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="3" y="2" width="6" height="2" fill="white" />
|
||||
<rect y="7" width="9" height="2" fill="white" />
|
||||
<rect x="3" y="4" width="2" height="9" fill="white" />
|
||||
<rect x="3" y="12" width="6" height="2" fill="white" />
|
||||
<rect x="10" y="2" width="3" height="2" fill="white" />
|
||||
<path d="M12 0L15 3L12 6V0Z" fill="white" />
|
||||
</svg>
|
||||
`
|
||||
|
||||
static touchpad = y`
|
||||
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill="white" fill-rule="evenodd" clip-rule="evenodd" d="M13 0H3C2.4 0 2 0.4 2 1V15C2 15.6 2.4 16 3 16H13C13.6 16 14 15.6 14 15V1C14 0.4 13.6 0 13 0ZM8 15.5C7.2 15.5 6.5 14.8 6.5 14C6.5 13.2 7.2 12.5 8 12.5C8.8 12.5 9.5 13.2 9.5 14C9.5 14.8 8.8 15.5 8 15.5ZM13 12H3V1H13V12Z" />
|
||||
@@ -3011,6 +3024,8 @@ class ObjectEntity extends IEntity {
|
||||
return ""
|
||||
case Configuration.nodeType.variableSet:
|
||||
return "SET"
|
||||
case Configuration.nodeType.switchEnum:
|
||||
return `Switch on ${this.Enum?.getName()}`
|
||||
}
|
||||
const keyNameSymbol = this.getHIDAttribute();
|
||||
if (keyNameSymbol) {
|
||||
@@ -3113,6 +3128,8 @@ class ObjectEntity extends IEntity {
|
||||
return Configuration.nodeColors.gray
|
||||
case Configuration.nodeType.dynamicCast:
|
||||
return Configuration.nodeColors.turquoise
|
||||
case Configuration.nodeType.switchEnum:
|
||||
return Configuration.nodeColors.lime
|
||||
}
|
||||
if (this.isEvent()) {
|
||||
return Configuration.nodeColors.red
|
||||
@@ -3151,6 +3168,7 @@ class ObjectEntity extends IEntity {
|
||||
case Configuration.nodeType.makeMap: return SVGIcon.makeMap
|
||||
case Configuration.nodeType.makeSet: return SVGIcon.makeSet
|
||||
case Configuration.nodeType.select: return SVGIcon.select
|
||||
case Configuration.nodeType.switchEnum: return SVGIcon.switch
|
||||
}
|
||||
if (this.nodeDisplayName().startsWith("Break")) {
|
||||
return SVGIcon.breakStruct
|
||||
@@ -3275,6 +3293,10 @@ class Grammar {
|
||||
|
||||
static colorValue = this.byteNumber
|
||||
static word = P.regex(Grammar.Regex.Word)
|
||||
static pathQuotes = Grammar.regexMap(
|
||||
new RegExp(`"(${Grammar.Regex.PathOptSpace.source}|${Grammar.Regex.Symbol.source})"|'"(${Grammar.Regex.PathOptSpace.source}|${Grammar.Regex.Symbol.source})"'`),
|
||||
([_0, a, b, c]) => a ?? b ?? c
|
||||
)
|
||||
static path = Grammar.regexMap(
|
||||
new RegExp(`(${Grammar.Regex.Path.source})|"(${Grammar.Regex.PathOptSpace.source})"|'"(${Grammar.Regex.PathOptSpace.source})"'`),
|
||||
([_0, a, b, c]) => a ?? b ?? c
|
||||
@@ -3308,6 +3330,7 @@ class Grammar {
|
||||
|
||||
/**
|
||||
* @param {AnyValueConstructor<any>} type
|
||||
* @returns {Parsimmon.Parser<any>}
|
||||
*/
|
||||
static grammarFor(
|
||||
attribute,
|
||||
@@ -3444,10 +3467,7 @@ class Grammar {
|
||||
return result
|
||||
}
|
||||
|
||||
static createAttributeGrammar(
|
||||
entityType,
|
||||
valueSeparator = this.equalSeparation
|
||||
) {
|
||||
static createAttributeGrammar(entityType, valueSeparator = this.equalSeparation) {
|
||||
return P.seq(
|
||||
this.attributeName,
|
||||
valueSeparator,
|
||||
@@ -3579,7 +3599,7 @@ class Grammar {
|
||||
)
|
||||
|
||||
static fullReferenceEntity = P.lazy(() =>
|
||||
P.seq(this.typeReference, P.optWhitespace, this.path)
|
||||
P.seq(this.typeReference, P.optWhitespace, this.pathQuotes)
|
||||
.map(([type, _2, path]) =>
|
||||
new ObjectReferenceEntity({ type: type, path: path })
|
||||
)
|
||||
@@ -3728,6 +3748,26 @@ class Grammar {
|
||||
})
|
||||
)
|
||||
|
||||
static indexedArrayEntry = P.lazy(() => {
|
||||
return P.seq(
|
||||
this.symbol,
|
||||
this.regexMap(
|
||||
new RegExp(`\\s*\\(\\s*(\\d+)\\s*\\)\\s*\\=\\s*`),
|
||||
v => v[1]
|
||||
)
|
||||
)
|
||||
.chain(([symbol, _1]) =>
|
||||
this.grammarFor(ObjectEntity.attributes[symbol])
|
||||
.map(currentValue =>
|
||||
values => {
|
||||
if (!values[symbol]) {
|
||||
values[symbol] = [];
|
||||
}
|
||||
values[symbol].push(currentValue);
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
static objectEntity = P.lazy(() =>
|
||||
P.seq(
|
||||
P.regex(/Begin\s+Object/),
|
||||
@@ -3736,6 +3776,7 @@ class Grammar {
|
||||
P.alt(
|
||||
this.customProperty,
|
||||
this.createAttributeGrammar(ObjectEntity),
|
||||
this.indexedArrayEntry
|
||||
)
|
||||
)
|
||||
.map(([_0, entry]) => entry)
|
||||
|
||||
6
dist/ueblueprint.min.js
vendored
6
dist/ueblueprint.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -11,6 +11,7 @@ export default class Configuration {
|
||||
blue: css`84, 122, 156`,
|
||||
gray: css`150,150,150`,
|
||||
green: css`95, 129, 90`,
|
||||
lime: css`150, 160, 30`,
|
||||
red: css`151, 33, 32`,
|
||||
turquoise: css`46, 104, 106`,
|
||||
}
|
||||
@@ -116,6 +117,7 @@ export default class Configuration {
|
||||
promotableOperator: "/Script/BlueprintGraph.K2Node_PromotableOperator",
|
||||
reverseForEachLoop: "/Engine/EditorBlueprintResources/StandardMacros.StandardMacros:ReverseForEachLoop",
|
||||
select: "/Script/BlueprintGraph.K2Node_Select",
|
||||
switchEnum: "/Script/BlueprintGraph.K2Node_SwitchEnum",
|
||||
userDefinedEnum: "/Script/Engine.UserDefinedEnum",
|
||||
variableGet: "/Script/BlueprintGraph.K2Node_VariableGet",
|
||||
variableSet: "/Script/BlueprintGraph.K2Node_VariableSet",
|
||||
|
||||
@@ -128,7 +128,7 @@ export default class SVGIcon {
|
||||
`
|
||||
|
||||
static gamepad = html`
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill="white" d="m 15.2107 8.525 c -0.6619 -1.7207 -1.9856 -4.8978 -3.3094 -4.8978 c -1.9856 0 -1.9856 1.8532 -2.7799 1.8532 c -0.3971 0 -1.8532 0 -2.3827 0 c -0.7943 0 -0.7943 -1.8532 -2.6475 -1.8532 c -1.3238 0 -2.6475 3.0446 -3.3094 4.8978 c -1.059 3.3094 -1.1914 4.8979 1.1914 4.8979 c 2.6475 0 2.6475 -3.0445 5.9569 -3.0445 c 3.3094 0 3.4418 3.0445 5.9569 3.0445 c 2.5151 0 2.5151 -1.5885 1.3238 -4.8979 z m -8.472 0 h -1.3238 v 1.3238 h -1.3238 v -1.3238 h -1.3238 v -1.3238 h 1.3238 v -1.3238 h 1.3238 v 1.3238 h 1.3238 v 1.3238 z m 4.6331 1.5887 c -1.1914 0 -2.2504 -0.9268 -2.2504 -2.2505 c 0 -1.1913 0.9267 -2.2503 2.2504 -2.2503 c 1.3238 0 2.2504 0.9266 2.2504 2.2503 c 0 1.1915 -1.059 2.2505 -2.2504 2.2505 z m -0.0001 -2.9124 c -0.3971 0 -0.6619 0.2648 -0.6619 0.6619 c 0 0.3971 0.2648 0.6619 0.6619 0.6619 c 0.3971 0 0.6619 -0.2648 0.6619 -0.6619 c 0 -0.3971 -0.2648 -0.6619 -0.6619 -0.6619 z" />
|
||||
</svg>
|
||||
`
|
||||
@@ -234,14 +234,14 @@ export default class SVGIcon {
|
||||
`
|
||||
|
||||
static mouse = html`
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path opacity="0.5" fill-rule="evenodd" clip-rule="evenodd" d="M8.85714 8.34043H14L13.9143 6.6383H8.85714V0H7.14286V6.6383H2.08571L2 8.34043H7.14286H8.85714Z" fill="white"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.85714 0C11 0.595745 13.4 3.31915 13.9143 6.6383H8.85714V0ZM7.14286 0C5 0.595745 2.6 3.31915 2.08571 6.6383H7.14286V0ZM8.85714 8.34043H7.14286H2C2 12.5957 3.02857 16 8 16C12.9714 16 14 12.5957 14 8.34043H8.85714Z" fill="white"/>
|
||||
</svg>
|
||||
`
|
||||
|
||||
static node = html`
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="16" height="15" rx="1" fill="white" fill-opacity="0.5"/>
|
||||
<rect x="0.5" y="0.5" width="15" height="14" rx="0.5" stroke="white"/>
|
||||
<rect x="1" width="14" height="5" fill="white"/>
|
||||
@@ -300,6 +300,17 @@ export default class SVGIcon {
|
||||
</svg>
|
||||
`
|
||||
|
||||
static switch = html`
|
||||
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="3" y="2" width="6" height="2" fill="white" />
|
||||
<rect y="7" width="9" height="2" fill="white" />
|
||||
<rect x="3" y="4" width="2" height="9" fill="white" />
|
||||
<rect x="3" y="12" width="6" height="2" fill="white" />
|
||||
<rect x="10" y="2" width="3" height="2" fill="white" />
|
||||
<path d="M12 0L15 3L12 6V0Z" fill="white" />
|
||||
</svg>
|
||||
`
|
||||
|
||||
static touchpad = html`
|
||||
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill="white" fill-rule="evenodd" clip-rule="evenodd" d="M13 0H3C2.4 0 2 0.4 2 1V15C2 15.6 2.4 16 3 16H13C13.6 16 14 15.6 14 15V1C14 0.4 13.6 0 13 0ZM8 15.5C7.2 15.5 6.5 14.8 6.5 14C6.5 13.2 7.2 12.5 8 12.5C8.8 12.5 9.5 13.2 9.5 14C9.5 14.8 8.8 15.5 8 15.5ZM13 12H3V1H13V12Z" />
|
||||
|
||||
@@ -446,6 +446,8 @@ export default class ObjectEntity extends IEntity {
|
||||
return ""
|
||||
case Configuration.nodeType.variableSet:
|
||||
return "SET"
|
||||
case Configuration.nodeType.switchEnum:
|
||||
return `Switch on ${this.Enum?.getName() ?? "Enum"}`
|
||||
}
|
||||
const keyNameSymbol = this.getHIDAttribute()
|
||||
if (keyNameSymbol) {
|
||||
@@ -548,6 +550,8 @@ export default class ObjectEntity extends IEntity {
|
||||
return Configuration.nodeColors.gray
|
||||
case Configuration.nodeType.dynamicCast:
|
||||
return Configuration.nodeColors.turquoise
|
||||
case Configuration.nodeType.switchEnum:
|
||||
return Configuration.nodeColors.lime
|
||||
}
|
||||
if (this.isEvent()) {
|
||||
return Configuration.nodeColors.red
|
||||
@@ -586,6 +590,7 @@ export default class ObjectEntity extends IEntity {
|
||||
case Configuration.nodeType.makeMap: return SVGIcon.makeMap
|
||||
case Configuration.nodeType.makeSet: return SVGIcon.makeSet
|
||||
case Configuration.nodeType.select: return SVGIcon.select
|
||||
case Configuration.nodeType.switchEnum: return SVGIcon.switch
|
||||
}
|
||||
if (this.nodeDisplayName().startsWith("Break")) {
|
||||
return SVGIcon.breakStruct
|
||||
|
||||
@@ -94,6 +94,10 @@ export default class Grammar {
|
||||
|
||||
static colorValue = this.byteNumber
|
||||
static word = P.regex(Grammar.Regex.Word)
|
||||
static pathQuotes = Grammar.regexMap(
|
||||
new RegExp(`"(${Grammar.Regex.PathOptSpace.source}|${Grammar.Regex.Symbol.source})"|'"(${Grammar.Regex.PathOptSpace.source}|${Grammar.Regex.Symbol.source})"'`),
|
||||
([_0, a, b, c]) => a ?? b ?? c
|
||||
)
|
||||
static path = Grammar.regexMap(
|
||||
new RegExp(`(${Grammar.Regex.Path.source})|"(${Grammar.Regex.PathOptSpace.source})"|'"(${Grammar.Regex.PathOptSpace.source})"'`),
|
||||
([_0, a, b, c]) => a ?? b ?? c
|
||||
@@ -127,6 +131,7 @@ export default class Grammar {
|
||||
|
||||
/**
|
||||
* @param {AnyValueConstructor<any>} type
|
||||
* @returns {Parsimmon.Parser<any>}
|
||||
*/
|
||||
static grammarFor(
|
||||
attribute,
|
||||
@@ -263,10 +268,7 @@ export default class Grammar {
|
||||
return result
|
||||
}
|
||||
|
||||
static createAttributeGrammar(
|
||||
entityType,
|
||||
valueSeparator = this.equalSeparation
|
||||
) {
|
||||
static createAttributeGrammar(entityType, valueSeparator = this.equalSeparation) {
|
||||
return P.seq(
|
||||
this.attributeName,
|
||||
valueSeparator,
|
||||
@@ -398,7 +400,7 @@ export default class Grammar {
|
||||
)
|
||||
|
||||
static fullReferenceEntity = P.lazy(() =>
|
||||
P.seq(this.typeReference, P.optWhitespace, this.path)
|
||||
P.seq(this.typeReference, P.optWhitespace, this.pathQuotes)
|
||||
.map(([type, _2, path]) =>
|
||||
new ObjectReferenceEntity({ type: type, path: path })
|
||||
)
|
||||
@@ -547,6 +549,26 @@ export default class Grammar {
|
||||
})
|
||||
)
|
||||
|
||||
static indexedArrayEntry = P.lazy(() => {
|
||||
return P.seq(
|
||||
this.symbol,
|
||||
this.regexMap(
|
||||
new RegExp(`\\s*\\(\\s*(\\d+)\\s*\\)\\s*\\=\\s*`),
|
||||
v => v[1]
|
||||
)
|
||||
)
|
||||
.chain(([symbol, _1]) =>
|
||||
this.grammarFor(ObjectEntity.attributes[symbol])
|
||||
.map(currentValue =>
|
||||
values => {
|
||||
if (!values[symbol]) {
|
||||
values[symbol] = []
|
||||
}
|
||||
values[symbol].push(currentValue)
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
static objectEntity = P.lazy(() =>
|
||||
P.seq(
|
||||
P.regex(/Begin\s+Object/),
|
||||
@@ -555,6 +577,7 @@ export default class Grammar {
|
||||
P.alt(
|
||||
this.customProperty,
|
||||
this.createAttributeGrammar(ObjectEntity),
|
||||
this.indexedArrayEntry
|
||||
)
|
||||
)
|
||||
.map(([_0, entry]) => entry)
|
||||
|
||||
Reference in New Issue
Block a user