diff --git a/js/GraphEntity.js b/js/GraphEntity.js index c06f02f..b063dd9 100644 --- a/js/GraphEntity.js +++ b/js/GraphEntity.js @@ -8,7 +8,7 @@ export default class GraphEntity extends HTMLElement { */ constructor(template) { super() - /** @type {import("./UEBlueprint").EBlueprint}" */ + /** @type {import("./UEBlueprint").default}" */ this.blueprint = null this.template = template } diff --git a/js/UEBlueprintObject.js b/js/GraphNode.js similarity index 82% rename from js/UEBlueprintObject.js rename to js/GraphNode.js index 9f2b350..2537b41 100644 --- a/js/UEBlueprintObject.js +++ b/js/GraphNode.js @@ -1,7 +1,7 @@ import SelectableDraggable from "./SelectableDraggable" import NodeTemplate from "./template/NodeTemplate" -export default class UEBlueprintObject extends SelectableDraggable { +export default class GraphNode extends SelectableDraggable { constructor() { super(new NodeTemplate()) @@ -21,4 +21,4 @@ export default class UEBlueprintObject extends SelectableDraggable { } } -customElements.define('u-object', UEBlueprintObject) +customElements.define('u-object', GraphNode) diff --git a/js/UEBlueprint.js b/js/UEBlueprint.js index 120dca3..54619bf 100644 --- a/js/UEBlueprint.js +++ b/js/UEBlueprint.js @@ -8,7 +8,7 @@ import GraphEntity from "./GraphEntity" import BlueprintTemplate from "./template/BlueprintTemplate" /** - * @typedef {import("./UEBlueprintObject").default} UEBlueprintObject + * @typedef {import("./GraphNode").default} GrapNode */ export default class UEBlueprint extends GraphEntity { @@ -18,7 +18,7 @@ export default class UEBlueprint extends GraphEntity { constructor() { super(new BlueprintTemplate()) - /** @type {UEBlueprintObject[]}" */ + /** @type {GrapNode[]}" */ this.nodes = new Array() this.expandGridSize = 400 /** @type {HTMLElement} */ @@ -44,7 +44,7 @@ export default class UEBlueprint extends GraphEntity { /** @type {FastSelectionModel} */ this.selectionModel = null let self = this - /** @type {(node: UEBlueprintObject) => BoundariesInfo} */ + /** @type {(node: GrapNode) => BoundariesInfo} */ this.nodeBoundariesSupplier = (node) => { let rect = node.getBoundingClientRect() let gridRect = this.nodesContainerElement.getBoundingClientRect() @@ -57,7 +57,7 @@ export default class UEBlueprint extends GraphEntity { secondarySup: (rect.bottom - gridRect.bottom) * scaleCorrection } } - /** @type {(node: UEBlueprintObject, selected: bool) => void}} */ + /** @type {(node: GrapNode, selected: bool) => void}} */ this.nodeSelectToggleFunction = (node, selected) => { node.setSelected(selected) } @@ -331,7 +331,7 @@ export default class UEBlueprint extends GraphEntity { /** * - * @param {...UEBlueprintObject} blueprintNodes + * @param {...GrapNode} blueprintNodes */ addNode(...blueprintNodes) { [...blueprintNodes].reduce( diff --git a/js/exporting.js b/js/exporting.js index a0f5105..16fd1bc 100644 --- a/js/exporting.js +++ b/js/exporting.js @@ -1,5 +1,5 @@ import UEBlueprint from "./UEBlueprint" -import UEBlueprintObject from "./UEBlueprintObject" import GraphPin from "./GraphPin" +import GraphNode from "./GraphNode" -export { UEBlueprint as UEBlueprint, UEBlueprintObject, GraphPin as UGraphPin } \ No newline at end of file +export { UEBlueprint as UEBlueprint, GraphNode as GraphNode, GraphPin as UGraphPin } \ No newline at end of file diff --git a/js/input/MouseWheel.js b/js/input/MouseWheel.js index 457f16e..4995e4b 100644 --- a/js/input/MouseWheel.js +++ b/js/input/MouseWheel.js @@ -5,7 +5,7 @@ export default class MouseWheel extends Pointing { /** * * @param {HTMLElement} target - * @param {import("../UEBlueprint").EBlueprint} blueprint + * @param {import("../UEBlueprint").default} blueprint * @param {Object} options */ constructor(target, blueprint, options) { diff --git a/js/input/Pointing.js b/js/input/Pointing.js index 95af48a..6230d06 100644 --- a/js/input/Pointing.js +++ b/js/input/Pointing.js @@ -5,7 +5,7 @@ export default class Pointing { constructor(target, blueprint, options) { /** @type {HTMLElement} */ this.target = target - /** @type {import("../UEBlueprint").EBlueprint}" */ + /** @type {import("../UEBlueprint").default}" */ this.blueprint = blueprint this.movementSpace = this.blueprint?.getGridDOMElement() ?? document.documentElement } diff --git a/ueblueprint.html b/ueblueprint.html index dd61d65..0c0e1c7 100644 --- a/ueblueprint.html +++ b/ueblueprint.html @@ -14,13 +14,13 @@
Hello
diff --git a/ueblueprint.js b/ueblueprint.js index 6bfa9aa..ce2bd0d 100644 --- a/ueblueprint.js +++ b/ueblueprint.js @@ -13,7 +13,7 @@ class Pointing { constructor(target, blueprint, options) { /** @type {HTMLElement} */ this.target = target; - /** @type {import("../UEBlueprint").EBlueprint}" */ + /** @type {import("../UEBlueprint").default}" */ this.blueprint = blueprint; this.movementSpace = this.blueprint?.getGridDOMElement() ?? document.documentElement; } @@ -166,7 +166,7 @@ class MouseWheel extends Pointing { /** * * @param {HTMLElement} target - * @param {import("../UEBlueprint").EBlueprint} blueprint + * @param {import("../UEBlueprint").default} blueprint * @param {Object} options */ constructor(target, blueprint, options) { @@ -526,7 +526,7 @@ class GraphEntity extends HTMLElement { */ constructor(template) { super(); - /** @type {import("./UEBlueprint").EBlueprint}" */ + /** @type {import("./UEBlueprint").default}" */ this.blueprint = null; this.template = template; } @@ -613,7 +613,7 @@ class BlueprintTemplate extends Template { } /** - * @typedef {import("./UEBlueprintObject").default} UEBlueprintObject + * @typedef {import("./GraphNode").default} GrapNode */ class UEBlueprint extends GraphEntity { @@ -623,7 +623,7 @@ class UEBlueprint extends GraphEntity { constructor() { super(new BlueprintTemplate()); - /** @type {UEBlueprintObject[]}" */ + /** @type {GrapNode[]}" */ this.nodes = new Array(); this.expandGridSize = 400; /** @type {HTMLElement} */ @@ -648,7 +648,7 @@ class UEBlueprint extends GraphEntity { this.headerElement = null; /** @type {FastSelectionModel} */ this.selectionModel = null; - /** @type {(node: UEBlueprintObject) => BoundariesInfo} */ + /** @type {(node: GrapNode) => BoundariesInfo} */ this.nodeBoundariesSupplier = (node) => { let rect = node.getBoundingClientRect(); let gridRect = this.nodesContainerElement.getBoundingClientRect(); @@ -661,7 +661,7 @@ class UEBlueprint extends GraphEntity { secondarySup: (rect.bottom - gridRect.bottom) * scaleCorrection } }; - /** @type {(node: UEBlueprintObject, selected: bool) => void}} */ + /** @type {(node: GrapNode, selected: bool) => void}} */ this.nodeSelectToggleFunction = (node, selected) => { node.setSelected(selected); }; @@ -935,7 +935,7 @@ class UEBlueprint extends GraphEntity { /** * - * @param {...UEBlueprintObject} blueprintNodes + * @param {...GrapNode} blueprintNodes */ addNode(...blueprintNodes) { [...blueprintNodes].reduce( @@ -952,6 +952,101 @@ class UEBlueprint extends GraphEntity { customElements.define('u-blueprint', UEBlueprint); +class Guid { + static generateGuid() { + let result = ""; + let random = new Uint32Array(4); + crypto.getRandomValues(random); + random.forEach(n => { + this.result += ('00000000' + n.toString(16).toUpperCase()).slice(-8); + }); + return result + } + + constructor(guid) { + if (guid?.constructor?.name === 'String') { + this.value = guid; + } else if (guid?.constructor?.name === 'FGuid') { + this.value = guid.value; + } else { + this.value = Guid.generateGuid(); + } + } + + toString() { + return this.value + } +} + +class GraphPin { + constructor(Options) { + this.PinId = new Guid(Options?.PinId); + this.PinName = Options?.PinName ?? ""; + this.PinToolTip = Options?.PinToolTip ?? ""; + this.PinType = { + PinCategory: Options?.PinType?.PinCategory ?? "object", + PinSubCategory: Options?.PinType?.PinSubCategory ?? "", + PinSubCategoryMemberReference: Options?.PinType?.PinSubCategoryMemberReference ?? "", + PinValueType: Options?.PinType?.PinValueType ?? "", + PinValueType: Options?.PinType?.ContainerType ?? "None", + bIsReference: Options?.PinType?.bIsReference ?? false, + bIsConst: Options?.PinType?.bIsConst ?? false, + bIsWeakPointer: Options?.PinType?.bIsWeakPointer ?? false, + bIsUObjectWrapper: Options?.PinType?.bIsUObjectWrapper ?? false + }; + this.LinkedTo = Options?.LinkedTo ?? null; + this.DefaultValue = Options?.DefaultValue ?? true; + this.AutogeneratedDefaultValue = Options?.AutogeneratedDefaultValue ?? false; + this.PersistentGuid = Options?.PersistentGuid ?? null; + this.bHidden = Options?.bHidden ?? false; + this.bNotConnectable = Options?.bNotConnectable ?? false; + this.bDefaultValueIsReadOnly = Options?.bDefaultValueIsReadOnly ?? false; + this.bDefaultValueIsIgnored = Options?.bDefaultValueIsIgnored ?? false; + this.bAdvancedView = Options?.bAdvancedView ?? false; + this.bOrphanedPin = Options?.bOrphanedPin ?? false; + } + + static serializeValue(value) { + // No quotes + if (value === null) { + return '()' + } + if (value?.constructor?.name === 'Boolean') { + return value ? 'True' : 'False' + } + if (value?.constructor?.name === 'ETypesNames' || value?.constructor?.name === 'FGuid') { + return value.toString() + } + // Quotes + if (value?.constructor?.name === 'String') { + return `"${value}"` + } + } + + static subSerialize(prefix, object) { + let result = ""; + prefix += prefix != "" ? "." : ""; + for (const property in object) { + if (object[property]?.constructor?.name === 'Object') { + result += GraphPin.subSerialize(prefix + property, object[property]); + } else { + result += `${prefix + property}=${GraphPin.serializeValue(object[property])},`; + } + } + return result + } + + serialize() { + let result = `CustomProperties Pin (${this.constructor.subSerialize('', this)})`; + return result + } + + toString() { + return this.serialize() + } + +} + class Drag extends MouseClickDrag { constructor(target, blueprint, options) { super(target, blueprint, options); @@ -1123,7 +1218,7 @@ class NodeTemplate extends Template { } } -class UEBlueprintObject extends SelectableDraggable { +class GraphNode extends SelectableDraggable { constructor() { super(new NodeTemplate()); @@ -1143,101 +1238,6 @@ class UEBlueprintObject extends SelectableDraggable { } } -customElements.define('u-object', UEBlueprintObject); +customElements.define('u-object', GraphNode); -class Guid { - static generateGuid() { - let result = ""; - let random = new Uint32Array(4); - crypto.getRandomValues(random); - random.forEach(n => { - this.result += ('00000000' + n.toString(16).toUpperCase()).slice(-8); - }); - return result - } - - constructor(guid) { - if (guid?.constructor?.name === 'String') { - this.value = guid; - } else if (guid?.constructor?.name === 'FGuid') { - this.value = guid.value; - } else { - this.value = Guid.generateGuid(); - } - } - - toString() { - return this.value - } -} - -class GraphPin { - constructor(Options) { - this.PinId = new Guid(Options?.PinId); - this.PinName = Options?.PinName ?? ""; - this.PinToolTip = Options?.PinToolTip ?? ""; - this.PinType = { - PinCategory: Options?.PinType?.PinCategory ?? "object", - PinSubCategory: Options?.PinType?.PinSubCategory ?? "", - PinSubCategoryMemberReference: Options?.PinType?.PinSubCategoryMemberReference ?? "", - PinValueType: Options?.PinType?.PinValueType ?? "", - PinValueType: Options?.PinType?.ContainerType ?? "None", - bIsReference: Options?.PinType?.bIsReference ?? false, - bIsConst: Options?.PinType?.bIsConst ?? false, - bIsWeakPointer: Options?.PinType?.bIsWeakPointer ?? false, - bIsUObjectWrapper: Options?.PinType?.bIsUObjectWrapper ?? false - }; - this.LinkedTo = Options?.LinkedTo ?? null; - this.DefaultValue = Options?.DefaultValue ?? true; - this.AutogeneratedDefaultValue = Options?.AutogeneratedDefaultValue ?? false; - this.PersistentGuid = Options?.PersistentGuid ?? null; - this.bHidden = Options?.bHidden ?? false; - this.bNotConnectable = Options?.bNotConnectable ?? false; - this.bDefaultValueIsReadOnly = Options?.bDefaultValueIsReadOnly ?? false; - this.bDefaultValueIsIgnored = Options?.bDefaultValueIsIgnored ?? false; - this.bAdvancedView = Options?.bAdvancedView ?? false; - this.bOrphanedPin = Options?.bOrphanedPin ?? false; - } - - static serializeValue(value) { - // No quotes - if (value === null) { - return '()' - } - if (value?.constructor?.name === 'Boolean') { - return value ? 'True' : 'False' - } - if (value?.constructor?.name === 'ETypesNames' || value?.constructor?.name === 'FGuid') { - return value.toString() - } - // Quotes - if (value?.constructor?.name === 'String') { - return `"${value}"` - } - } - - static subSerialize(prefix, object) { - let result = ""; - prefix += prefix != "" ? "." : ""; - for (const property in object) { - if (object[property]?.constructor?.name === 'Object') { - result += GraphPin.subSerialize(prefix + property, object[property]); - } else { - result += `${prefix + property}=${GraphPin.serializeValue(object[property])},`; - } - } - return result - } - - serialize() { - let result = `CustomProperties Pin (${this.constructor.subSerialize('', this)})`; - return result - } - - toString() { - return this.serialize() - } - -} - -export { UEBlueprint, UEBlueprintObject, GraphPin as UGraphPin }; +export { GraphNode, UEBlueprint, GraphPin as UGraphPin };