mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-05-21 05:27:34 +08:00
Calculated serialization type
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import CalculatedType from "./CalculatedType"
|
||||
import GuidEntity from "./GuidEntity"
|
||||
import IEntity from "./IEntity"
|
||||
import LinearColorEntity from "./LinearColorEntity"
|
||||
@@ -6,9 +7,22 @@ import ObjectReferenceEntity from "./ObjectReferenceEntity"
|
||||
import PinReferenceEntity from "./PinReferenceEntity"
|
||||
import SerializedType from "./SerializedType"
|
||||
import TypeInitialization from "./TypeInitialization"
|
||||
import VectorEntity from "./VectorEntity"
|
||||
|
||||
export default class PinEntity extends IEntity {
|
||||
|
||||
static #typeEntityMap = {
|
||||
"/Script/CoreUObject.LinearColor": LinearColorEntity,
|
||||
"/Script/CoreUObject.Vector": VectorEntity,
|
||||
"bool": Boolean,
|
||||
"exec": String,
|
||||
"name": String,
|
||||
"real": Number,
|
||||
"string": String,
|
||||
}
|
||||
static get typeEntityMap() {
|
||||
return PinEntity.#typeEntityMap
|
||||
}
|
||||
static lookbehind = "Pin"
|
||||
static attributes = {
|
||||
PinId: GuidEntity,
|
||||
@@ -30,12 +44,16 @@ export default class PinEntity extends IEntity {
|
||||
bSerializeAsSinglePrecisionFloat: false,
|
||||
},
|
||||
LinkedTo: new TypeInitialization([PinReferenceEntity], false),
|
||||
DefaultValue: new TypeInitialization(
|
||||
new SerializedType([
|
||||
LinearColorEntity,
|
||||
]),
|
||||
false
|
||||
),
|
||||
DefaultValue:
|
||||
new CalculatedType(
|
||||
/** @param {PinEntity} pinEntity */
|
||||
pinEntity => new TypeInitialization(
|
||||
PinEntity.typeEntityMap[pinEntity.getType()] ?? String,
|
||||
false,
|
||||
undefined,
|
||||
true
|
||||
)
|
||||
),
|
||||
AutogeneratedDefaultValue: new TypeInitialization(String, false),
|
||||
DefaultObject: new TypeInitialization(ObjectReferenceEntity, false, null),
|
||||
PersistentGuid: GuidEntity,
|
||||
@@ -47,6 +65,13 @@ export default class PinEntity extends IEntity {
|
||||
bOrphanedPin: false,
|
||||
}
|
||||
|
||||
getType() {
|
||||
if (this.PinType.PinCategory == "struct") {
|
||||
return this.PinType.PinSubCategoryObject.path
|
||||
}
|
||||
return this.PinType.PinCategory
|
||||
}
|
||||
|
||||
getDefaultValue() {
|
||||
return this.DefaultValue ?? ""
|
||||
}
|
||||
@@ -108,13 +133,6 @@ export default class PinEntity extends IEntity {
|
||||
return false
|
||||
}
|
||||
|
||||
getType() {
|
||||
if (this.PinType.PinCategory == "struct") {
|
||||
return this.PinType.PinSubCategoryObject.path
|
||||
}
|
||||
return this.PinType.PinCategory
|
||||
}
|
||||
|
||||
getSubCategory() {
|
||||
return this.PinType.PinSubCategoryObject.path
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user