mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-18 12:24:51 +08:00
Relaxed enum value
This commit is contained in:
44
dist/ueblueprint.js
vendored
44
dist/ueblueprint.js
vendored
@@ -2100,6 +2100,10 @@ class VectorEntity extends IEntity {
|
||||
class SimpleSerializationVectorEntity extends VectorEntity {
|
||||
}
|
||||
|
||||
class EnumDisplayValueEntity extends EnumEntity {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {import("./IEntity.js").AnyValue} AnyValue
|
||||
* @typedef {import("./ObjectEntity.js").default} ObjectEntity
|
||||
@@ -2125,9 +2129,10 @@ class PinEntity extends IEntity {
|
||||
"string": String,
|
||||
}
|
||||
static #alternativeTypeEntityMap = {
|
||||
[Configuration.paths.vector2D]: SimpleSerializationVector2DEntity,
|
||||
[Configuration.paths.vector]: SimpleSerializationVectorEntity,
|
||||
"enum": EnumDisplayValueEntity,
|
||||
[Configuration.paths.rotator]: SimpleSerializationRotatorEntity,
|
||||
[Configuration.paths.vector]: SimpleSerializationVectorEntity,
|
||||
[Configuration.paths.vector2D]: SimpleSerializationVector2DEntity,
|
||||
}
|
||||
static lookbehind = "Pin"
|
||||
static attributes = {
|
||||
@@ -2955,6 +2960,10 @@ class ObjectEntity extends IEntity {
|
||||
type: Boolean,
|
||||
showDefault: false,
|
||||
},
|
||||
Text: {
|
||||
type: String,
|
||||
showDefault: false,
|
||||
},
|
||||
NodeComment: {
|
||||
type: String,
|
||||
showDefault: false,
|
||||
@@ -3107,6 +3116,7 @@ class ObjectEntity extends IEntity {
|
||||
/** @type {Boolean?} */ this.bCanRenameNode;
|
||||
/** @type {Boolean?} */ this.bCommentBubblePinned;
|
||||
/** @type {Boolean?} */ this.bCommentBubbleVisible;
|
||||
/** @type {String?} */ this.Text;
|
||||
/** @type {String?} */ this.NodeComment;
|
||||
/** @type {IdentifierEntity?} */ this.AdvancedPinDisplay;
|
||||
/** @type {IdentifierEntity?} */ this.EnabledState;
|
||||
@@ -3192,13 +3202,6 @@ class ObjectEntity extends IEntity {
|
||||
this.NodeWidth = new IntegerEntity();
|
||||
}
|
||||
this.NodeWidth.value = value;
|
||||
const materialComment = this.getMaterialSubobject();
|
||||
if (materialComment) {
|
||||
if (!materialComment.SizeX) {
|
||||
materialComment.SizeX = new IntegerEntity();
|
||||
}
|
||||
materialComment.SizeX.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
getNodeHeight() {
|
||||
@@ -3212,13 +3215,6 @@ class ObjectEntity extends IEntity {
|
||||
this.NodeHeight = new IntegerEntity();
|
||||
}
|
||||
this.NodeHeight.value = value;
|
||||
const materialComment = this.getMaterialSubobject();
|
||||
if (materialComment) {
|
||||
if (!materialComment.SizeY) {
|
||||
materialComment.SizeY = new IntegerEntity();
|
||||
}
|
||||
materialComment.SizeY.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
getNodePosX() {
|
||||
@@ -3285,7 +3281,7 @@ class ObjectEntity extends IEntity {
|
||||
}
|
||||
|
||||
isMaterial() {
|
||||
return this.getClass() === Configuration.paths.materialGraphNode || this.MaterialExpression !== undefined
|
||||
return this.getClass() === Configuration.paths.materialGraphNode
|
||||
}
|
||||
|
||||
/** @return {ObjectEntity} */
|
||||
@@ -3375,7 +3371,7 @@ class ObjectEntity extends IEntity {
|
||||
if (this.getClass() === Configuration.paths.macro) {
|
||||
return Utility.formatStringName(this.MacroGraphReference?.getMacroName())
|
||||
}
|
||||
if (this.isMaterial()) {
|
||||
if (this.isMaterial() && this.MaterialExpression) {
|
||||
const materialObject = /** @type {ObjectEntity} */(
|
||||
this[Configuration.subObjectAttributeNameFromReference(this.MaterialExpression, true)]
|
||||
);
|
||||
@@ -3790,6 +3786,9 @@ class Grammar {
|
||||
case EnumEntity:
|
||||
result = this.enumEntity;
|
||||
break
|
||||
case EnumDisplayValueEntity:
|
||||
result = this.enumDisplayValueEntity;
|
||||
break
|
||||
case FormatTextEntity:
|
||||
result = this.formatTextEntity;
|
||||
break
|
||||
@@ -3980,6 +3979,10 @@ class Grammar {
|
||||
|
||||
static enumEntity = P.lazy(() => this.symbol.map(v => new EnumEntity(v)))
|
||||
|
||||
static enumDisplayValueEntity = P.lazy(() =>
|
||||
P.regex(this.Regex.InsideString).map(v => new EnumDisplayValueEntity(v))
|
||||
)
|
||||
|
||||
static formatTextEntity = P.lazy(() =>
|
||||
P.seq(
|
||||
P.regex(new RegExp(`${FormatTextEntity.lookbehind}\\s*`)),
|
||||
@@ -10910,6 +10913,11 @@ function initializeSerializerFactory() {
|
||||
new ToStringSerializer(ByteEntity)
|
||||
);
|
||||
|
||||
SerializerFactory.registerSerializer(
|
||||
EnumDisplayValueEntity,
|
||||
new ToStringSerializer(EnumDisplayValueEntity)
|
||||
);
|
||||
|
||||
SerializerFactory.registerSerializer(
|
||||
EnumEntity,
|
||||
new ToStringSerializer(EnumEntity)
|
||||
|
||||
6
dist/ueblueprint.min.js
vendored
6
dist/ueblueprint.min.js
vendored
File diff suppressed because one or more lines are too long
5
js/entity/EnumDisplayValueEntity.js
Executable file
5
js/entity/EnumDisplayValueEntity.js
Executable file
@@ -0,0 +1,5 @@
|
||||
import EnumEntity from "./EnumEntity.js"
|
||||
|
||||
export default class EnumDisplayValueEntity extends EnumEntity {
|
||||
|
||||
}
|
||||
37
js/entity/MirroredEntity.js
Normal file
37
js/entity/MirroredEntity.js
Normal file
@@ -0,0 +1,37 @@
|
||||
import IEntity from "./IEntity.js"
|
||||
|
||||
/** @typedef {import("./IEntity.js").EntityConstructor} EntityConstructor */
|
||||
|
||||
export default class MirroredEntity extends IEntity {
|
||||
|
||||
static attributes = {
|
||||
...super.attributes,
|
||||
type: {
|
||||
ignored: true,
|
||||
},
|
||||
key: {
|
||||
ignored: true,
|
||||
},
|
||||
object: {
|
||||
ignored: true,
|
||||
},
|
||||
}
|
||||
|
||||
constructor(values = {}) {
|
||||
super({})
|
||||
/** @type {EntityConstructor} */ this.type
|
||||
/** @type {String} */ this.key
|
||||
/** @type {IEntity} */ this.object
|
||||
}
|
||||
|
||||
get() {
|
||||
return this.object?.[this.key]
|
||||
}
|
||||
|
||||
|
||||
set(value) {
|
||||
if (this.object[this.key]) {
|
||||
this.object[this.key] = value
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -530,7 +530,7 @@ export default class ObjectEntity extends IEntity {
|
||||
}
|
||||
|
||||
isMaterial() {
|
||||
return this.getClass() === Configuration.paths.materialGraphNode || this.MaterialExpression !== undefined
|
||||
return this.getClass() === Configuration.paths.materialGraphNode
|
||||
}
|
||||
|
||||
/** @return {ObjectEntity} */
|
||||
@@ -620,7 +620,7 @@ export default class ObjectEntity extends IEntity {
|
||||
if (this.getClass() === Configuration.paths.macro) {
|
||||
return Utility.formatStringName(this.MacroGraphReference?.getMacroName())
|
||||
}
|
||||
if (this.isMaterial()) {
|
||||
if (this.isMaterial() && this.MaterialExpression) {
|
||||
const materialObject = /** @type {ObjectEntity} */(
|
||||
this[Configuration.subObjectAttributeNameFromReference(this.MaterialExpression, true)]
|
||||
)
|
||||
|
||||
@@ -20,6 +20,7 @@ import UnionType from "./UnionType.js"
|
||||
import Utility from "../Utility.js"
|
||||
import Vector2DEntity from "./Vector2DEntity.js"
|
||||
import VectorEntity from "./VectorEntity.js"
|
||||
import EnumDisplayValueEntity from "./EnumDisplayValueEntity.js"
|
||||
|
||||
/**
|
||||
* @typedef {import("./IEntity.js").AnyValue} AnyValue
|
||||
@@ -46,9 +47,10 @@ export default class PinEntity extends IEntity {
|
||||
"string": String,
|
||||
}
|
||||
static #alternativeTypeEntityMap = {
|
||||
[Configuration.paths.vector2D]: SimpleSerializationVector2DEntity,
|
||||
[Configuration.paths.vector]: SimpleSerializationVectorEntity,
|
||||
"enum": EnumDisplayValueEntity,
|
||||
[Configuration.paths.rotator]: SimpleSerializationRotatorEntity,
|
||||
[Configuration.paths.vector]: SimpleSerializationVectorEntity,
|
||||
[Configuration.paths.vector2D]: SimpleSerializationVector2DEntity,
|
||||
}
|
||||
static lookbehind = "Pin"
|
||||
static attributes = {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import ByteEntity from "../entity/ByteEntity.js"
|
||||
import Configuration from "../Configuration.js"
|
||||
import EnumDisplayValueEntity from "../entity/EnumDisplayValueEntity.js"
|
||||
import EnumEntity from "../entity/EnumEntity.js"
|
||||
import FormatTextEntity from "../entity/FormatTextEntity.js"
|
||||
import FunctionReferenceEntity from "../entity/FunctionReferenceEntity.js"
|
||||
@@ -184,6 +185,9 @@ export default class Grammar {
|
||||
case ByteEntity:
|
||||
result = this.byteEntity
|
||||
break
|
||||
case EnumDisplayValueEntity:
|
||||
result = this.enumDisplayValueEntity
|
||||
break
|
||||
case EnumEntity:
|
||||
result = this.enumEntity
|
||||
break
|
||||
@@ -375,6 +379,10 @@ export default class Grammar {
|
||||
|
||||
static byteEntity = P.lazy(() => this.byteNumber.map(v => new ByteEntity(v)))
|
||||
|
||||
static enumDisplayValueEntity = P.lazy(() =>
|
||||
P.regex(this.Regex.InsideString).map(v => new EnumDisplayValueEntity(v))
|
||||
)
|
||||
|
||||
static enumEntity = P.lazy(() => this.symbol.map(v => new EnumEntity(v)))
|
||||
|
||||
static formatTextEntity = P.lazy(() =>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import ByteEntity from "../entity/ByteEntity.js"
|
||||
import CustomSerializer from "./CustomSerializer.js"
|
||||
import EnumDisplayValueEntity from "../entity/EnumDisplayValueEntity.js"
|
||||
import EnumEntity from "../entity/EnumEntity.js"
|
||||
import FormatTextEntity from "../entity/FormatTextEntity.js"
|
||||
import FunctionReferenceEntity from "../entity/FunctionReferenceEntity.js"
|
||||
@@ -87,6 +88,11 @@ export default function initializeSerializerFactory() {
|
||||
new ToStringSerializer(ByteEntity)
|
||||
)
|
||||
|
||||
SerializerFactory.registerSerializer(
|
||||
EnumDisplayValueEntity,
|
||||
new ToStringSerializer(EnumDisplayValueEntity)
|
||||
)
|
||||
|
||||
SerializerFactory.registerSerializer(
|
||||
EnumEntity,
|
||||
new ToStringSerializer(EnumEntity)
|
||||
|
||||
Reference in New Issue
Block a user