mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-03-15 21:12:41 +08:00
Several serialization and deserialization fixes
This commit is contained in:
@@ -49,10 +49,19 @@ export default class IEntity {
|
||||
const Self = /** @type {EntityConstructor} */(this.constructor)
|
||||
let attributes = Self.attributes
|
||||
if (values.attributes) {
|
||||
let attributes = { ...Self.attributes }
|
||||
Utility.mergeArrays(Object.keys(attributes), Object.keys(values.attributes))
|
||||
.forEach(k => attributes[k] = {
|
||||
...attributes[k],
|
||||
...values.attributes[k]
|
||||
.forEach(k => {
|
||||
attributes[k] = {
|
||||
...IEntity.defaultAttribute,
|
||||
...attributes[k],
|
||||
...values.attributes[k]
|
||||
}
|
||||
if (!attributes[k].type) {
|
||||
attributes[k].type = values[k] instanceof Array
|
||||
? [Utility.getType(values[k][0])]
|
||||
: Utility.getType(values[k])
|
||||
}
|
||||
})
|
||||
IEntity.defineAttributes(this, attributes)
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import PinEntity from "./PinEntity.js"
|
||||
import SVGIcon from "../SVGIcon.js"
|
||||
import SymbolEntity from "./SymbolEntity.js"
|
||||
import UnionType from "./UnionType.js"
|
||||
import UserDefinedPinEntity from "./UserDefinedPinEntity.js"
|
||||
import UnknownPinEntity from "./UnknownPinEntity.js"
|
||||
import Utility from "../Utility.js"
|
||||
import VariableReferenceEntity from "./VariableReferenceEntity.js"
|
||||
|
||||
@@ -187,6 +187,7 @@ export default class ObjectEntity extends IEntity {
|
||||
},
|
||||
NodeGuid: {
|
||||
type: GuidEntity,
|
||||
showDefault: false,
|
||||
},
|
||||
ErrorType: {
|
||||
type: IntegerEntity,
|
||||
@@ -198,7 +199,7 @@ export default class ObjectEntity extends IEntity {
|
||||
showDefault: false,
|
||||
},
|
||||
CustomProperties: {
|
||||
type: [new UnionType(PinEntity, UserDefinedPinEntity)]
|
||||
type: [new UnionType(PinEntity, UnknownPinEntity)]
|
||||
},
|
||||
}
|
||||
|
||||
@@ -299,7 +300,7 @@ export default class ObjectEntity extends IEntity {
|
||||
/** @type {GuidEntity} */ this.NodeGuid
|
||||
/** @type {IntegerEntity?} */ this.ErrorType
|
||||
/** @type {String?} */ this.ErrorMsg
|
||||
/** @type {PinEntity[]} */ this.CustomProperties
|
||||
/** @type {(PinEntity | UnknownPinEntity)[]} */ this.CustomProperties
|
||||
}
|
||||
|
||||
getClass() {
|
||||
|
||||
6
js/entity/UnknownPinEntity.js
Executable file
6
js/entity/UnknownPinEntity.js
Executable file
@@ -0,0 +1,6 @@
|
||||
import PinEntity from "./PinEntity.js"
|
||||
|
||||
export default class UnknownPinEntity extends PinEntity {
|
||||
|
||||
static lookbehind = ""
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import IEntity from "./IEntity.js"
|
||||
import PinEntity from "./PinEntity.js"
|
||||
|
||||
/** @typedef {import("./IEntity.js").AnyValue} AnyValue */
|
||||
|
||||
export default class UserDefinedPinEntity extends IEntity {
|
||||
|
||||
static lookbehind = "UserDefinedPin"
|
||||
}
|
||||
Reference in New Issue
Block a user