Minor fixes

This commit is contained in:
barsdeveloper
2024-09-09 16:55:52 +02:00
parent 4885a988f9
commit a763544b3b
7 changed files with 32 additions and 29 deletions

26
dist/ueblueprint.js vendored
View File

@@ -5251,14 +5251,14 @@ class PinTypeEntity extends IEntity {
...super.attributes, ...super.attributes,
PinCategory: StringEntity.withDefault(), PinCategory: StringEntity.withDefault(),
PinSubCategory: StringEntity.withDefault(), PinSubCategory: StringEntity.withDefault(),
PinSubCategoryObject: ObjectReferenceEntity.withDefault(), PinSubCategoryObject: ObjectReferenceEntity,
PinSubCategoryMemberReference: FunctionReferenceEntity.withDefault(), PinSubCategoryMemberReference: FunctionReferenceEntity,
ContainerType: SymbolEntity, ContainerType: SymbolEntity,
bIsReference: BooleanEntity.withDefault(), bIsReference: BooleanEntity,
bIsConst: BooleanEntity.withDefault(), bIsConst: BooleanEntity,
bIsWeakPointer: BooleanEntity.withDefault(), bIsWeakPointer: BooleanEntity,
bIsUObjectWrapper: BooleanEntity.withDefault(), bIsUObjectWrapper: BooleanEntity,
bSerializeAsSinglePrecisionFloat: BooleanEntity.withDefault(), bSerializeAsSinglePrecisionFloat: BooleanEntity,
} }
static grammar = this.createGrammar() static grammar = this.createGrammar()
@@ -5617,7 +5617,7 @@ class PinEntity extends IEntity {
bDefaultValueIsReadOnly: BooleanEntity.withDefault(), bDefaultValueIsReadOnly: BooleanEntity.withDefault(),
bDefaultValueIsIgnored: BooleanEntity.withDefault(), bDefaultValueIsIgnored: BooleanEntity.withDefault(),
bAdvancedView: BooleanEntity.withDefault(), bAdvancedView: BooleanEntity.withDefault(),
bOrphanedPin: BooleanEntity.withDefault(), bOrphanedPin: BooleanEntity,
} }
static grammar = this.createGrammar() static grammar = this.createGrammar()
@@ -5837,7 +5837,7 @@ class PinEntity extends IEntity {
} }
getSubCategory() { getSubCategory() {
return this.PinType.PinSubCategoryObject.path return this.PinType.PinSubCategoryObject?.path
} }
pinColor() { pinColor() {
@@ -6509,7 +6509,7 @@ class ObjectEntity extends IEntity {
getClass() { getClass() {
if (!this.#class) { if (!this.#class) {
this.#class = (this.Class?.path ? this.Class.path : this.Class?.type) this.#class = (this.Class?.path ? this.Class.path : this.Class?.type)
?? this.ExportPath.type ?? this.ExportPath?.type
?? ""; ?? "";
if (this.#class && !this.#class.startsWith("/")) { if (this.#class && !this.#class.startsWith("/")) {
// Old path names did not start with /Script or /Engine, check tests/resources/LegacyNodes.js // Old path names did not start with /Script or /Engine, check tests/resources/LegacyNodes.js
@@ -13425,10 +13425,10 @@ function initializeSerializerFactory() {
NumberEntity.grammar, NumberEntity.grammar,
Parsernostrum.alt( Parsernostrum.alt(
ObjectReferenceEntity.fullReferenceGrammar, ObjectReferenceEntity.fullReferenceGrammar,
Parsernostrum.regArray( Parsernostrum.regArray(new RegExp(
// @ts-expect-error // @ts-expect-error
new RegExp(`"(${Grammar.Regex.Path.source})'(${Grammar.symbol.getParser().regexp.source})'"`) `"(${Grammar.Regex.Path.source})'(${Grammar.Regex.Path.source}|${Grammar.symbol.getParser().regexp.source})'"`
).map(([full, type, path]) => new ObjectReferenceEntity(type, path, full)) )).map(([full, type, path]) => new ObjectReferenceEntity(type, path, full))
), ),
StringEntity.grammar, StringEntity.grammar,
LocalizedTextEntity.grammar, LocalizedTextEntity.grammar,

File diff suppressed because one or more lines are too long

View File

@@ -414,7 +414,7 @@ export default class ObjectEntity extends IEntity {
getClass() { getClass() {
if (!this.#class) { if (!this.#class) {
this.#class = (this.Class?.path ? this.Class.path : this.Class?.type) this.#class = (this.Class?.path ? this.Class.path : this.Class?.type)
?? this.ExportPath.type ?? this.ExportPath?.type
?? "" ?? ""
if (this.#class && !this.#class.startsWith("/")) { if (this.#class && !this.#class.startsWith("/")) {
// Old path names did not start with /Script or /Engine, check tests/resources/LegacyNodes.js // Old path names did not start with /Script or /Engine, check tests/resources/LegacyNodes.js

View File

@@ -93,7 +93,7 @@ export default class PinEntity extends IEntity {
bDefaultValueIsReadOnly: BooleanEntity.withDefault(), bDefaultValueIsReadOnly: BooleanEntity.withDefault(),
bDefaultValueIsIgnored: BooleanEntity.withDefault(), bDefaultValueIsIgnored: BooleanEntity.withDefault(),
bAdvancedView: BooleanEntity.withDefault(), bAdvancedView: BooleanEntity.withDefault(),
bOrphanedPin: BooleanEntity.withDefault(), bOrphanedPin: BooleanEntity,
} }
static grammar = this.createGrammar() static grammar = this.createGrammar()
@@ -313,7 +313,7 @@ export default class PinEntity extends IEntity {
} }
getSubCategory() { getSubCategory() {
return this.PinType.PinSubCategoryObject.path return this.PinType.PinSubCategoryObject?.path
} }
pinColor() { pinColor() {

View File

@@ -13,14 +13,14 @@ export default class PinTypeEntity extends IEntity {
...super.attributes, ...super.attributes,
PinCategory: StringEntity.withDefault(), PinCategory: StringEntity.withDefault(),
PinSubCategory: StringEntity.withDefault(), PinSubCategory: StringEntity.withDefault(),
PinSubCategoryObject: ObjectReferenceEntity.withDefault(), PinSubCategoryObject: ObjectReferenceEntity,
PinSubCategoryMemberReference: FunctionReferenceEntity.withDefault(), PinSubCategoryMemberReference: FunctionReferenceEntity,
ContainerType: SymbolEntity, ContainerType: SymbolEntity,
bIsReference: BooleanEntity.withDefault(), bIsReference: BooleanEntity,
bIsConst: BooleanEntity.withDefault(), bIsConst: BooleanEntity,
bIsWeakPointer: BooleanEntity.withDefault(), bIsWeakPointer: BooleanEntity,
bIsUObjectWrapper: BooleanEntity.withDefault(), bIsUObjectWrapper: BooleanEntity,
bSerializeAsSinglePrecisionFloat: BooleanEntity.withDefault(), bSerializeAsSinglePrecisionFloat: BooleanEntity,
} }
static grammar = this.createGrammar() static grammar = this.createGrammar()

View File

@@ -32,10 +32,10 @@ export default function initializeSerializerFactory() {
NumberEntity.grammar, NumberEntity.grammar,
Parsernostrum.alt( Parsernostrum.alt(
ObjectReferenceEntity.fullReferenceGrammar, ObjectReferenceEntity.fullReferenceGrammar,
Parsernostrum.regArray( Parsernostrum.regArray(new RegExp(
// @ts-expect-error // @ts-expect-error
new RegExp(`"(${Grammar.Regex.Path.source})'(${Grammar.symbol.getParser().regexp.source})'"`) `"(${Grammar.Regex.Path.source})'(${Grammar.Regex.Path.source}|${Grammar.symbol.getParser().regexp.source})'"`
).map(([full, type, path]) => new ObjectReferenceEntity(type, path, full)) )).map(([full, type, path]) => new ObjectReferenceEntity(type, path, full))
), ),
StringEntity.grammar, StringEntity.grammar,
LocalizedTextEntity.grammar, LocalizedTextEntity.grammar,

View File

@@ -1201,6 +1201,9 @@ test("Unknown", () => {
expect(parser.parse(`"/Script/MetasoundEditor.MetasoundEditorGraphVariable'MetasoundEditorGraphVariable_1'"`)).toBeInstanceOf(ObjectReferenceEntity) expect(parser.parse(`"/Script/MetasoundEditor.MetasoundEditorGraphVariable'MetasoundEditorGraphVariable_1'"`)).toBeInstanceOf(ObjectReferenceEntity)
expect(parser.parse(`"/Script/MetasoundEditor.MetasoundEditorGraphVariable'MetasoundEditorGraphVariable_1'"`).serialize()) expect(parser.parse(`"/Script/MetasoundEditor.MetasoundEditorGraphVariable'MetasoundEditorGraphVariable_1'"`).serialize())
.toEqual(`"/Script/MetasoundEditor.MetasoundEditorGraphVariable'MetasoundEditorGraphVariable_1'"`) .toEqual(`"/Script/MetasoundEditor.MetasoundEditorGraphVariable'MetasoundEditorGraphVariable_1'"`)
expect(parser.parse(`"/Script/AIModule.BlackboardData'/Game/Enemies/AI/BB_EnemyBase.BB_EnemyBase'"`)).toBeInstanceOf(ObjectReferenceEntity)
expect(parser.parse(`"/Script/AIModule.BlackboardData'/Game/Enemies/AI/BB_EnemyBase.BB_EnemyBase'"`).serialize())
.toEqual(`"/Script/AIModule.BlackboardData'/Game/Enemies/AI/BB_EnemyBase.BB_EnemyBase'"`)
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)")).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("(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",)`)).toBeInstanceOf(ArrayEntity)