Various fixes

This commit is contained in:
barsdeveloper
2023-03-31 22:19:13 +02:00
parent 6ac8b13379
commit 8c30118a13
15 changed files with 186 additions and 167 deletions

173
dist/ueblueprint.js vendored
View File

@@ -75,6 +75,15 @@ class Configuration {
static linkCurveHeight = 15 // px
static linkCurveWidth = 80 // px
static linkMinWidth = 100 // px
static nameRegexSpaceReplacement = new RegExp(
"^K2(?:[Nn]ode)?_"
+ "|(?<=[a-z])(?=[A-Z0-9])" // ("Alpha2", "AlphaBravo") => ("Alpha 2", "Alpha Bravo")
+ "|(?<=[A-Z])(?=[A-Z][a-z]|[0-9])" // ("ALPHABravo", "ALPHA2") => ("ALPHA Bravo", "ALPHA 2")
+ "|(?<=[014-9]|[23](?!D(?:[^a-z]|$)))(?=[a-zA-Z])" // ("3Times", "3D", "3Delta") => ("3 Times", "3D", "3 Delta")
+ "|\\s*_+\\s*" // "Alpha__Bravo" => "Alpha Bravo"
+ "|\\s{2,}",
"g"
)
/**
* @param {Number} start
* @param {Number} c1
@@ -461,10 +470,7 @@ class Utility {
/** @param {HTMLElement} element */
static getScale(element) {
// @ts-expect-error
const scale = element.blueprint
// @ts-expect-error
? element.blueprint.getScale()
: getComputedStyle(element).getPropertyValue("--ueb-scale");
const scale = element.blueprint?.getScale() ?? getComputedStyle(element).getPropertyValue("--ueb-scale");
return scale != "" ? parseFloat(scale) : 1
}
@@ -742,16 +748,23 @@ class Utility {
// Remove leading b (for boolean values) or newlines
.replace(/^\s*b/, "")
// Insert a space where needed, possibly removing unnecessary elading characters
.replaceAll(
/^K2(?:Node|node)?_|(?<=[a-z])(?=[A-Z0-9])|(?<=[A-Z])(?=[A-Z][a-z]|[0-9])|(?<=[014-9]|(?:2|3)(?!D(?:[^a-z]|$)))(?=[a-zA-Z])|\s*_+\s*|\s{2,}/g,
" "
)
.replaceAll(Configuration.nameRegexSpaceReplacement, " ")
.split(" ")
.map(v => Utility.capitalFirstLetter(v))
.join(" ")
.trim()
}
/** @param {String} value */
static encodeKeyName(value) {
return value.replaceAll(".", "$")
}
/** @param {String} value */
static decodeKeyName(value) {
return value.replaceAll("$", ".")
}
/** @param {String} value */
static getIdFromReference(value) {
return value
@@ -1297,6 +1310,7 @@ class FunctionReferenceEntity extends IEntity {
super(values);
/** @type {ObjectReferenceEntity} */ this.MemberParent;
/** @type {String} */ this.MemberName;
/** @type {GuidEntity} */ this.MemberGuid;
}
}
@@ -1376,11 +1390,6 @@ class KeyBindingEntity extends IEntity {
}
constructor(values = {}) {
values.ActionName = values.ActionName ?? "";
values.bShift = values.bShift ?? false;
values.bCtrl = values.bCtrl ?? false;
values.bAlt = values.bAlt ?? false;
values.bCmd = values.bCmd ?? false;
super(values);
/** @type {String} */ this.ActionName;
/** @type {Boolean} */ this.bShift;
@@ -1984,42 +1993,42 @@ class PinEntity extends IEntity {
constructor(values = {}, suppressWarns = false) {
super(values, suppressWarns);
this["PinId"] ??= /** @type {GuidEntity} */(undefined);
this["PinName"] ??= /** @type {String} */(undefined);
this["PinFriendlyName"] ??= /** @type {LocalizedTextEntity | String} */(undefined);
this["PinToolTip"] ??= /** @type {String} */(undefined);
this["Direction"] ??= /** @type {String} */(undefined);
this["PinType.PinCategory"] ??= /** @type {String} */(undefined);
this["PinType.PinSubCategory"] ??= /** @type {String} */(undefined);
this["PinType.PinSubCategoryObject"] ??= /** @type {ObjectReferenceEntity} */(undefined);
this["PinType.PinSubCategoryMemberReference"] ??= /** @type {FunctionReferenceEntity} */(undefined);
this["PinType.PinValueType"] ??= /** @type {PinTypeEntity} */(undefined);
this["PinType.ContainerType"] ??= /** @type {PathSymbolEntity} */(undefined);
this["PinType.bIsReference"] ??= /** @type {Boolean} */(undefined);
this["PinType.bIsConst"] ??= /** @type {Boolean} */(undefined);
this["PinType.bIsWeakPointer"] ??= /** @type {Boolean} */(undefined);
this["PinType.bIsUObjectWrapper"] ??= /** @type {Boolean} */(undefined);
this["PinType.bIsUObjectWrapper"] ??= /** @type {Boolean} */(undefined);
this["LinkedTo"] ??= /** @type {PinReferenceEntity[]} */(undefined);
this["DefaultValue"] ??= /** @type {T} */(undefined);
this["AutogeneratedDefaultValue"] ??= /** @type {String} */(undefined);
this["DefaultObject"] ??= /** @type {ObjectReferenceEntity} */(undefined);
this["PersistentGuid"] ??= /** @type {GuidEntity} */(undefined);
this["bHidden"] ??= /** @type {Boolean} */(undefined);
this["bNotConnectable"] ??= /** @type {Boolean} */(undefined);
this["bDefaultValueIsReadOnly"] ??= /** @type {Boolean} */(undefined);
this["bDefaultValueIsIgnored"] ??= /** @type {Boolean} */(undefined);
this["bAdvancedView"] ??= /** @type {Boolean} */(undefined);
this["bOrphanedPin"] ??= /** @type {Boolean} */(undefined);
/** @type {GuidEntity} */ this.PinId;
/** @type {String} */ this.PinName;
/** @type {LocalizedTextEntity | String} */ this.PinFriendlyName;
/** @type {String} */ this.PinToolTip;
/** @type {String} */ this.Direction;
this.PinType$PinCategory ??= /** @type {String} */(undefined);
this.PinType$PinSubCategory ??= /** @type {String} */(undefined);
this.PinType$PinSubCategoryObject ??= /** @type {ObjectReferenceEntity} */(undefined);
this.PinType$PinSubCategoryMemberReference ??= /** @type {FunctionReferenceEntity} */(undefined);
this.PinType$PinValueType ??= /** @type {PinTypeEntity} */(undefined);
this.PinType$ContainerType ??= /** @type {PathSymbolEntity} */(undefined);
this.PinType$bIsReference ??= /** @type {Boolean} */(undefined);
this.PinType$bIsConst ??= /** @type {Boolean} */(undefined);
this.PinType$bIsWeakPointer ??= /** @type {Boolean} */(undefined);
this.PinType$bIsUObjectWrapper ??= /** @type {Boolean} */(undefined);
this.PinType$bIsUObjectWrapper ??= /** @type {Boolean} */(undefined);
/** @type {PinReferenceEntity[]} */ this.LinkedTo;
/** @type {T} */ this.DefaultValue;
/** @type {String} */ this.AutogeneratedDefaultValue;
/** @type {ObjectReferenceEntity} */ this.DefaultObject;
/** @type {GuidEntity} */ this.PersistentGuid;
/** @type {Boolean} */ this.bHidden;
/** @type {Boolean} */ this.bNotConnectable;
/** @type {Boolean} */ this.bDefaultValueIsReadOnly;
/** @type {Boolean} */ this.bDefaultValueIsIgnored;
/** @type {Boolean} */ this.bAdvancedView;
/** @type {Boolean} */ this.bOrphanedPin;
}
getType() {
const subCategory = this["PinType.PinSubCategoryObject"];
if (this["PinType.PinCategory"] === "struct" || this["PinType.PinCategory"] === "object") {
const subCategory = this.PinType$PinSubCategoryObject;
if (this.PinType$PinCategory === "struct" || this.PinType$PinCategory === "object") {
return subCategory.path
}
if (
this["PinType.PinCategory"] === "byte"
this.PinType$PinCategory === "byte"
&& (
subCategory.type === Configuration.nodeType.enum
|| subCategory.type === Configuration.nodeType.userDefinedEnum
@@ -2027,7 +2036,7 @@ class PinEntity extends IEntity {
) {
return "enum"
}
return this["PinType.PinCategory"]
return this.PinType$PinCategory
}
getEntityType(alternative = false) {
@@ -2042,51 +2051,51 @@ class PinEntity extends IEntity {
getDisplayName() {
let matchResult = null;
if (
this["PinToolTip"]
this.PinToolTip
// Match up until the first \n excluded or last character
&& (matchResult = this["PinToolTip"].match(/\s*(.+?(?=\n)|.+\S)\s*/))
&& (matchResult = this.PinToolTip.match(/\s*(.+?(?=\n)|.+\S)\s*/))
) {
return Utility.formatStringName(matchResult[1])
}
return Utility.formatStringName(this["PinName"])
return Utility.formatStringName(this.PinName)
}
/** @param {PinEntity} other */
copyTypeFrom(other) {
this["PinType.PinCategory"] = other["PinType.PinCategory"];
this["PinType.PinSubCategory"] = other["PinType.PinSubCategory"];
this["PinType.PinSubCategoryObject"] = other["PinType.PinSubCategoryObject"];
this["PinType.PinSubCategoryMemberReference"] = other["PinType.PinSubCategoryMemberReference"];
this["PinType.PinValueType"] = other["PinType.PinValueType"];
this["PinType.ContainerType"] = other["PinType.ContainerType"];
this["PinType.bIsReference"] = other["PinType.bIsReference"];
this["PinType.bIsConst"] = other["PinType.bIsConst"];
this["PinType.bIsWeakPointer"] = other["PinType.bIsWeakPointer"];
this["PinType.bIsUObjectWrapper"] = other["PinType.bIsUObjectWrapper"];
this["PinType.bSerializeAsSinglePrecisionFloat"] = other["PinType.bSerializeAsSinglePrecisionFloat"];
this.PinType$PinCategory = other.PinType$PinCategory;
this.PinType$PinSubCategory = other.PinType$PinSubCategory;
this.PinType$PinSubCategoryObject = other.PinType$PinSubCategoryObject;
this.PinType$PinSubCategoryMemberReference = other.PinType$PinSubCategoryMemberReference;
this.PinType$PinValueType = other.PinType$PinValueType;
this.PinType$ContainerType = other.PinType$ContainerType;
this.PinType$bIsReference = other.PinType$bIsReference;
this.PinType$bIsConst = other.PinType$bIsConst;
this.PinType$bIsWeakPointer = other.PinType$bIsWeakPointer;
this.PinType$bIsUObjectWrapper = other.PinType$bIsUObjectWrapper;
this.PinType$bSerializeAsSinglePrecisionFloat = other.PinType$bSerializeAsSinglePrecisionFloat;
}
getDefaultValue(maybeCreate = false) {
if (this["DefaultValue"] === undefined && maybeCreate) {
this["DefaultValue"] = new (this.getEntityType(true))();
if (this.DefaultValue === undefined && maybeCreate) {
this.DefaultValue = new (this.getEntityType(true))();
}
return this["DefaultValue"]
return this.DefaultValue
}
isExecution() {
return this["PinType.PinCategory"] === "exec"
return this.PinType$PinCategory === "exec"
}
isHidden() {
return this["bHidden"]
return this.bHidden
}
isInput() {
return !this["bHidden"] && this["Direction"] != "EGPD_Output"
return !this.bHidden && this.Direction != "EGPD_Output"
}
isOutput() {
return !this["bHidden"] && this["Direction"] == "EGPD_Output"
return !this.bHidden && this.Direction == "EGPD_Output"
}
isLinked() {
@@ -2132,13 +2141,13 @@ class PinEntity extends IEntity {
}
getSubCategory() {
return this["PinType.PinSubCategoryObject"].path
return this.PinType$PinSubCategoryObject.path
}
/** @return {CSSResult} */
pinColor() {
return Configuration.pinColor[this.getType()]
?? Configuration.pinColor[this["PinType.PinCategory"]]
?? Configuration.pinColor[this.PinType$PinCategory]
?? Configuration.pinColor["default"]
}
}
@@ -2871,7 +2880,7 @@ class ObjectEntity extends IEntity {
}
getDelegatePin() {
return this.CustomProperties?.find(pin => pin["PinType.PinCategory"] === "delegate")
return this.CustomProperties?.find(pin => pin.PinType$PinCategory === "delegate")
}
nodeDisplayName() {
@@ -3095,7 +3104,7 @@ class UnknownKeysEntity extends IEntity {
}
constructor(values) {
super(values);
super(values, true);
/** @type {String} */ this.lookbehind;
}
}
@@ -3341,7 +3350,7 @@ class Grammar {
).chain(([attributeName, _1]) => this
.grammarFor(entityType.attributes[attributeName], undefined)
.map(attributeValue =>
values => values[attributeName] = attributeValue
values => values[Utility.encodeKeyName(attributeName)] = attributeValue
))
}
@@ -3572,7 +3581,7 @@ class Grammar {
let values = {};
attributes.forEach(attributeSetter => attributeSetter(values));
if (lookbehind.length) {
values["lookbehind"] = lookbehind;
values.lookbehind = lookbehind;
}
return new UnknownKeysEntity(values)
})
@@ -3604,10 +3613,10 @@ class Grammar {
P.regex(/CustomProperties\s+/),
this.pinEntity,
).map(([_0, pin]) => values => {
if (!values["CustomProperties"]) {
values["CustomProperties"] = [];
if (!values.CustomProperties) {
values.CustomProperties = [];
}
values["CustomProperties"].push(pin);
values.CustomProperties.push(pin);
})
)
@@ -3831,7 +3840,7 @@ class ISerializer {
const isSerialized = Utility.isSerialized(entity, fullKey);
result += (result.length ? this.attributeSeparator : "")
+ this.attributePrefix
+ this.attributeKeyPrinter(fullKey)
+ Utility.decodeKeyName(this.attributeKeyPrinter(fullKey))
+ this.attributeValueConjunctionSign
+ (
isSerialized
@@ -3871,7 +3880,7 @@ class ObjectSerializer extends ISerializer {
case "Class":
case "Name":
case "CustomProperties":
// Serielized separately
// Serielized separately, check write()
return false
}
return super.showProperty(entity, object, attributeKey, attributeValue)
@@ -3903,7 +3912,7 @@ class ObjectSerializer extends ISerializer {
* @param {Boolean} insideString
*/
write(entity, object, insideString) {
let result = `Begin Object Class=${object.Class.path} Name=${this.writeValue(entity, object.Name, ["Name"], insideString)}
let result = `Begin Object Class=${object.Class.path} Name=${this.writeValue(entity, object.Name, "Name", insideString)}
${this.subWrite(entity, [], object, insideString)
+ object
.CustomProperties.map(pin =>
@@ -6842,12 +6851,12 @@ class PinTemplate extends ITemplate {
}
renderIcon() {
switch (this.element.entity["PinType.ContainerType"].toString()) {
switch (this.element.entity.PinType$ContainerType.toString()) {
case "Array": return SVGIcon.array
case "Set": return SVGIcon.set
case "Map": return SVGIcon.map
}
if (this.element.entity["PinType.PinCategory"] === "delegate") {
if (this.element.entity.PinType$PinCategory === "delegate") {
return SVGIcon.delegate
}
return SVGIcon.genericPin
@@ -6953,7 +6962,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 === "delegate"),
new MinimalPinTemplate(),
this.element
);
@@ -6963,7 +6972,7 @@ class EventNodeTemplate extends NodeTemplate {
createPinElements() {
return this.element.getPinEntities()
.filter(v => !v.isHidden() && v["PinType.PinCategory"] !== "delegate")
.filter(v => !v.isHidden() && v.PinType$PinCategory !== "delegate")
.map(pinEntity => /** @type {PinElementConstructor} */(ElementFactory.getConstructor("ueb-pin"))
.newObject(pinEntity, undefined, this.element)
)
@@ -9215,7 +9224,7 @@ class PinElement extends IElement {
* @return {new () => PinTemplate}
*/
static getTypeTemplate(pinEntity) {
if (pinEntity["PinType.bIsReference"] && !pinEntity["PinType.bIsConst"]) {
if (pinEntity.PinType$bIsReference && !pinEntity.PinType$bIsConst) {
return PinElement.#inputPinTemplates["MUTABLE_REFERENCE"]
}
if (pinEntity.getType() === "exec") {

File diff suppressed because one or more lines are too long

View File

@@ -51,6 +51,15 @@ export default class Configuration {
static linkCurveHeight = 15 // px
static linkCurveWidth = 80 // px
static linkMinWidth = 100 // px
static nameRegexSpaceReplacement = new RegExp(
"^K2(?:[Nn]ode)?_"
+ "|(?<=[a-z])(?=[A-Z0-9])" // ("Alpha2", "AlphaBravo") => ("Alpha 2", "Alpha Bravo")
+ "|(?<=[A-Z])(?=[A-Z][a-z]|[0-9])" // ("ALPHABravo", "ALPHA2") => ("ALPHA Bravo", "ALPHA 2")
+ "|(?<=[014-9]|[23](?!D(?:[^a-z]|$)))(?=[a-zA-Z])" // ("3Times", "3D", "3Delta") => ("3 Times", "3D", "3 Delta")
+ "|\\s*_+\\s*" // "Alpha__Bravo" => "Alpha Bravo"
+ "|\\s{2,}",
"g"
)
/**
* @param {Number} start
* @param {Number} c1

View File

@@ -1,3 +1,4 @@
import Configuration from "./Configuration.js"
import UnionType from "./entity/UnionType.js"
/**
@@ -47,10 +48,7 @@ export default class Utility {
/** @param {HTMLElement} element */
static getScale(element) {
// @ts-expect-error
const scale = element.blueprint
// @ts-expect-error
? element.blueprint.getScale()
: getComputedStyle(element).getPropertyValue("--ueb-scale")
const scale = element.blueprint?.getScale() ?? getComputedStyle(element).getPropertyValue("--ueb-scale")
return scale != "" ? parseFloat(scale) : 1
}
@@ -328,16 +326,23 @@ export default class Utility {
// Remove leading b (for boolean values) or newlines
.replace(/^\s*b/, "")
// Insert a space where needed, possibly removing unnecessary elading characters
.replaceAll(
/^K2(?:Node|node)?_|(?<=[a-z])(?=[A-Z0-9])|(?<=[A-Z])(?=[A-Z][a-z]|[0-9])|(?<=[014-9]|(?:2|3)(?!D(?:[^a-z]|$)))(?=[a-zA-Z])|\s*_+\s*|\s{2,}/g,
" "
)
.replaceAll(Configuration.nameRegexSpaceReplacement, " ")
.split(" ")
.map(v => Utility.capitalFirstLetter(v))
.join(" ")
.trim()
}
/** @param {String} value */
static encodeKeyName(value) {
return value.replaceAll(".", "$")
}
/** @param {String} value */
static decodeKeyName(value) {
return value.replaceAll("$", ".")
}
/** @param {String} value */
static getIdFromReference(value) {
return value

View File

@@ -107,7 +107,7 @@ export default class PinElement extends IElement {
* @return {new () => PinTemplate}
*/
static getTypeTemplate(pinEntity) {
if (pinEntity["PinType.bIsReference"] && !pinEntity["PinType.bIsConst"]) {
if (pinEntity.PinType$bIsReference && !pinEntity.PinType$bIsConst) {
return PinElement.#inputPinTemplates["MUTABLE_REFERENCE"]
}
if (pinEntity.getType() === "exec") {

View File

@@ -27,5 +27,6 @@ export default class FunctionReferenceEntity extends IEntity {
super(values)
/** @type {ObjectReferenceEntity} */ this.MemberParent
/** @type {String} */ this.MemberName
/** @type {GuidEntity} */ this.MemberGuid
}
}

View File

@@ -19,11 +19,6 @@ export default class KeyBindingEntity extends IEntity {
}
constructor(values = {}) {
values.ActionName = values.ActionName ?? ""
values.bShift = values.bShift ?? false
values.bCtrl = values.bCtrl ?? false
values.bAlt = values.bAlt ?? false
values.bCmd = values.bCmd ?? false
super(values)
/** @type {String} */ this.ActionName
/** @type {Boolean} */ this.bShift

View File

@@ -412,7 +412,7 @@ export default class ObjectEntity extends IEntity {
}
getDelegatePin() {
return this.CustomProperties?.find(pin => pin["PinType.PinCategory"] === "delegate")
return this.CustomProperties?.find(pin => pin.PinType$PinCategory === "delegate")
}
nodeDisplayName() {

View File

@@ -125,42 +125,42 @@ export default class PinEntity extends IEntity {
constructor(values = {}, suppressWarns = false) {
super(values, suppressWarns)
this["PinId"] ??= /** @type {GuidEntity} */(undefined)
this["PinName"] ??= /** @type {String} */(undefined)
this["PinFriendlyName"] ??= /** @type {LocalizedTextEntity | String} */(undefined)
this["PinToolTip"] ??= /** @type {String} */(undefined)
this["Direction"] ??= /** @type {String} */(undefined)
this["PinType.PinCategory"] ??= /** @type {String} */(undefined)
this["PinType.PinSubCategory"] ??= /** @type {String} */(undefined)
this["PinType.PinSubCategoryObject"] ??= /** @type {ObjectReferenceEntity} */(undefined)
this["PinType.PinSubCategoryMemberReference"] ??= /** @type {FunctionReferenceEntity} */(undefined)
this["PinType.PinValueType"] ??= /** @type {PinTypeEntity} */(undefined)
this["PinType.ContainerType"] ??= /** @type {PathSymbolEntity} */(undefined)
this["PinType.bIsReference"] ??= /** @type {Boolean} */(undefined)
this["PinType.bIsConst"] ??= /** @type {Boolean} */(undefined)
this["PinType.bIsWeakPointer"] ??= /** @type {Boolean} */(undefined)
this["PinType.bIsUObjectWrapper"] ??= /** @type {Boolean} */(undefined)
this["PinType.bIsUObjectWrapper"] ??= /** @type {Boolean} */(undefined)
this["LinkedTo"] ??= /** @type {PinReferenceEntity[]} */(undefined)
this["DefaultValue"] ??= /** @type {T} */(undefined)
this["AutogeneratedDefaultValue"] ??= /** @type {String} */(undefined)
this["DefaultObject"] ??= /** @type {ObjectReferenceEntity} */(undefined)
this["PersistentGuid"] ??= /** @type {GuidEntity} */(undefined)
this["bHidden"] ??= /** @type {Boolean} */(undefined)
this["bNotConnectable"] ??= /** @type {Boolean} */(undefined)
this["bDefaultValueIsReadOnly"] ??= /** @type {Boolean} */(undefined)
this["bDefaultValueIsIgnored"] ??= /** @type {Boolean} */(undefined)
this["bAdvancedView"] ??= /** @type {Boolean} */(undefined)
this["bOrphanedPin"] ??= /** @type {Boolean} */(undefined)
/** @type {GuidEntity} */ this.PinId
/** @type {String} */ this.PinName
/** @type {LocalizedTextEntity | String} */ this.PinFriendlyName
/** @type {String} */ this.PinToolTip
/** @type {String} */ this.Direction
this.PinType$PinCategory ??= /** @type {String} */(undefined)
this.PinType$PinSubCategory ??= /** @type {String} */(undefined)
this.PinType$PinSubCategoryObject ??= /** @type {ObjectReferenceEntity} */(undefined)
this.PinType$PinSubCategoryMemberReference ??= /** @type {FunctionReferenceEntity} */(undefined)
this.PinType$PinValueType ??= /** @type {PinTypeEntity} */(undefined)
this.PinType$ContainerType ??= /** @type {PathSymbolEntity} */(undefined)
this.PinType$bIsReference ??= /** @type {Boolean} */(undefined)
this.PinType$bIsConst ??= /** @type {Boolean} */(undefined)
this.PinType$bIsWeakPointer ??= /** @type {Boolean} */(undefined)
this.PinType$bIsUObjectWrapper ??= /** @type {Boolean} */(undefined)
this.PinType$bIsUObjectWrapper ??= /** @type {Boolean} */(undefined)
/** @type {PinReferenceEntity[]} */ this.LinkedTo
/** @type {T} */ this.DefaultValue
/** @type {String} */ this.AutogeneratedDefaultValue
/** @type {ObjectReferenceEntity} */ this.DefaultObject
/** @type {GuidEntity} */ this.PersistentGuid
/** @type {Boolean} */ this.bHidden
/** @type {Boolean} */ this.bNotConnectable
/** @type {Boolean} */ this.bDefaultValueIsReadOnly
/** @type {Boolean} */ this.bDefaultValueIsIgnored
/** @type {Boolean} */ this.bAdvancedView
/** @type {Boolean} */ this.bOrphanedPin
}
getType() {
const subCategory = this["PinType.PinSubCategoryObject"]
if (this["PinType.PinCategory"] === "struct" || this["PinType.PinCategory"] === "object") {
const subCategory = this.PinType$PinSubCategoryObject
if (this.PinType$PinCategory === "struct" || this.PinType$PinCategory === "object") {
return subCategory.path
}
if (
this["PinType.PinCategory"] === "byte"
this.PinType$PinCategory === "byte"
&& (
subCategory.type === Configuration.nodeType.enum
|| subCategory.type === Configuration.nodeType.userDefinedEnum
@@ -168,7 +168,7 @@ export default class PinEntity extends IEntity {
) {
return "enum"
}
return this["PinType.PinCategory"]
return this.PinType$PinCategory
}
getEntityType(alternative = false) {
@@ -183,51 +183,51 @@ export default class PinEntity extends IEntity {
getDisplayName() {
let matchResult = null
if (
this["PinToolTip"]
this.PinToolTip
// Match up until the first \n excluded or last character
&& (matchResult = this["PinToolTip"].match(/\s*(.+?(?=\n)|.+\S)\s*/))
&& (matchResult = this.PinToolTip.match(/\s*(.+?(?=\n)|.+\S)\s*/))
) {
return Utility.formatStringName(matchResult[1])
}
return Utility.formatStringName(this["PinName"])
return Utility.formatStringName(this.PinName)
}
/** @param {PinEntity} other */
copyTypeFrom(other) {
this["PinType.PinCategory"] = other["PinType.PinCategory"]
this["PinType.PinSubCategory"] = other["PinType.PinSubCategory"]
this["PinType.PinSubCategoryObject"] = other["PinType.PinSubCategoryObject"]
this["PinType.PinSubCategoryMemberReference"] = other["PinType.PinSubCategoryMemberReference"]
this["PinType.PinValueType"] = other["PinType.PinValueType"]
this["PinType.ContainerType"] = other["PinType.ContainerType"]
this["PinType.bIsReference"] = other["PinType.bIsReference"]
this["PinType.bIsConst"] = other["PinType.bIsConst"]
this["PinType.bIsWeakPointer"] = other["PinType.bIsWeakPointer"]
this["PinType.bIsUObjectWrapper"] = other["PinType.bIsUObjectWrapper"]
this["PinType.bSerializeAsSinglePrecisionFloat"] = other["PinType.bSerializeAsSinglePrecisionFloat"]
this.PinType$PinCategory = other.PinType$PinCategory
this.PinType$PinSubCategory = other.PinType$PinSubCategory
this.PinType$PinSubCategoryObject = other.PinType$PinSubCategoryObject
this.PinType$PinSubCategoryMemberReference = other.PinType$PinSubCategoryMemberReference
this.PinType$PinValueType = other.PinType$PinValueType
this.PinType$ContainerType = other.PinType$ContainerType
this.PinType$bIsReference = other.PinType$bIsReference
this.PinType$bIsConst = other.PinType$bIsConst
this.PinType$bIsWeakPointer = other.PinType$bIsWeakPointer
this.PinType$bIsUObjectWrapper = other.PinType$bIsUObjectWrapper
this.PinType$bSerializeAsSinglePrecisionFloat = other.PinType$bSerializeAsSinglePrecisionFloat
}
getDefaultValue(maybeCreate = false) {
if (this["DefaultValue"] === undefined && maybeCreate) {
this["DefaultValue"] = new (this.getEntityType(true))()
if (this.DefaultValue === undefined && maybeCreate) {
this.DefaultValue = new (this.getEntityType(true))()
}
return this["DefaultValue"]
return this.DefaultValue
}
isExecution() {
return this["PinType.PinCategory"] === "exec"
return this.PinType$PinCategory === "exec"
}
isHidden() {
return this["bHidden"]
return this.bHidden
}
isInput() {
return !this["bHidden"] && this["Direction"] != "EGPD_Output"
return !this.bHidden && this.Direction != "EGPD_Output"
}
isOutput() {
return !this["bHidden"] && this["Direction"] == "EGPD_Output"
return !this.bHidden && this.Direction == "EGPD_Output"
}
isLinked() {
@@ -273,13 +273,13 @@ export default class PinEntity extends IEntity {
}
getSubCategory() {
return this["PinType.PinSubCategoryObject"].path
return this.PinType$PinSubCategoryObject.path
}
/** @return {CSSResult} */
pinColor() {
return Configuration.pinColor[this.getType()]
?? Configuration.pinColor[this["PinType.PinCategory"]]
?? Configuration.pinColor[this.PinType$PinCategory]
?? Configuration.pinColor["default"]
}
}

View File

@@ -15,7 +15,7 @@ export default class UnknownKeysEntity extends IEntity {
}
constructor(values) {
super(values)
super(values, true)
/** @type {String} */ this.lookbehind
}
}

View File

@@ -273,7 +273,7 @@ export default class Grammar {
).chain(([attributeName, _1]) => this
.grammarFor(entityType.attributes[attributeName], undefined)
.map(attributeValue =>
values => values[attributeName] = attributeValue
values => values[Utility.encodeKeyName(attributeName)] = attributeValue
))
}
@@ -504,7 +504,7 @@ export default class Grammar {
let values = {}
attributes.forEach(attributeSetter => attributeSetter(values))
if (lookbehind.length) {
values["lookbehind"] = lookbehind
values.lookbehind = lookbehind
}
return new UnknownKeysEntity(values)
})
@@ -536,10 +536,10 @@ export default class Grammar {
P.regex(/CustomProperties\s+/),
this.pinEntity,
).map(([_0, pin]) => values => {
if (!values["CustomProperties"]) {
values["CustomProperties"] = []
if (!values.CustomProperties) {
values.CustomProperties = []
}
values["CustomProperties"].push(pin)
values.CustomProperties.push(pin)
})
)

View File

@@ -109,7 +109,7 @@ export default class ISerializer {
const isSerialized = Utility.isSerialized(entity, fullKey)
result += (result.length ? this.attributeSeparator : "")
+ this.attributePrefix
+ this.attributeKeyPrinter(fullKey)
+ Utility.decodeKeyName(this.attributeKeyPrinter(fullKey))
+ this.attributeValueConjunctionSign
+ (
isSerialized

View File

@@ -15,7 +15,7 @@ export default class ObjectSerializer extends ISerializer {
case "Class":
case "Name":
case "CustomProperties":
// Serielized separately
// Serielized separately, check write()
return false
}
return super.showProperty(entity, object, attributeKey, attributeValue)
@@ -47,7 +47,7 @@ export default class ObjectSerializer extends ISerializer {
* @param {Boolean} insideString
*/
write(entity, object, insideString) {
let result = `Begin Object Class=${object.Class.path} Name=${this.writeValue(entity, object.Name, ["Name"], insideString)}
let result = `Begin Object Class=${object.Class.path} Name=${this.writeValue(entity, object.Name, "Name", insideString)}
${this.subWrite(entity, [], object, insideString)
+ object
.CustomProperties.map(pin =>

View File

@@ -42,7 +42,7 @@ export default 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 === "delegate"),
new MinimalPinTemplate(),
this.element
)
@@ -52,7 +52,7 @@ export default class EventNodeTemplate extends NodeTemplate {
createPinElements() {
return this.element.getPinEntities()
.filter(v => !v.isHidden() && v["PinType.PinCategory"] !== "delegate")
.filter(v => !v.isHidden() && v.PinType$PinCategory !== "delegate")
.map(pinEntity => /** @type {PinElementConstructor} */(ElementFactory.getConstructor("ueb-pin"))
.newObject(pinEntity, undefined, this.element)
)

View File

@@ -76,12 +76,12 @@ export default class PinTemplate extends ITemplate {
}
renderIcon() {
switch (this.element.entity["PinType.ContainerType"].toString()) {
switch (this.element.entity.PinType$ContainerType.toString()) {
case "Array": return SVGIcon.array
case "Set": return SVGIcon.set
case "Map": return SVGIcon.map
}
if (this.element.entity["PinType.PinCategory"] === "delegate") {
if (this.element.entity.PinType$PinCategory === "delegate") {
return SVGIcon.delegate
}
return SVGIcon.genericPin