Files
ueblueprint/js/entity/PinEntity.js
2022-03-09 23:11:40 +01:00

100 lines
3.1 KiB
JavaScript
Executable File

import GuidEntity from "./GuidEntity"
import IEntity from "./IEntity"
import LocalizedTextEntity from "./LocalizedTextEntity"
import ObjectReferenceEntity from "./ObjectReferenceEntity"
import PinReferenceEntity from "./PinReferenceEntity"
import TypeInitialization from "./TypeInitialization"
/**
* @typedef {{
* PinCategory: String,
* PinSubCategory: String,
* PinSubCategoryObject: ObjectReferenceEntity,
* PinSubCategoryMemberReference: *,
* PinValueType: String,
* ContainerType: ObjectReferenceEntity,
* bIsReference: Boolean,
* bIsConst: Boolean,
* bIsWeakPointer: Boolean,
* bIsUObjectWrapper: Boolean,
* }} PinTypeObjectType
*/
export default class PinEntity extends IEntity {
static lookbehind = "Pin"
static attributes = {
PinId: GuidEntity,
PinName: "",
PinFriendlyName: new TypeInitialization(LocalizedTextEntity, false, null),
PinToolTip: "",
Direction: new TypeInitialization(String, false, ""),
PinType: {
PinCategory: "",
PinSubCategory: "",
PinSubCategoryObject: ObjectReferenceEntity,
PinSubCategoryMemberReference: null,
PinValueType: null,
ContainerType: ObjectReferenceEntity,
bIsReference: false,
bIsConst: false,
bIsWeakPointer: false,
bIsUObjectWrapper: false,
},
LinkedTo: [PinReferenceEntity],
DefaultValue: "",
AutogeneratedDefaultValue: "",
PersistentGuid: GuidEntity,
bHidden: false,
bNotConnectable: false,
bDefaultValueIsReadOnly: false,
bDefaultValueIsIgnored: false,
bAdvancedView: false,
bOrphanedPin: false,
}
/** @type {GuidEntity} */ PinId
/** @type {String} */ PinName
/** @type {LocalizedTextEntity} */ PinFriendlyName
/** @type {String} */ PinToolTip
/** @type {String} */ Direction
/** @type {PinTypeObjectType} */ PinType
/** @type {PinReferenceEntity[]} */ LinkedTo
/** @type {String} */ DefaultValue
/** @type {String} */ AutogeneratedDefaultValue
/** @type {GuidEntity} */ PersistentGuid
/** @type {Boolean} */ bHidden
/** @type {Boolean} */ bNotConnectable
/** @type {Boolean} */ bDefaultValueIsReadOnly
/** @type {Boolean} */ bDefaultValueIsIgnored
/** @type {Boolean} */ bAdvancedView
/** @type {Boolean} */ bOrphanedPin
isInput() {
return !this.bHidden && this.Direction !== "EGPD_Output"
}
isOutput() {
return !this.bHidden && this.Direction === "EGPD_Output"
}
isConnected() {
return this.LinkedTo?.length > 0 ?? false
}
/**
*
* @param {PinReferenceEntity} pinReferenceEntity
*/
connectTo(pinReferenceEntity) {
/** @type {PinReferenceEntity[]} */
this.LinkedTo
this.LinkedTo.forEach(reference => {
})
}
getType() {
return this.PinType.PinCategory ?? "object"
}
}