mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-03 23:55:04 +08:00
Small serialization fixes
This commit is contained in:
10
dist/ueblueprint.js
vendored
10
dist/ueblueprint.js
vendored
@@ -5122,7 +5122,12 @@ class ObjectReferenceEntity extends IEntity {
|
||||
super();
|
||||
this.#type = type;
|
||||
this.#path = path;
|
||||
this.#full = full ?? `"${this.type + (this.path ? (`'${this.path}'`) : "")}"`;
|
||||
this.#full = full
|
||||
?? (
|
||||
this.type.includes("/") || this.path
|
||||
? `"${this.type + (this.path ? (`'${this.path}'`) : "")}"`
|
||||
: this.type
|
||||
);
|
||||
}
|
||||
|
||||
/** @returns {P<ObjectReferenceEntity>} */
|
||||
@@ -5162,7 +5167,7 @@ class ObjectReferenceEntity extends IEntity {
|
||||
}
|
||||
|
||||
static createNoneInstance() {
|
||||
return new ObjectReferenceEntity("None")
|
||||
return new ObjectReferenceEntity("None", "", "None")
|
||||
}
|
||||
|
||||
getName(dropCounter = false) {
|
||||
@@ -6436,6 +6441,7 @@ class ObjectEntity extends IEntity {
|
||||
obj.Node.getter = () => new ObjectReferenceEntity(
|
||||
this.PCGNode.type,
|
||||
`${this.Name}.${this.PCGNode.path}`,
|
||||
nodeRef.full,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
2
dist/ueblueprint.min.js
vendored
2
dist/ueblueprint.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -30,8 +30,8 @@ export default class ArrayEntity extends IEntity {
|
||||
).map(([_0, values, trailing]) => {
|
||||
values = values instanceof Array ? values : []
|
||||
let Self = this
|
||||
if (trailing !== undefined != Self.trailing) {
|
||||
Self = Self.flagTrailing()
|
||||
if ((trailing !== undefined) !== Self.trailing) {
|
||||
Self = Self.flagTrailing(trailing !== undefined)
|
||||
}
|
||||
const result = new Self(values)
|
||||
return result
|
||||
|
||||
@@ -346,6 +346,7 @@ export default class ObjectEntity extends IEntity {
|
||||
obj.Node.getter = () => new ObjectReferenceEntity(
|
||||
this.PCGNode.type,
|
||||
`${this.Name}.${this.PCGNode.path}`,
|
||||
nodeRef.full,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,11 @@ export default class ObjectReferenceEntity extends IEntity {
|
||||
super()
|
||||
this.#type = type
|
||||
this.#path = path
|
||||
this.#full = full ?? `"${this.type + (this.path ? (`'${this.path}'`) : "")}"`
|
||||
this.#full = full ?? (
|
||||
this.type.includes("/") || this.path
|
||||
? `"${this.type + (this.path ? (`'${this.path}'`) : "")}"`
|
||||
: this.type
|
||||
)
|
||||
}
|
||||
|
||||
/** @returns {P<ObjectReferenceEntity>} */
|
||||
@@ -89,7 +93,7 @@ export default class ObjectReferenceEntity extends IEntity {
|
||||
}
|
||||
|
||||
static createNoneInstance() {
|
||||
return new ObjectReferenceEntity("None")
|
||||
return new ObjectReferenceEntity("None", "", "None")
|
||||
}
|
||||
|
||||
getName(dropCounter = false) {
|
||||
|
||||
@@ -1158,25 +1158,44 @@ test("StringEntity", () => {
|
||||
expect(() => grammar.parse("Hello")).toThrow()
|
||||
})
|
||||
|
||||
test("UnknownKeysValue", () => {
|
||||
test("Unknown", () => {
|
||||
const parser = IEntity.unknownEntityGrammar
|
||||
expect(parser.parse('"Hello"')).toBeInstanceOf(StringEntity)
|
||||
expect(parser.parse('"Hello"').serialize()).toEqual(`"Hello"`)
|
||||
expect(parser.parse("()")).toBeInstanceOf(NullEntity)
|
||||
expect(parser.parse("()").serialize()).toEqual("()")
|
||||
expect(parser.parse("8345")).toBeInstanceOf(NumberEntity)
|
||||
expect(parser.parse("8345").serialize()).toEqual("8345")
|
||||
expect(parser.parse("True")).toBeInstanceOf(BooleanEntity)
|
||||
expect(parser.parse("True").serialize()).toEqual("True")
|
||||
expect(parser.parse("False")).toBeInstanceOf(BooleanEntity)
|
||||
expect(parser.parse("False").serialize()).toEqual("False")
|
||||
expect(parser.parse("F0223D3742E67C0D9FEFB2A64946B7F0")).toBeInstanceOf(GuidEntity)
|
||||
expect(parser.parse("F0223D3742E67C0D9FEFB2A64946B7F0").serialize()).toEqual("F0223D3742E67C0D9FEFB2A64946B7F0")
|
||||
expect(parser.parse("None")).toBeInstanceOf(ObjectReferenceEntity)
|
||||
expect(parser.parse("None").serialize()).toEqual("None")
|
||||
expect(parser.parse("SYMBOL1")).toBeInstanceOf(SymbolEntity)
|
||||
expect(parser.parse("SYMBOL1").serialize()).toEqual("SYMBOL1")
|
||||
expect(parser.parse("Symbol_2_3_4")).toBeInstanceOf(SymbolEntity)
|
||||
expect(parser.parse("Symbol_2_3_4").serialize()).toEqual("Symbol_2_3_4")
|
||||
expect(parser.parse("(X=-0.495,Y=+765.0,Z=7,W=56)")).toBeInstanceOf(Vector4DEntity)
|
||||
expect(parser.parse("(X=-0.495,Y=+765.0,Z=7,W=56)").serialize()).toEqual("(X=-0.495,Y=765.0,Z=7,W=56)")
|
||||
expect(parser.parse("(X=-0.495, Y=0, )")).toBeInstanceOf(Vector2DEntity)
|
||||
expect(parser.parse("(X=-0.495, Y=0, )").serialize()).toEqual("(X=-0.495,Y=0,)")
|
||||
expect(parser.parse("(X=-0.495,Y=+765.0,Z=7)")).toBeInstanceOf(VectorEntity)
|
||||
expect(parser.parse("(X=-0.495,Y=+765.0,Z=7)").serialize()).toEqual("(X=-0.495,Y=765.0,Z=7)")
|
||||
expect(parser.parse("(R=1.000000,P=7.6,Y=+88.99)")).toBeInstanceOf(RotatorEntity)
|
||||
expect(parser.parse("(R=1.000000,P=7.6,Y=+88.99)").serialize()).toEqual("(R=1.000000,P=7.6,Y=88.99)")
|
||||
expect(parser.parse("(R=0.000000,G=0.660000,B=1.000000,A=1.000000)")).toBeInstanceOf(LinearColorEntity)
|
||||
expect(parser.parse("(R=0.000000,G=0.660000,B=1.000000,A=1.000000)").serialize()).toEqual("(R=0.000000,G=0.660000,B=1.000000,A=1.000000)")
|
||||
expect(parser.parse(`Class'"/Script/Engine.KismetSystemLibrary"'`)).toBeInstanceOf(ObjectReferenceEntity)
|
||||
expect(parser.parse(`Class'"/Script/Engine.KismetSystemLibrary"'`).serialize()).toEqual(`Class'"/Script/Engine.KismetSystemLibrary"'`)
|
||||
expect(parser.parse("(1,2,3,4,5,6,7,8,9)")).toBeInstanceOf(ArrayEntity)
|
||||
expect(parser.parse("(1,2,3,4,5,6,7,8,9)").serialize()).toEqual("(1,2,3,4,5,6,7,8,9)")
|
||||
expect(parser.parse(`("Hello", "World",)`)).toBeInstanceOf(ArrayEntity)
|
||||
expect(parser.parse(`("Hello", "World",)`).serialize()).toEqual(`("Hello","World",)`)
|
||||
expect(parser.parse(`("Alpha", 123, Beta, "Gamma", "Delta", 99)`)).toBeInstanceOf(ArrayEntity)
|
||||
expect(parser.parse(`("Alpha", 123, Beta, "Gamma", "Delta", 99)`).serialize()).toEqual(`("Alpha",123,Beta,"Gamma","Delta",99)`)
|
||||
})
|
||||
|
||||
test("UnknownKeysEntity", () => {
|
||||
|
||||
Reference in New Issue
Block a user