Flip Flop node info added and minor adjustments

This commit is contained in:
barsdeveloper
2023-04-16 13:37:15 +02:00
parent a82f61ac4a
commit c1bbbfef90
11 changed files with 137 additions and 49 deletions

81
dist/ueblueprint.js vendored
View File

@@ -114,10 +114,12 @@ class Configuration {
doN: "/Engine/EditorBlueprintResources/StandardMacros.StandardMacros:Do N",
doOnce: "/Engine/EditorBlueprintResources/StandardMacros.StandardMacros:DoOnce",
dynamicCast: "/Script/BlueprintGraph.K2Node_DynamicCast",
edGraphPinDeprecated: "/Script/Engine.EdGraphPin_Deprecated",
enum: "/Script/CoreUObject.Enum",
enumLiteral: "/Script/BlueprintGraph.K2Node_EnumLiteral",
event: "/Script/BlueprintGraph.K2Node_Event",
executionSequence: "/Script/BlueprintGraph.K2Node_ExecutionSequence",
flipflop: "/Engine/EditorBlueprintResources/StandardMacros.StandardMacros:FlipFlop",
forEachElementInEnum: "/Script/BlueprintGraph.K2Node_ForEachElementInEnum",
forEachLoop: "/Engine/EditorBlueprintResources/StandardMacros.StandardMacros:ForEachLoop",
forEachLoopWithBreak: "/Engine/EditorBlueprintResources/StandardMacros.StandardMacros:ForEachLoopWithBreak",
@@ -197,12 +199,13 @@ class Configuration {
static selectAllKeyboardKey = "(bCtrl=True,Key=A)"
static smoothScrollTime = 1000 // ms
static stringEscapedCharacters = /['"\\]/g
static subObjectAttributeNamePrefix = "#SubObject"
/** @param {ObjectEntity} objectEntity */
static subObjectAttributeNameFromEntity = objectEntity =>
"#SubObject" + (objectEntity.Class.type ? "_" + objectEntity.Class.type : "") + "_" + objectEntity.Name
static subObjectAttributeNameFromEntity = (objectEntity, nameOnly = false) =>
this.subObjectAttributeNamePrefix + (!nameOnly && objectEntity.Class.type ? "_" + objectEntity.Class.type : "") + "_" + objectEntity.Name
/** @param {ObjectReferenceEntity} objectReferenceEntity */
static subObjectAttributeNameFromReference = objectReferenceEntity =>
"#SubObject_" + objectReferenceEntity.type + "_" + objectReferenceEntity.path
static subObjectAttributeNameFromReference = (objectReferenceEntity, nameOnly = false) =>
this.subObjectAttributeNamePrefix + (!nameOnly ? "_" + objectReferenceEntity.type : "") + "_" + objectReferenceEntity.path
static trackingMouseEventName = {
begin: "ueb-tracking-mouse-begin",
end: "ueb-tracking-mouse-end",
@@ -804,6 +807,11 @@ class Utility {
.toLowerCase()
}
/** @param {String} pathValue */
static getNameFromPath(pathValue) {
return pathValue.match(/[^\.\/]+$/)?.[0] ?? ""
}
/** @param {LinearColorEntity} value */
static printLinearColor(value) {
return `${Math.round(value.R.valueOf() * 255)}, ${Math.round(value.G.valueOf() * 255)}, ${Math.round(value.B.valueOf() * 255)}`
@@ -1356,7 +1364,7 @@ class ObjectReferenceEntity extends IEntity {
}
getName() {
return this.path.match(/[^\.\/]+$/)?.[0] ?? ""
return Utility.getNameFromPath(this.path)
}
}
@@ -2020,6 +2028,7 @@ class SimpleSerializationVectorEntity extends VectorEntity {
/**
* @typedef {import("./IEntity.js").AnyValue} AnyValue
* @typedef {import("./ObjectEntity.js").default} ObjectEntity
* @typedef {import("lit").CSSResult} CSSResult
*/
@@ -2147,6 +2156,11 @@ class PinEntity extends IEntity {
/** @type {Boolean} */ this.bOrphanedPin;
}
/** @param {ObjectEntity} objectEntity */
static fromLegacyObject(objectEntity) {
return new PinEntity(objectEntity, true)
}
getType() {
const subCategory = this.PinType.PinSubCategoryObject;
if (this.PinType.PinCategory === "struct" || this.PinType.PinCategory === "object") {
@@ -2388,6 +2402,14 @@ class SVGIcon {
</svg>
`
static flipflop = y`
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M14 2L10 14" stroke="white" stroke-width="2" stroke-linecap="round"/>
<path d="M6 2L2 14" stroke="white" stroke-width="2" stroke-linecap="round"/>
<path d="M6 2L10 14" stroke="white" stroke-opacity="0.5" stroke-width="2" stroke-linecap="round"/>
</svg>
`
static forEachLoop = y`
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 2C1.8 2 0 3.8 0 6V9C0 11.2 2 13 4 13H10V11H5C3.2 11 2 9.7 2 8V7C2 5.63882 2.76933 4.53408 4 4.14779V2ZM12 4C13.8 4 14 5.3 14 7V8C14 8.8 13.7 9.5 13.3 10L15.2 11.4C15.7 10.7 16 9.9 16 9V6C16 3.8 14.2 2 12 2V4Z" fill="white" />
@@ -2836,11 +2858,6 @@ class ObjectEntity extends IEntity {
CustomProperties: {
type: [new UnionType(PinEntity, UnknownPinEntity)],
},
// Legacy
Pins: {
type: [ObjectReferenceEntity],
inlined: true,
},
}
static nameRegex = /^(\w+?)(?:_(\d+))?$/
@@ -2941,12 +2958,34 @@ class ObjectEntity extends IEntity {
/** @type {IntegerEntity?} */ this.ErrorType;
/** @type {String?} */ this.ErrorMsg;
/** @type {(PinEntity | UnknownPinEntity)[]} */ this.CustomProperties;
// Legacy
/** @type {ObjectReferenceEntity[]} */ this.Pins;
// Legacy objects transform into pins
if (this["Pins"] instanceof Array) {
this["Pins"]
.forEach(
/** @param {ObjectReferenceEntity} objectReference */
objectReference => {
const pinObject = this[Configuration.subObjectAttributeNameFromReference(objectReference, true)];
if (pinObject) {
const pinEntity = PinEntity.fromLegacyObject(pinObject);
pinEntity.LinkedTo = [];
this.CustomProperties.push(pinEntity);
}
});
}
// Legacy path names
if (this.Class.type && !this.Class.type.startsWith("/")) {
const nodeType = Object.keys(Configuration.nodeType)
.find(type => Utility.getNameFromPath(Configuration.nodeType[type]) === this.Class.type);
if (nodeType) {
this.Class.type = Configuration.nodeType[nodeType];
}
}
}
getClass() {
return this.Class.path
return this.Class.path ? this.Class.path : this.Class.type
}
getType() {
@@ -3226,6 +3265,8 @@ class ObjectEntity extends IEntity {
case Configuration.nodeType.executionSequence:
case Configuration.nodeType.multiGate:
return SVGIcon.sequence
case Configuration.nodeType.flipflop:
return SVGIcon.flipflop
case Configuration.nodeType.forEachElementInEnum:
case Configuration.nodeType.forLoop:
case Configuration.nodeType.forLoopWithBreak:
@@ -4325,10 +4366,10 @@ class ObjectSerializer extends Serializer {
key => entity[key] instanceof ObjectEntity ? "" : attributeKeyPrinter(key)
)
+ entity.CustomProperties.map(pin =>
this.attributeSeparator
+ moreIndentation
moreIndentation
+ attributeKeyPrinter("CustomProperties ")
+ SerializerFactory.getSerializer(PinEntity).doWrite(pin, insideString)
+ this.attributeSeparator
)
.join("")
+ indentation + "End Object";
@@ -7910,15 +7951,7 @@ class NodeElement extends ISelectableDraggableElement {
/** @returns {PinEntity[]} */
getPinEntities() {
if (this.entity.CustomProperties.length > 0) {
return this.entity.CustomProperties.filter(v => v instanceof PinEntity)
}
// Legacy nodes attempt to find pin entities
if (this.entity.Pins) {
return this.entity.Pins.map(objectReference =>
new UnknownPinEntity(this.entity[Configuration.subObjectAttributeNameFromReference(objectReference)])
)
}
return this.entity.CustomProperties.filter(v => v instanceof PinEntity)
}
setLocation(x = 0, y = 0, acknowledge = true) {

File diff suppressed because one or more lines are too long