mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-04-14 19:17:36 +08:00
Decoding code fixes
This commit is contained in:
1194
dist/ueblueprint.js
vendored
1194
dist/ueblueprint.js
vendored
File diff suppressed because it is too large
Load Diff
8
dist/ueblueprint.min.js
vendored
8
dist/ueblueprint.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -20,7 +20,7 @@ export default function nodeTemplateClass(nodeEntity) {
|
||||
|| nodeEntity.getClass() === Configuration.paths.callArrayFunction
|
||||
) {
|
||||
const memberParent = nodeEntity.FunctionReference?.MemberParent?.path ?? ""
|
||||
const memberName = nodeEntity.FunctionReference?.MemberName
|
||||
const memberName = nodeEntity.FunctionReference?.MemberName?.valueOf()
|
||||
if (
|
||||
memberName && (
|
||||
memberParent === Configuration.paths.kismetMathLibrary
|
||||
@@ -96,13 +96,15 @@ export default function nodeTemplateClass(nodeEntity) {
|
||||
}
|
||||
return MetasoundNodeTemplate
|
||||
case Configuration.paths.niagaraNodeOp:
|
||||
if ([
|
||||
"Boolean::LogicEq",
|
||||
"Boolean::LogicNEq",
|
||||
"Numeric::Abs",
|
||||
"Numeric::Add",
|
||||
"Numeric::Mul",
|
||||
].includes(nodeEntity.OpName)) {
|
||||
if (
|
||||
[
|
||||
"Boolean::LogicEq",
|
||||
"Boolean::LogicNEq",
|
||||
"Numeric::Abs",
|
||||
"Numeric::Add",
|
||||
"Numeric::Mul",
|
||||
].includes(nodeEntity.OpName?.valueOf())
|
||||
) {
|
||||
return VariableOperationNodeTemplate
|
||||
}
|
||||
break
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import Configuration from "../Configuration.js"
|
||||
import Utility from "../Utility.js"
|
||||
import BooleanEntity from "../entity/BooleanEntity.js"
|
||||
import LinearColorEntity from "../entity/LinearColorEntity.js"
|
||||
import MirroredEntity from "../entity/MirroredEntity.js"
|
||||
import VectorEntity from "../entity/VectorEntity.js"
|
||||
|
||||
const sequencerScriptingNameRegex = /\/Script\/SequencerScripting\.MovieSceneScripting(.+)Channel/
|
||||
const keyNameValue = {
|
||||
@@ -56,18 +60,18 @@ export default function nodeTitle(entity) {
|
||||
switch (entity.getType()) {
|
||||
case Configuration.paths.asyncAction:
|
||||
if (entity.ProxyFactoryFunctionName) {
|
||||
return Utility.formatStringName(entity.ProxyFactoryFunctionName)
|
||||
return Utility.formatStringName(entity.ProxyFactoryFunctionName?.valueOf())
|
||||
}
|
||||
case Configuration.paths.actorBoundEvent:
|
||||
case Configuration.paths.componentBoundEvent:
|
||||
return `${Utility.formatStringName(entity.DelegatePropertyName)} (${entity.ComponentPropertyName ?? "Unknown"})`
|
||||
return `${Utility.formatStringName(entity.DelegatePropertyName?.valueOf())} (${entity.ComponentPropertyName?.valueOf() ?? "Unknown"})`
|
||||
case Configuration.paths.callDelegate:
|
||||
return `Call ${entity.DelegateReference?.MemberName ?? "None"}`
|
||||
return `Call ${entity.DelegateReference?.MemberName?.valueOf() ?? "None"}`
|
||||
case Configuration.paths.createDelegate:
|
||||
return "Create Event"
|
||||
case Configuration.paths.customEvent:
|
||||
if (entity.CustomFunctionName) {
|
||||
return entity.CustomFunctionName
|
||||
return entity.CustomFunctionName?.valueOf()
|
||||
}
|
||||
case Configuration.paths.dynamicCast:
|
||||
if (!entity.TargetType) {
|
||||
@@ -77,7 +81,7 @@ export default function nodeTitle(entity) {
|
||||
case Configuration.paths.enumLiteral:
|
||||
return `Literal enum ${entity.Enum?.getName()}`
|
||||
case Configuration.paths.event:
|
||||
return `Event ${(entity.EventReference?.MemberName ?? "").replace(/^Receive/, "")}`
|
||||
return `Event ${(entity.EventReference?.MemberName?.valueOf() ?? "").replace(/^Receive/, "")}`
|
||||
case Configuration.paths.executionSequence:
|
||||
return "Sequence"
|
||||
case Configuration.paths.forEachElementInEnum:
|
||||
@@ -85,9 +89,9 @@ export default function nodeTitle(entity) {
|
||||
case Configuration.paths.forEachLoopWithBreak:
|
||||
return "For Each Loop with Break"
|
||||
case Configuration.paths.functionEntry:
|
||||
return entity.FunctionReference?.MemberName === "UserConstructionScript"
|
||||
return entity.FunctionReference?.MemberName?.valueOf() === "UserConstructionScript"
|
||||
? "Construction Script"
|
||||
: entity.FunctionReference?.MemberName
|
||||
: entity.FunctionReference?.MemberName?.valueOf()
|
||||
case Configuration.paths.functionResult:
|
||||
return "Return Node"
|
||||
case Configuration.paths.ifThenElse:
|
||||
@@ -99,35 +103,29 @@ export default function nodeTitle(entity) {
|
||||
case Configuration.paths.materialExpressionComponentMask: {
|
||||
const materialObject = entity.getMaterialSubobject()
|
||||
return `Mask ( ${Configuration.rgba
|
||||
.filter(k => /** @type {MirroredEntity<any>} */(materialObject[k]).get() === true)
|
||||
.filter(k => /** @type {MirroredEntity<typeof BooleanEntity>} */(materialObject[k]).getter().value === true)
|
||||
.map(v => v + " ")
|
||||
.join("")})`
|
||||
}
|
||||
case Configuration.paths.materialExpressionConstant:
|
||||
input ??= [entity.getCustomproperties().find(pinEntity => pinEntity.PinName == "Value")?.DefaultValue]
|
||||
input ??= [entity.getCustomproperties().find(pinEntity => pinEntity.PinName.valueOf() == "Value")?.DefaultValue]
|
||||
case Configuration.paths.materialExpressionConstant2Vector:
|
||||
input ??= [
|
||||
entity.getCustomproperties().find(pinEntity => pinEntity.PinName == "X")?.DefaultValue,
|
||||
entity.getCustomproperties().find(pinEntity => pinEntity.PinName == "Y")?.DefaultValue,
|
||||
entity.getCustomproperties().find(pinEntity => pinEntity.PinName?.valueOf() == "X")?.DefaultValue,
|
||||
entity.getCustomproperties().find(pinEntity => pinEntity.PinName?.valueOf() == "Y")?.DefaultValue,
|
||||
]
|
||||
case Configuration.paths.materialExpressionConstant3Vector:
|
||||
if (!input) {
|
||||
/** @type {VectorEntity} */
|
||||
const vector = entity.getCustomproperties()
|
||||
.find(pinEntity => pinEntity.PinName == "Constant")
|
||||
?.DefaultValue
|
||||
input = [vector.X, vector.Y, vector.Z]
|
||||
}
|
||||
case Configuration.paths.materialExpressionConstant4Vector:
|
||||
if (!input) {
|
||||
/** @type {LinearColorEntity} */
|
||||
const vector = entity.getCustomproperties()
|
||||
.find(pinEntity => pinEntity.PinName == "Constant")
|
||||
.find(pinEntity => pinEntity.PinName?.valueOf() == "Constant")
|
||||
?.DefaultValue
|
||||
input = [vector.R, vector.G, vector.B, vector.A].map(v => v.valueOf())
|
||||
input = vector instanceof VectorEntity ? [vector.X, vector.Y, vector.Z].map(v => v.valueOf())
|
||||
: vector instanceof LinearColorEntity ? [vector.R, vector.G, vector.B, vector.A].map(v => v.valueOf())
|
||||
: /** @type {Number[]} */([])
|
||||
}
|
||||
if (input.length > 0) {
|
||||
return input.map(v => Utility.printExponential(v)).reduce((acc, cur) => acc + "," + cur)
|
||||
return input.map(v => Utility.printExponential(v)).join(",")
|
||||
}
|
||||
break
|
||||
case Configuration.paths.materialExpressionFunctionInput: {
|
||||
@@ -165,7 +163,7 @@ export default function nodeTitle(entity) {
|
||||
return "Output"
|
||||
case Configuration.paths.spawnActorFromClass:
|
||||
let className = entity.getCustomproperties()
|
||||
.find(pinEntity => pinEntity.PinName == "ReturnValue")
|
||||
.find(pinEntity => pinEntity.PinName.valueOf() == "ReturnValue")
|
||||
?.PinType
|
||||
?.PinSubCategoryObject
|
||||
?.getName()
|
||||
@@ -232,7 +230,7 @@ export default function nodeTitle(entity) {
|
||||
return Utility.formatStringName(settingsObject.BlueprintElementType.getName())
|
||||
}
|
||||
if (settingsObject.Operation) {
|
||||
const match = settingsObject.Name.match(/PCGMetadata(\w+)Settings_\d+/)
|
||||
const match = settingsObject.Name?.valueOf().match(/PCGMetadata(\w+)Settings_\d+/)
|
||||
if (match) {
|
||||
return Utility.formatStringName(match[1] + ": " + settingsObject.Operation)
|
||||
}
|
||||
@@ -242,9 +240,9 @@ export default function nodeTitle(entity) {
|
||||
return settingsSubgraphObject.Graph.getName()
|
||||
}
|
||||
}
|
||||
let memberName = entity.FunctionReference?.MemberName
|
||||
let memberName = entity.FunctionReference?.MemberName?.valueOf()
|
||||
if (memberName) {
|
||||
const memberParent = entity.FunctionReference.MemberParent?.path ?? ""
|
||||
const memberParent = entity.FunctionReference.MemberParent?.path?.valueOf() ?? ""
|
||||
switch (memberName) {
|
||||
case "AddKey":
|
||||
let result = memberParent.match(sequencerScriptingNameRegex)
|
||||
@@ -379,7 +377,7 @@ export default function nodeTitle(entity) {
|
||||
return Utility.formatStringName(memberName)
|
||||
}
|
||||
if (entity.OpName) {
|
||||
switch (entity.OpName) {
|
||||
switch (entity.OpName.valueOf()) {
|
||||
case "Boolean::LogicAnd": return "Logic AND"
|
||||
case "Boolean::LogicEq": return "=="
|
||||
case "Boolean::LogicNEq": return "!="
|
||||
@@ -392,10 +390,10 @@ export default function nodeTitle(entity) {
|
||||
case "Numeric::DistancePos": return "Distance"
|
||||
case "Numeric::Mul": return String.fromCharCode(0x2a2f)
|
||||
}
|
||||
return Utility.formatStringName(entity.OpName).replaceAll("::", " ")
|
||||
return Utility.formatStringName(entity.OpName.valueOf()).replaceAll("::", " ")
|
||||
}
|
||||
if (entity.FunctionDisplayName) {
|
||||
return Utility.formatStringName(entity.FunctionDisplayName)
|
||||
return Utility.formatStringName(entity.FunctionDisplayName.valueOf())
|
||||
}
|
||||
if (entity.ObjectRef) {
|
||||
return entity.ObjectRef.getName()
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import Configuration from "../Configuration.js"
|
||||
import ArrayEntity from "../entity/ArrayEntity.js"
|
||||
import GuidEntity from "../entity/GuidEntity.js"
|
||||
import NaturalNumberEntity from "../entity/NaturalNumberEntity.js"
|
||||
import PinEntity from "../entity/PinEntity.js"
|
||||
import StringEntity from "../entity/StringEntity.js"
|
||||
|
||||
/** @param {PinEntity} pinEntity */
|
||||
const indexFromUpperCaseLetterName = pinEntity =>
|
||||
pinEntity.PinName.match(/^\s*([A-Z])\s*$/)?.[1]?.charCodeAt(0) - "A".charCodeAt(0)
|
||||
pinEntity.PinName?.valueOf().match(/^\s*([A-Z])\s*$/)?.[1]?.charCodeAt(0) - "A".charCodeAt(0)
|
||||
|
||||
/** @param {ObjectEntity} entity */
|
||||
export default function nodeVariadic(entity) {
|
||||
@@ -19,7 +22,7 @@ export default function nodeVariadic(entity) {
|
||||
switch (type) {
|
||||
case Configuration.paths.commutativeAssociativeBinaryOperator:
|
||||
case Configuration.paths.promotableOperator:
|
||||
name = entity.FunctionReference?.MemberName
|
||||
name = entity.FunctionReference?.MemberName?.valueOf()
|
||||
switch (name) {
|
||||
default:
|
||||
if (
|
||||
@@ -50,7 +53,7 @@ export default function nodeVariadic(entity) {
|
||||
pinIndexFromEntity ??= indexFromUpperCaseLetterName
|
||||
pinNameFromIndex ??= (index, min = -1, max = -1) => {
|
||||
const result = String.fromCharCode(index >= 0 ? index : max + "A".charCodeAt(0) + 1)
|
||||
entity.NumAdditionalInputs = pinEntities().length - 1
|
||||
entity.NumAdditionalInputs = new NaturalNumberEntity(pinEntities().length - 1)
|
||||
return result
|
||||
}
|
||||
break
|
||||
@@ -58,7 +61,7 @@ export default function nodeVariadic(entity) {
|
||||
break
|
||||
case Configuration.paths.multiGate:
|
||||
pinEntities ??= () => entity.getPinEntities().filter(pinEntity => pinEntity.isOutput())
|
||||
pinIndexFromEntity ??= pinEntity => Number(pinEntity.PinName.match(/^\s*Out[_\s]+(\d+)\s*$/i)?.[1])
|
||||
pinIndexFromEntity ??= pinEntity => Number(pinEntity.PinName?.valueOf().match(/^\s*Out[_\s]+(\d+)\s*$/i)?.[1])
|
||||
pinNameFromIndex ??= (index, min = -1, max = -1, newPin) =>
|
||||
`Out ${index >= 0 ? index : min > 0 ? "Out 0" : max + 1}`
|
||||
break
|
||||
@@ -74,26 +77,26 @@ export default function nodeVariadic(entity) {
|
||||
// break
|
||||
case Configuration.paths.switchInteger:
|
||||
pinEntities ??= () => entity.getPinEntities().filter(pinEntity => pinEntity.isOutput())
|
||||
pinIndexFromEntity ??= pinEntity => Number(pinEntity.PinName.match(/^\s*(\d+)\s*$/)?.[1])
|
||||
pinIndexFromEntity ??= pinEntity => Number(pinEntity.PinName?.valueOf().match(/^\s*(\d+)\s*$/)?.[1])
|
||||
pinNameFromIndex ??= (index, min = -1, max = -1, newPin) => (index < 0 ? max + 1 : index).toString()
|
||||
break
|
||||
case Configuration.paths.switchGameplayTag:
|
||||
pinNameFromIndex ??= (index, min = -1, max = -1, newPin) => {
|
||||
const result = `Case_${index >= 0 ? index : min > 0 ? "0" : max + 1}`
|
||||
entity.PinNames ??= []
|
||||
entity.PinNames.push(result)
|
||||
delete entity.PinTags[entity.PinTags.length - 1]
|
||||
entity.PinTags[entity.PinTags.length] = null
|
||||
entity.PinNames ??= new ArrayEntity()
|
||||
entity.PinNames.values.push(new StringEntity(result))
|
||||
delete entity.PinTags.values[entity.PinTags.length - 1]
|
||||
entity.PinTags.values[entity.PinTags.length] = null
|
||||
return result
|
||||
}
|
||||
case Configuration.paths.switchName:
|
||||
case Configuration.paths.switchString:
|
||||
pinEntities ??= () => entity.getPinEntities().filter(pinEntity => pinEntity.isOutput())
|
||||
pinIndexFromEntity ??= pinEntity => Number(pinEntity.PinName.match(/^\s*Case[_\s]+(\d+)\s*$/i)?.[1])
|
||||
pinIndexFromEntity ??= pinEntity => Number(pinEntity.PinName.valueOf().match(/^\s*Case[_\s]+(\d+)\s*$/i)?.[1])
|
||||
pinNameFromIndex ??= (index, min = -1, max = -1, newPin) => {
|
||||
const result = `Case_${index >= 0 ? index : min > 0 ? "0" : max + 1}`
|
||||
entity.PinNames ??= []
|
||||
entity.PinNames.push(result)
|
||||
entity.PinNames ??= new ArrayEntity()
|
||||
entity.PinNames.values.push(new StringEntity(result))
|
||||
return result
|
||||
}
|
||||
break
|
||||
@@ -138,8 +141,8 @@ export default function nodeVariadic(entity) {
|
||||
}
|
||||
)
|
||||
const newPin = new PinEntity(modelPin)
|
||||
newPin.PinId = GuidEntity.generateGuid()
|
||||
newPin.PinName = pinNameFromIndex(index, min, max, newPin)
|
||||
newPin.PinId = new GuidEntity()
|
||||
newPin.PinName = new StringEntity(pinNameFromIndex(index, min, max, newPin))
|
||||
newPin.PinToolTip = undefined
|
||||
entity.getCustomproperties(true).push(newPin)
|
||||
return newPin
|
||||
|
||||
@@ -54,15 +54,15 @@ const pinColorMaterial = css`120, 120, 120`
|
||||
|
||||
/** @param {PinEntity} entity */
|
||||
export default function pinColor(entity) {
|
||||
if (entity.PinType.PinCategory == "mask") {
|
||||
if (entity.PinType.PinCategory?.valueOf() == "mask") {
|
||||
const result = colors[entity.PinType.PinSubCategory]
|
||||
if (result) {
|
||||
return result
|
||||
}
|
||||
} else if (entity.PinType.PinCategory == "optional") {
|
||||
} else if (entity.PinType.PinCategory?.valueOf() == "optional") {
|
||||
return pinColorMaterial
|
||||
}
|
||||
return colors[entity.getType()]
|
||||
?? colors[entity.PinType.PinCategory.toLowerCase()]
|
||||
?? colors[entity.PinType.PinCategory?.valueOf().toLowerCase()]
|
||||
?? colors["default"]
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import P from "parsernostrum"
|
||||
import IPrintableEntity from "./IPrintableEntity.js"
|
||||
import InvariantTextEntity from "./InvariantTextEntity.js"
|
||||
import LocalizedTextEntity from "./LocalizedTextEntity.js"
|
||||
import StringEntity from "./StringEntity.js"
|
||||
import IEntity from "./IEntity.js"
|
||||
|
||||
export default class FormatTextEntity extends IPrintableEntity {
|
||||
export default class FormatTextEntity extends IEntity {
|
||||
|
||||
static attributeSeparator = ", "
|
||||
static lookbehind = ["LOCGEN_FORMAT_NAMED", "LOCGEN_FORMAT_ORDERED"]
|
||||
@@ -31,13 +31,12 @@ export default class FormatTextEntity extends IPrintableEntity {
|
||||
this.values = values
|
||||
}
|
||||
|
||||
print() {
|
||||
const pattern = this.values?.[0]?.print() // The pattern is always the first element of the array
|
||||
valueOf() {
|
||||
const pattern = this.values?.[0]?.valueOf() // The pattern is always the first element of the array
|
||||
if (!pattern) {
|
||||
return ""
|
||||
}
|
||||
|
||||
const values = this.values.slice(1).map(v => v.print())
|
||||
const values = this.values.slice(1).map(v => v?.valueOf())
|
||||
let result = this.lookbehind == "LOCGEN_FORMAT_NAMED"
|
||||
? pattern.replaceAll(/\{([a-zA-Z]\w*)\}/g, (substring, arg) => {
|
||||
const argLocation = values.indexOf(arg) + 1
|
||||
@@ -59,7 +58,9 @@ export default class FormatTextEntity extends IPrintableEntity {
|
||||
toString(
|
||||
insideString = false,
|
||||
indentation = "",
|
||||
printKey = this.Self().printKey,
|
||||
Self = this.Self(),
|
||||
printKey = Self.printKey,
|
||||
wrap = Self.wrap,
|
||||
) {
|
||||
const separator = this.Self().attributeSeparator
|
||||
return this.lookbehind + "("
|
||||
|
||||
@@ -16,7 +16,7 @@ export default class IEntity {
|
||||
/** @type {(k: String) => String} */
|
||||
static printKey = k => k
|
||||
/** @type {P<IEntity>} */
|
||||
static grammar = /** @type {any} */(P.failure())
|
||||
static grammar = P.lazy(() => this.unknownEntity)
|
||||
/** @type {P<IEntity>} */
|
||||
static unknownEntityGrammar
|
||||
static unknownEntity
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
import IEntity from "./IEntity.js"
|
||||
|
||||
export default class IPrintableEntity extends IEntity {
|
||||
|
||||
print() {
|
||||
return this.toString()
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import P from "parsernostrum"
|
||||
import IPrintableEntity from "./IPrintableEntity.js"
|
||||
import IEntity from "./IEntity.js"
|
||||
|
||||
export default class InvariantTextEntity extends IPrintableEntity {
|
||||
export default class InvariantTextEntity extends IEntity {
|
||||
|
||||
static lookbehind = "INVTEXT"
|
||||
|
||||
@@ -23,15 +23,7 @@ export default class InvariantTextEntity extends IPrintableEntity {
|
||||
this.value = value
|
||||
}
|
||||
|
||||
print() {
|
||||
let xxxx = P.alt(
|
||||
P.seq(
|
||||
P.reg(new RegExp(`${this.lookbehind}\\s*\\(`)),
|
||||
P.doubleQuotedString,
|
||||
P.reg(/\s*\)/)
|
||||
).map(([_0, value, _2]) => Number(value)),
|
||||
P.reg(new RegExp(this.lookbehind)).map(() => 0) // InvariantTextEntity can not have arguments
|
||||
)
|
||||
valueOf() {
|
||||
return this.value
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import P from "parsernostrum"
|
||||
import Utility from "../Utility.js"
|
||||
import Grammar from "../serialization/Grammar.js"
|
||||
import IPrintableEntity from "./IPrintableEntity.js"
|
||||
import StringEntity from "./StringEntity.js"
|
||||
import IEntity from "./IEntity.js"
|
||||
|
||||
export default class LocalizedTextEntity extends IPrintableEntity {
|
||||
export default class LocalizedTextEntity extends IEntity {
|
||||
|
||||
static attributeSeparator = ", "
|
||||
static printKey = k => ""
|
||||
@@ -41,7 +41,7 @@ export default class LocalizedTextEntity extends IPrintableEntity {
|
||||
/** @type {InstanceType<typeof LocalizedTextEntity.attributes.value>} */ this.value
|
||||
}
|
||||
|
||||
print() {
|
||||
valueOf() {
|
||||
return Utility.capitalFirstLetter(this.value.valueOf())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,9 @@ export default class NumberEntity extends IEntity {
|
||||
toString(
|
||||
insideString = false,
|
||||
indentation = "",
|
||||
printKey = this.Self().printKey,
|
||||
Self = this.Self(),
|
||||
printKey = Self.printKey,
|
||||
wrap = Self.wrap,
|
||||
) {
|
||||
if (this.value === Number.POSITIVE_INFINITY) {
|
||||
return "+inf"
|
||||
|
||||
@@ -16,6 +16,7 @@ import LinearColorEntity from "./LinearColorEntity.js"
|
||||
import MacroGraphReferenceEntity from "./MacroGraphReferenceEntity.js"
|
||||
import MirroredEntity from "./MirroredEntity.js"
|
||||
import NaturalNumberEntity from "./NaturalNumberEntity.js"
|
||||
import NullEntity from "./NullEntity.js"
|
||||
import ObjectReferenceEntity from "./ObjectReferenceEntity.js"
|
||||
import PinEntity from "./PinEntity.js"
|
||||
import ScriptVariableEntity from "./ScriptVariableEntity.js"
|
||||
@@ -45,6 +46,7 @@ export default class ObjectEntity extends IEntity {
|
||||
ObjectRef: ObjectReferenceEntity,
|
||||
BlueprintElementType: ObjectReferenceEntity,
|
||||
BlueprintElementInstance: ObjectReferenceEntity,
|
||||
PinTags: ArrayEntity.of(NullEntity).flagInlined(),
|
||||
PinNames: ArrayEntity.of(StringEntity).flagInlined(),
|
||||
AxisKey: SymbolEntity,
|
||||
InputAxisKey: SymbolEntity,
|
||||
@@ -280,6 +282,7 @@ export default class ObjectEntity extends IEntity {
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.OpName>} */ this.OpName
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.OutputPins>} */ this.OutputPins
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.PCGNode>} */ this.PCGNode
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.PinTags>} */ this.PinTags
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.PinNames>} */ this.PinNames
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.PositionX>} */ this.PositionX
|
||||
/** @type {InstanceType<typeof ObjectEntity.attributes.PositionY>} */ this.PositionY
|
||||
@@ -324,7 +327,6 @@ export default class ObjectEntity extends IEntity {
|
||||
const rgbaPins = Configuration.rgba.map(pinName =>
|
||||
this.getPinEntities().find(pin => pin.PinName.toString() === pinName && (pin.recomputesNodeTitleOnChange = true))
|
||||
)
|
||||
const attribute = {}
|
||||
const silentBool = MirroredEntity.of(BooleanEntity).withDefault().flagSilent()
|
||||
obj["R"] = new silentBool(() => rgbaPins[0].DefaultValue)
|
||||
obj["G"] = new silentBool(() => rgbaPins[1].DefaultValue)
|
||||
@@ -400,7 +402,7 @@ export default class ObjectEntity extends IEntity {
|
||||
if (dropCounter) {
|
||||
return this.getNameAndCounter()[0]
|
||||
}
|
||||
return this.Name.print()
|
||||
return this.Name.valueOf()
|
||||
}
|
||||
|
||||
/** @returns {[String, Number]} */
|
||||
@@ -617,7 +619,9 @@ export default class ObjectEntity extends IEntity {
|
||||
toString(
|
||||
insideString = false,
|
||||
indentation = "",
|
||||
printKey = this.Self().printKey,
|
||||
Self = this.Self(),
|
||||
printKey = Self.printKey,
|
||||
wrap = Self.wrap,
|
||||
) {
|
||||
const moreIndentation = indentation + Configuration.indentation
|
||||
let result = indentation + "Begin Object"
|
||||
@@ -626,7 +630,7 @@ export default class ObjectEntity extends IEntity {
|
||||
+ (this.Archetype ? ` Archetype=${this.Archetype.toString(insideString)}` : "")
|
||||
+ (this.ExportPath?.type || this.ExportPath?.path ? ` ExportPath=${this.ExportPath.toString(insideString)}` : "")
|
||||
+ "\n"
|
||||
+ super.toString(insideString, moreIndentation, k => this[k] instanceof ObjectEntity ? "" : k)
|
||||
+ super.toString(insideString, moreIndentation, Self, printKey, wrap)
|
||||
+ (!this.CustomProperties.Self().ignored
|
||||
? this.getCustomproperties().map(pin =>
|
||||
moreIndentation
|
||||
|
||||
@@ -90,7 +90,9 @@ export default class ObjectReferenceEntity extends IEntity {
|
||||
toString(
|
||||
insideString = false,
|
||||
indentation = "",
|
||||
printKey = this.Self().printKey,
|
||||
Self = this.Self(),
|
||||
printKey = Self.printKey,
|
||||
wrap = Self.wrap,
|
||||
) {
|
||||
if (insideString) {
|
||||
if (this.#fullEscaped === undefined) {
|
||||
|
||||
@@ -79,7 +79,7 @@ export default class PinEntity extends IEntity {
|
||||
ParentPin: PinReferenceEntity,
|
||||
DefaultValue:
|
||||
ComputedTypeEntity.from(
|
||||
// @ts-expect-error
|
||||
/** @param {PinEntity} pinEntity */
|
||||
pinEntity => pinEntity.getEntityType(true) ?? StringEntity
|
||||
).flagSerialized(),
|
||||
AutogeneratedDefaultValue: StringEntity,
|
||||
@@ -197,6 +197,7 @@ export default class PinEntity extends IEntity {
|
||||
return category
|
||||
}
|
||||
|
||||
/** @returns {typeof IEntity} */
|
||||
getEntityType(alternative = false) {
|
||||
const typeString = this.getType()
|
||||
const entity = PinEntity.#typeEntityMap[typeString]
|
||||
|
||||
@@ -28,7 +28,9 @@ export default class PinReferenceEntity extends IEntity {
|
||||
toString(
|
||||
insideString = false,
|
||||
indentation = "",
|
||||
printKey = this.Self().printKey,
|
||||
Self = this.Self(),
|
||||
printKey = Self.printKey,
|
||||
wrap = Self.wrap,
|
||||
) {
|
||||
return this.objectName.toString() + " " + this.pinGuid.toString()
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import P from "parsernostrum"
|
||||
import Utility from "../Utility.js"
|
||||
import IPrintableEntity from "./IPrintableEntity.js"
|
||||
import IEntity from "./IEntity.js"
|
||||
|
||||
export default class StringEntity extends IPrintableEntity {
|
||||
export default class StringEntity extends IEntity {
|
||||
|
||||
static grammar = /** @type {P<StringEntity>} */(
|
||||
P.doubleQuotedString
|
||||
@@ -16,10 +16,6 @@ export default class StringEntity extends IPrintableEntity {
|
||||
this.value = value
|
||||
}
|
||||
|
||||
print() {
|
||||
return this.value
|
||||
}
|
||||
|
||||
valueOf() {
|
||||
return this.value
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ test("FormatTextEntity", () => {
|
||||
let grammar = FormatTextEntity.grammar
|
||||
|
||||
let value = grammar.parse('LOCGEN_FORMAT_NAMED(NSLOCTEXT("KismetSchema", "SplitPinFriendlyNameFormat", "{PinDisplayName} {ProtoPinDisplayName}"), "PinDisplayName", "Out Hit", "ProtoPinDisplayName", "Blocking Hit")')
|
||||
expect(value.print()).toEqual("Out Hit Blocking Hit")
|
||||
expect(value.valueOf()).toEqual("Out Hit Blocking Hit")
|
||||
expect(value.toString())
|
||||
.toEqual('LOCGEN_FORMAT_NAMED(NSLOCTEXT("KismetSchema", "SplitPinFriendlyNameFormat", "{PinDisplayName} {ProtoPinDisplayName}"), "PinDisplayName", "Out Hit", "ProtoPinDisplayName", "Blocking Hit")')
|
||||
|
||||
@@ -272,7 +272,7 @@ test("FormatTextEntity", () => {
|
||||
"float",
|
||||
"InRangeMin"
|
||||
)`)
|
||||
expect(value.print())
|
||||
expect(value.valueOf())
|
||||
.toEqual(`If InRangeMin = InRangeMax, then that density value is mapped to the average of OutRangeMin and OutRangeMax\nAttribute type is "float" and its exact name is "InRangeMin"`)
|
||||
expect(value.toString())
|
||||
.toEqual(String.raw`LOCGEN_FORMAT_ORDERED(NSLOCTEXT("PCGSettings", "OverridableParamPinTooltip", "{0}Attribute type is \"{1}\" and its exact name is \"{2}\""), "If InRangeMin = InRangeMax, then that density value is mapped to the average of OutRangeMin and OutRangeMax\n", "float", "InRangeMin")`)
|
||||
@@ -938,7 +938,7 @@ test("StringEntity", () => {
|
||||
expect(value).toEqual(new StringEntity(""))
|
||||
expect(value.equals(new StringEntity(""))).toBeTruthy()
|
||||
expect(value.equals(new StringEntity("1"))).toBeFalsy()
|
||||
expect(value.print()).toEqual("")
|
||||
expect(value.valueOf()).toEqual("")
|
||||
expect(value.toString()).toEqual(`""`)
|
||||
expect(value.toString(true)).toEqual(String.raw`\"\"`)
|
||||
}
|
||||
@@ -948,7 +948,7 @@ test("StringEntity", () => {
|
||||
expect(value.equals(new StringEntity("hello"))).toBeTruthy()
|
||||
expect(value.equals(new SymbolEntity("hello"))).toBeFalsy()
|
||||
expect(value.equals(new NumberEntity())).toBeFalsy()
|
||||
expect(value.print()).toEqual("hello")
|
||||
expect(value.valueOf()).toEqual("hello")
|
||||
expect(value.toString()).toEqual(`"hello"`)
|
||||
expect(value.toString(true)).toEqual(String.raw`\"hello\"`)
|
||||
}
|
||||
@@ -957,7 +957,7 @@ test("StringEntity", () => {
|
||||
expect(value).toEqual(new StringEntity("hello world 123 - éèàò@ç ^ ^^^"))
|
||||
expect(value.equals(new StringEntity("hello world 123 - éèàò@ç ^ ^^^"))).toBeTruthy()
|
||||
expect(value.equals(new StringEntity("hello world 123 - éèàò@ç ^ ^^^-"))).toBeFalsy()
|
||||
expect(value.print()).toEqual("hello world 123 - éèàò@ç ^ ^^^")
|
||||
expect(value.valueOf()).toEqual("hello world 123 - éèàò@ç ^ ^^^")
|
||||
expect(value.toString()).toEqual(`"hello world 123 - éèàò@ç ^ ^^^"`)
|
||||
expect(value.toString(true)).toEqual(String.raw`\"hello world 123 - éèàò@ç ^ ^^^\"`)
|
||||
}
|
||||
@@ -966,7 +966,7 @@ test("StringEntity", () => {
|
||||
expect(value).toEqual(new StringEntity(String.raw`a:"hello", b:"word is \"world\""`))
|
||||
expect(value.equals(new StringEntity(String.raw`a:"hello", b:"word is \"world\""`))).toBeTruthy()
|
||||
expect(value.equals(new NumberEntity())).toBeFalsy()
|
||||
expect(value.print()).toEqual(String.raw`a:"hello", b:"word is \"world\""`)
|
||||
expect(value.valueOf()).toEqual(String.raw`a:"hello", b:"word is \"world\""`)
|
||||
expect(value.toString(false)).toEqual(String.raw`"a:\"hello\", b:\"word is \\\"world\\\"\""`)
|
||||
expect(value.toString(true)).toEqual(String.raw`\"a:\\\"hello\\\", b:\\\"word is \\\\\\\"world\\\\\\\"\\\"\"`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user