mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-03-06 15:47:30 +08:00
LinkedTo not shown by default, node name fixed
This commit is contained in:
@@ -23,11 +23,7 @@ export default class IEntity {
|
||||
console.warn(`Property ${prefix}${property} is not defined in ${this.constructor.name}`)
|
||||
}
|
||||
let defaultValue = properties[property]
|
||||
const defaultType = (defaultValue instanceof TypeInitialization)
|
||||
? defaultValue.type
|
||||
: (defaultValue instanceof Function)
|
||||
? defaultValue
|
||||
: defaultValue?.constructor
|
||||
const defaultType = Utility.getType(defaultValue)
|
||||
// Not instanceof because all objects are instenceof Object, exact match needed
|
||||
if (defaultType === Object) {
|
||||
target[property] = {}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// @ts-check
|
||||
|
||||
import Utility from "../Utility"
|
||||
import FunctionReferenceEntity from "./FunctionReferenceEntity"
|
||||
import GuidEntity from "./GuidEntity"
|
||||
import IdentifierEntity from "./IdentifierEntity"
|
||||
@@ -66,7 +67,13 @@ export default class ObjectEntity extends IEntity {
|
||||
}
|
||||
|
||||
getDisplayName() {
|
||||
return this.getNameAndCounter()[0]
|
||||
let name = this.FunctionReference?.MemberName
|
||||
if (name) {
|
||||
name = Utility.formatStringName(name)
|
||||
return name
|
||||
}
|
||||
name = Utility.formatStringName(this.getNameAndCounter()[0])
|
||||
return name
|
||||
}
|
||||
|
||||
getCounter() {
|
||||
|
||||
@@ -28,8 +28,8 @@ export default class PinEntity extends IEntity {
|
||||
bIsWeakPointer: false,
|
||||
bIsUObjectWrapper: false,
|
||||
},
|
||||
LinkedTo: [PinReferenceEntity],
|
||||
DefaultValue: "",
|
||||
LinkedTo: new TypeInitialization([PinReferenceEntity], false),
|
||||
DefaultValue: new TypeInitialization(String, false),
|
||||
AutogeneratedDefaultValue: "",
|
||||
DefaultObject: new TypeInitialization(ObjectReferenceEntity, false, null),
|
||||
PersistentGuid: GuidEntity,
|
||||
|
||||
@@ -5,6 +5,32 @@
|
||||
*/
|
||||
export default class TypeInitialization {
|
||||
|
||||
/** @type {T} */
|
||||
#value
|
||||
get value() {
|
||||
return this.#value
|
||||
}
|
||||
set value(v) {
|
||||
this.#value = v
|
||||
}
|
||||
|
||||
#showDefault = true
|
||||
get showDefault() {
|
||||
return this.#showDefault
|
||||
}
|
||||
set showDefault(v) {
|
||||
this.#showDefault = v
|
||||
}
|
||||
|
||||
/** @type {Constructor|Array<Constructor>} */
|
||||
#type
|
||||
get type() {
|
||||
return this.#type
|
||||
}
|
||||
set type(v) {
|
||||
this.#type = v
|
||||
}
|
||||
|
||||
static sanitize(value, targetType) {
|
||||
if (targetType === undefined) {
|
||||
targetType = value?.constructor
|
||||
@@ -23,16 +49,21 @@ export default class TypeInitialization {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {new () => T} type
|
||||
* @typedef {new () => T} Constructor
|
||||
* @param {Constructor|Array<Constructor>} type
|
||||
* @param {Boolean} showDefault
|
||||
* @param {any} value
|
||||
*/
|
||||
constructor(type, showDefault = true, value = undefined) {
|
||||
if (value === undefined) {
|
||||
value = TypeInitialization.sanitize(new type())
|
||||
if (type instanceof Array) {
|
||||
value = []
|
||||
} else {
|
||||
value = TypeInitialization.sanitize(new type())
|
||||
}
|
||||
}
|
||||
this.value = value
|
||||
this.showDefault = showDefault
|
||||
this.type = type
|
||||
this.#value = value
|
||||
this.#showDefault = showDefault
|
||||
this.#type = type
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user