mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-05-18 03:27:32 +08:00
Type initialization using objects
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import CalculatedType from "./CalculatedType"
|
||||
import GuidEntity from "./GuidEntity"
|
||||
import IEntity from "./IEntity"
|
||||
import IntegerEntity from "./IntegerEntity"
|
||||
@@ -10,13 +9,13 @@ import RotatorEntity from "./RotatorEntity"
|
||||
import SimpleSerializationRotatorEntity from "./SimpleSerializationRotatorEntity"
|
||||
import SimpleSerializationVector2DEntity from "./SimpleSerializationVector2DEntity"
|
||||
import SimpleSerializationVectorEntity from "./SimpleSerializationVectorEntity"
|
||||
import TypeInitialization from "./TypeInitialization"
|
||||
import SubAttributesDeclaration from "./SubObject"
|
||||
import UnionType from "./UnionType"
|
||||
import Utility from "../Utility"
|
||||
import Vector2DEntity from "./Vector2DEntity"
|
||||
import VectorEntity from "./VectorEntity"
|
||||
|
||||
/** @typedef {import("./TypeInitialization").AnyValue} AnyValue */
|
||||
/** @typedef {import("./IEntity").AnyValue} AnyValue */
|
||||
|
||||
/** @template {AnyValue} T */
|
||||
export default class PinEntity extends IEntity {
|
||||
@@ -40,38 +39,67 @@ export default class PinEntity extends IEntity {
|
||||
}
|
||||
static lookbehind = "Pin"
|
||||
static attributes = {
|
||||
PinId: GuidEntity,
|
||||
PinId: {
|
||||
type: GuidEntity,
|
||||
},
|
||||
PinName: "",
|
||||
PinFriendlyName: new TypeInitialization(new UnionType(LocalizedTextEntity, String), false, null),
|
||||
PinToolTip: new TypeInitialization(String, false, ""),
|
||||
Direction: new TypeInitialization(String, false, ""),
|
||||
PinType: {
|
||||
PinFriendlyName: {
|
||||
type: new UnionType(LocalizedTextEntity, String),
|
||||
showDefault: false,
|
||||
},
|
||||
PinToolTip: {
|
||||
type: String,
|
||||
showDefault: false,
|
||||
},
|
||||
Direction: {
|
||||
type: String,
|
||||
showDefault: false,
|
||||
},
|
||||
PinType: new SubAttributesDeclaration({
|
||||
PinCategory: "",
|
||||
PinSubCategory: "",
|
||||
PinSubCategoryObject: ObjectReferenceEntity,
|
||||
PinSubCategoryMemberReference: null,
|
||||
PinValueType: null,
|
||||
ContainerType: ObjectReferenceEntity,
|
||||
PinSubCategoryObject: {
|
||||
type: ObjectReferenceEntity,
|
||||
},
|
||||
PinSubCategoryMemberReference: {
|
||||
type: ObjectReferenceEntity,
|
||||
value: null,
|
||||
},
|
||||
PinValueType: {
|
||||
type: String,
|
||||
value: null,
|
||||
},
|
||||
ContainerType: {
|
||||
type: ObjectReferenceEntity,
|
||||
},
|
||||
bIsReference: false,
|
||||
bIsConst: false,
|
||||
bIsWeakPointer: false,
|
||||
bIsUObjectWrapper: false,
|
||||
bSerializeAsSinglePrecisionFloat: false,
|
||||
}),
|
||||
LinkedTo: {
|
||||
type: [PinReferenceEntity],
|
||||
showDefault: false,
|
||||
},
|
||||
DefaultValue: {
|
||||
/** @param {PinEntity} pinEntity */
|
||||
type: pinEntity => pinEntity.getEntityType(true) ?? String,
|
||||
serialized: true,
|
||||
showDefault: false,
|
||||
},
|
||||
AutogeneratedDefaultValue: {
|
||||
type: String,
|
||||
showDefault: false,
|
||||
},
|
||||
DefaultObject: {
|
||||
type: ObjectReferenceEntity,
|
||||
showDefault: false,
|
||||
value: null,
|
||||
},
|
||||
PersistentGuid: {
|
||||
type: GuidEntity,
|
||||
},
|
||||
LinkedTo: new TypeInitialization([PinReferenceEntity], false),
|
||||
DefaultValue:
|
||||
new CalculatedType(
|
||||
/** @param {PinEntity} pinEntity */
|
||||
pinEntity => new TypeInitialization(
|
||||
pinEntity.getEntityType(true) ?? String,
|
||||
false,
|
||||
undefined,
|
||||
true
|
||||
)
|
||||
),
|
||||
AutogeneratedDefaultValue: new TypeInitialization(String, false),
|
||||
DefaultObject: new TypeInitialization(ObjectReferenceEntity, false, null),
|
||||
PersistentGuid: GuidEntity,
|
||||
bHidden: false,
|
||||
bNotConnectable: false,
|
||||
bDefaultValueIsReadOnly: false,
|
||||
@@ -80,6 +108,10 @@ export default class PinEntity extends IEntity {
|
||||
bOrphanedPin: false,
|
||||
}
|
||||
|
||||
static {
|
||||
this.cleanupAttributes(this.attributes)
|
||||
}
|
||||
|
||||
constructor(values = {}, suppressWarns = false) {
|
||||
super(values, suppressWarns)
|
||||
/** @type {GuidEntity} */ this.PinId
|
||||
|
||||
Reference in New Issue
Block a user