mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-04 08:50:33 +08:00
Several fixes
This commit is contained in:
25
dist/ueblueprint.js
vendored
25
dist/ueblueprint.js
vendored
@@ -5372,9 +5372,9 @@ class PinEntity extends IEntity {
|
||||
}
|
||||
|
||||
getType() {
|
||||
const category = this.PinType.PinCategory.toString().toLocaleLowerCase();
|
||||
const category = this.PinType.PinCategory?.valueOf().toLocaleLowerCase();
|
||||
if (category === "struct" || category === "class" || category === "object" || category === "type") {
|
||||
return this.PinType.PinSubCategoryObject.path
|
||||
return this.PinType.PinSubCategoryObject?.path
|
||||
}
|
||||
if (this.isEnum()) {
|
||||
return "enum"
|
||||
@@ -5406,7 +5406,8 @@ class PinEntity extends IEntity {
|
||||
}
|
||||
}
|
||||
if (category === "optional") {
|
||||
switch (this.PinType.PinSubCategory.toString()) {
|
||||
const subCategory = this.PinType.PinSubCategory?.valueOf();
|
||||
switch (subCategory) {
|
||||
case "red":
|
||||
return "real"
|
||||
case "rg":
|
||||
@@ -5416,7 +5417,7 @@ class PinEntity extends IEntity {
|
||||
case "rgba":
|
||||
return Configuration.paths.linearColor
|
||||
default:
|
||||
return this.PinType.PinSubCategory
|
||||
return subCategory
|
||||
}
|
||||
}
|
||||
return category
|
||||
@@ -8424,7 +8425,7 @@ class CommentNodeTemplate extends IResizeableTemplate {
|
||||
<div class="ueb-node-border">
|
||||
<div class="ueb-node-wrapper">
|
||||
<div class="ueb-node-top"
|
||||
.innerText="${Utility.encodeHTMLWhitespace(this.element.entity.NodeComment)}">
|
||||
.innerText="${Utility.encodeHTMLWhitespace(this.element.entity.NodeComment?.valueOf())}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -8538,7 +8539,7 @@ class MouseCreateLink extends IMouseClickDrag {
|
||||
this.link.setMessageReplaceOutputLink();
|
||||
this.linkValid = true;
|
||||
} else if (
|
||||
(a.entity.PinType.PinCategory != "object" || b.entity.PinType.PinCategory != "object")
|
||||
(a.entity.PinType.PinCategory.valueOf() != "object" || b.entity.PinType.PinCategory.valueOf() != "object")
|
||||
&& a.pinType != b.pinType
|
||||
) {
|
||||
this.link.setMessageTypesIncompatible(a, b);
|
||||
@@ -8931,7 +8932,7 @@ class EventNodeTemplate extends NodeTemplate {
|
||||
|
||||
createDelegatePinElement() {
|
||||
const pin = /** @type {PinElementConstructor} */(ElementFactory.getConstructor("ueb-pin")).newObject(
|
||||
this.element.getPinEntities().find(v => !v.isHidden() && v.PinType.PinCategory === "delegate"),
|
||||
this.element.getPinEntities().find(v => !v.isHidden() && v.PinType.PinCategory?.valueOf() === "delegate"),
|
||||
new MinimalPinTemplate(),
|
||||
this.element
|
||||
);
|
||||
@@ -11311,11 +11312,11 @@ class EnumPinTemplate extends IInputPinTemplate {
|
||||
|
||||
setup() {
|
||||
super.setup();
|
||||
const enumEntries = this.element.nodeElement.entity.EnumEntries;
|
||||
const enumEntries = this.element.nodeElement.entity.EnumEntries.valueOf();
|
||||
this.#dropdownEntries =
|
||||
enumEntries?.map(k => {
|
||||
if (k === "") {
|
||||
k = "None";
|
||||
if (k.valueOf() === "") {
|
||||
k = new StringEntity("None");
|
||||
}
|
||||
return [
|
||||
k,
|
||||
@@ -12198,7 +12199,7 @@ const inputPinTemplates = {
|
||||
|
||||
/** @param {PinEntity} entity */
|
||||
function pinTemplate(entity) {
|
||||
if (entity.PinType.ContainerType?.toString() === "Array") {
|
||||
if (entity.PinType.ContainerType?.valueOf() === "Array") {
|
||||
return PinTemplate
|
||||
}
|
||||
if (entity.PinType.bIsReference?.valueOf() && !entity.PinType.bIsConst?.valueOf()) {
|
||||
@@ -12349,7 +12350,7 @@ class PinElement extends IElement {
|
||||
}
|
||||
|
||||
getLinks() {
|
||||
return this.entity.LinkedTo ?? []
|
||||
return this.entity.LinkedTo?.valueOf() ?? []
|
||||
}
|
||||
|
||||
getDefaultValue(maybeCreate = false) {
|
||||
|
||||
6
dist/ueblueprint.min.js
vendored
6
dist/ueblueprint.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -15,6 +15,7 @@ export default class MirroredEntity extends IEntity {
|
||||
/**
|
||||
* @template {typeof IEntity} T
|
||||
* @param {T} type
|
||||
* @returns {typeof MirroredEntity<T>}
|
||||
*/
|
||||
static of(type) {
|
||||
const result = this.asUniqueClass()
|
||||
|
||||
@@ -344,7 +344,7 @@ export default class ObjectEntity extends IEntity {
|
||||
/** @param {ObjectEntity} obj */
|
||||
obj => {
|
||||
if (obj.Node !== undefined) {
|
||||
const nodeRef = obj.Node.get()
|
||||
const nodeRef = obj.Node.getter()
|
||||
if (
|
||||
nodeRef.type === this.PCGNode.type
|
||||
&& nodeRef.path === `${this.Name}.${this.PCGNode.path}`
|
||||
|
||||
@@ -129,7 +129,7 @@ export default class PinEntity extends IEntity {
|
||||
/** @type {InstanceType<typeof PinEntity.attributes.Direction>} */ this.Direction
|
||||
/** @type {InstanceType<typeof PinEntity.attributes.PinType>} */ this.PinType
|
||||
/** @type {InstanceType<typeof PinEntity.attributes.LinkedTo>} */ this.LinkedTo
|
||||
/** @type {InstanceType<typeof PinEntity.attributes.DefaultValue>} */ this.DefaultValue
|
||||
/** @type {T} */ this.DefaultValue
|
||||
/** @type {InstanceType<typeof PinEntity.attributes.AutogeneratedDefaultValue>} */ this.AutogeneratedDefaultValue
|
||||
/** @type {InstanceType<typeof PinEntity.attributes.DefaultObject>} */ this.DefaultObject
|
||||
/** @type {InstanceType<typeof PinEntity.attributes.PersistentGuid>} */ this.PersistentGuid
|
||||
@@ -147,9 +147,9 @@ export default class PinEntity extends IEntity {
|
||||
}
|
||||
|
||||
getType() {
|
||||
const category = this.PinType.PinCategory.valueOf().toLocaleLowerCase()
|
||||
const category = this.PinType.PinCategory?.valueOf().toLocaleLowerCase()
|
||||
if (category === "struct" || category === "class" || category === "object" || category === "type") {
|
||||
return this.PinType.PinSubCategoryObject.path
|
||||
return this.PinType.PinSubCategoryObject?.path
|
||||
}
|
||||
if (this.isEnum()) {
|
||||
return "enum"
|
||||
@@ -181,7 +181,8 @@ export default class PinEntity extends IEntity {
|
||||
}
|
||||
}
|
||||
if (category === "optional") {
|
||||
switch (this.PinType.PinSubCategory.toString()) {
|
||||
const subCategory = this.PinType.PinSubCategory?.valueOf()
|
||||
switch (subCategory) {
|
||||
case "red":
|
||||
return "real"
|
||||
case "rg":
|
||||
@@ -191,7 +192,7 @@ export default class PinEntity extends IEntity {
|
||||
case "rgba":
|
||||
return Configuration.paths.linearColor
|
||||
default:
|
||||
return this.PinType.PinSubCategory
|
||||
return subCategory
|
||||
}
|
||||
}
|
||||
return category
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class ExecPinTemplate extends PinTemplate {
|
||||
renderName() {
|
||||
let pinName = this.element.entity.PinName
|
||||
if (this.element.entity.PinFriendlyName) {
|
||||
pinName = this.element.entity.PinFriendlyName.toString()
|
||||
pinName = this.element.entity.PinFriendlyName.valueOf()
|
||||
} else if (pinName === "execute" || pinName === "then") {
|
||||
return html``
|
||||
}
|
||||
|
||||
@@ -170,6 +170,7 @@ export default class PinTemplate extends ITemplate {
|
||||
|
||||
getLinkLocation() {
|
||||
const rect = this.iconElement.getBoundingClientRect()
|
||||
/** @type {[Number, Number]} */
|
||||
const boundingLocation = [this.element.isInput() ? rect.left : rect.right + 1, (rect.top + rect.bottom) / 2]
|
||||
const location = Utility.convertLocation(boundingLocation, this.blueprint.template.gridElement)
|
||||
return this.blueprint.compensateTranslation(location[0], location[1])
|
||||
|
||||
@@ -7,15 +7,15 @@ import INumericPinTemplate from "./INumericPinTemplate.js"
|
||||
export default class RotatorPinTemplate extends INumericPinTemplate {
|
||||
|
||||
#getR() {
|
||||
return Utility.printNumber(this.element.getDefaultValue()?.R ?? 0)
|
||||
return Utility.printNumber(this.element.getDefaultValue()?.R.valueOf() ?? 0)
|
||||
}
|
||||
|
||||
#getP() {
|
||||
return Utility.printNumber(this.element.getDefaultValue()?.P ?? 0)
|
||||
return Utility.printNumber(this.element.getDefaultValue()?.P.valueOf() ?? 0)
|
||||
}
|
||||
|
||||
#getY() {
|
||||
return Utility.printNumber(this.element.getDefaultValue()?.Y ?? 0)
|
||||
return Utility.printNumber(this.element.getDefaultValue()?.Y.valueOf() ?? 0)
|
||||
}
|
||||
|
||||
setDefaultValue(values = [], rawValues = values) {
|
||||
@@ -23,9 +23,9 @@ export default class RotatorPinTemplate extends INumericPinTemplate {
|
||||
if (!(rotator instanceof RotatorEntity)) {
|
||||
throw new TypeError("Expected DefaultValue to be a RotatorEntity")
|
||||
}
|
||||
rotator.R = values[0] // Roll
|
||||
rotator.P = values[1] // Pitch
|
||||
rotator.Y = values[2] // Yaw
|
||||
rotator.R.value = values[0] // Roll
|
||||
rotator.P.value = values[1] // Pitch
|
||||
rotator.Y.value = values[2] // Yaw
|
||||
this.element.requestUpdate("DefaultValue", rotator)
|
||||
}
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ import INumericPinTemplate from "./INumericPinTemplate.js"
|
||||
export default class Vector2DPinTemplate extends INumericPinTemplate {
|
||||
|
||||
#getX() {
|
||||
return Utility.printNumber(this.element.getDefaultValue()?.X ?? 0)
|
||||
return Utility.printNumber(this.element.getDefaultValue()?.X.valueOf() ?? 0)
|
||||
}
|
||||
|
||||
#getY() {
|
||||
return Utility.printNumber(this.element.getDefaultValue()?.Y ?? 0)
|
||||
return Utility.printNumber(this.element.getDefaultValue()?.Y.valueOf() ?? 0)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -25,8 +25,8 @@ export default class Vector2DPinTemplate extends INumericPinTemplate {
|
||||
if (!(vector instanceof Vector2DEntity)) {
|
||||
throw new TypeError("Expected DefaultValue to be a Vector2DEntity")
|
||||
}
|
||||
vector.X = values[0]
|
||||
vector.Y = values[1]
|
||||
vector.X.value = values[0]
|
||||
vector.Y.value = values[1]
|
||||
this.element.requestUpdate("DefaultValue", vector)
|
||||
}
|
||||
|
||||
|
||||
@@ -7,19 +7,19 @@ import Vector4DEntity from "../../entity/Vector4DEntity.js"
|
||||
export default class Vector4DPinTemplate extends INumericPinTemplate {
|
||||
|
||||
#getX() {
|
||||
return Utility.printNumber(this.element.getDefaultValue()?.X ?? 0)
|
||||
return Utility.printNumber(this.element.getDefaultValue()?.X.valueOf() ?? 0)
|
||||
}
|
||||
|
||||
#getY() {
|
||||
return Utility.printNumber(this.element.getDefaultValue()?.Y ?? 0)
|
||||
return Utility.printNumber(this.element.getDefaultValue()?.Y.valueOf() ?? 0)
|
||||
}
|
||||
|
||||
#getZ() {
|
||||
return Utility.printNumber(this.element.getDefaultValue()?.Z ?? 0)
|
||||
return Utility.printNumber(this.element.getDefaultValue()?.Z.valueOf() ?? 0)
|
||||
}
|
||||
|
||||
#getW() {
|
||||
return Utility.printNumber(this.element.getDefaultValue()?.W ?? 0)
|
||||
return Utility.printNumber(this.element.getDefaultValue()?.W.valueOf() ?? 0)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -31,10 +31,10 @@ export default class Vector4DPinTemplate extends INumericPinTemplate {
|
||||
if (!(vector instanceof Vector4DEntity)) {
|
||||
throw new TypeError("Expected DefaultValue to be a Vector4DEntity")
|
||||
}
|
||||
vector.X = values[0]
|
||||
vector.Y = values[1]
|
||||
vector.Z = values[2]
|
||||
vector.W = values[3]
|
||||
vector.X.value = values[0]
|
||||
vector.Y.value = values[1]
|
||||
vector.Z.value = values[2]
|
||||
vector.W.value = values[3]
|
||||
this.element.requestUpdate("DefaultValue", vector)
|
||||
}
|
||||
|
||||
|
||||
@@ -7,15 +7,15 @@ import INumericPinTemplate from "./INumericPinTemplate.js"
|
||||
export default class VectorPinTemplate extends INumericPinTemplate {
|
||||
|
||||
#getX() {
|
||||
return Utility.printNumber(this.element.getDefaultValue()?.X ?? 0)
|
||||
return Utility.printNumber(this.element.getDefaultValue()?.X.valueOf() ?? 0)
|
||||
}
|
||||
|
||||
#getY() {
|
||||
return Utility.printNumber(this.element.getDefaultValue()?.Y ?? 0)
|
||||
return Utility.printNumber(this.element.getDefaultValue()?.Y.valueOf() ?? 0)
|
||||
}
|
||||
|
||||
#getZ() {
|
||||
return Utility.printNumber(this.element.getDefaultValue()?.Z ?? 0)
|
||||
return Utility.printNumber(this.element.getDefaultValue()?.Z.valueOf() ?? 0)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -27,9 +27,9 @@ export default class VectorPinTemplate extends INumericPinTemplate {
|
||||
if (!(vector instanceof VectorEntity)) {
|
||||
throw new TypeError("Expected DefaultValue to be a VectorEntity")
|
||||
}
|
||||
vector.X = values[0]
|
||||
vector.Y = values[1]
|
||||
vector.Z = values[2]
|
||||
vector.X.value = values[0]
|
||||
vector.Y.value = values[1]
|
||||
vector.Z.value = values[2]
|
||||
this.element.requestUpdate("DefaultValue", vector)
|
||||
}
|
||||
|
||||
|
||||
8
types.js
8
types.js
@@ -79,10 +79,6 @@
|
||||
* : T
|
||||
* } DescribedType
|
||||
*/
|
||||
/**
|
||||
* @typedef {import("./js/entity/AttributeInfo.js").default} AttributeInfo
|
||||
* @typedef {{ [key: String]: AttributeInfo }} AttributeDeclarations
|
||||
*/
|
||||
/**
|
||||
* @typedef {CustomEvent<{ value: Coordinates }>} UEBDragEvent
|
||||
*/
|
||||
@@ -221,10 +217,6 @@
|
||||
* @typedef {import("lit").PropertyValues} PropertyValues
|
||||
* @typedef {import("lit").TemplateResult} TemplateResult
|
||||
*/
|
||||
/**
|
||||
* @template {AttributeConstructor<Attribute>} T
|
||||
* @typedef {import("./js/serialization/Serializer.js").default<T>} Serializer
|
||||
*/
|
||||
/**
|
||||
* @template T
|
||||
* @typedef {{
|
||||
|
||||
Reference in New Issue
Block a user