import { css } from "lit" /** * @typedef {import("./element/NodeElement").default} NodeElement * @typedef {import("./element/PinElement").default} PinElement * @typedef {import("lit").CSSResult} CSSResult */ export default class Configuration { static nodeColors = { blue: css`84, 122, 156`, gray: css`150,150,150`, green: css`95, 129, 90`, lime: css`150, 160, 30`, red: css`151, 33, 32`, turquoise: css`46, 104, 106`, } static alphaPattern = "repeating-conic-gradient(#7c8184 0% 25%, #c2c3c4 0% 50%) 50% / 10px 10px" static colorDragEventName = "ueb-color-drag" static colorPickEventName = "ueb-color-pick" static colorWindowEventName = "ueb-color-window" static colorWindowName = "Color Picker" static defaultCommentHeight = 96 static defaultCommentWidth = 400 static deleteNodesKeyboardKey = "Delete" static distanceThreshold = 5 // px static dragEventName = "ueb-drag" static dragGeneralEventName = "ueb-drag-general" static edgeScrollThreshold = 50 static editTextEventName = { begin: "ueb-edit-text-begin", end: "ueb-edit-text-end", } static enableZoomIn = ["LeftControl", "RightControl"] // Button to enable more than 0 (1:1) zoom static expandGridSize = 400 static focusEventName = { begin: "blueprint-focus", end: "blueprint-unfocus", } static fontSize = css`12.5px` static gridAxisLineColor = css`black` static gridExpandThreshold = 0.25 // remaining size factor threshold to cause an expansion event static gridLineColor = css`#353535` static gridLineWidth = 1 // px static gridSet = 8 static gridSetLineColor = css`#161616` static gridShrinkThreshold = 4 // exceding size factor threshold to cause a shrink event static gridSize = 16 // px static hexColorRegex = /^\s*#(?[0-9a-fA-F]{2})(?[0-9a-fA-F]{2})(?[0-9a-fA-F]{2})([0-9a-fA-F]{2})?|#(?[0-9a-fA-F])(?[0-9a-fA-F])(?[0-9a-fA-F])\s*$/ static keysSeparator = /[\.\(\)]/ static knotOffset = [-26, -16] 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](?![a-z]+_)|[0-9])" // ("ALPHABravo", "ALPHA2", "BTTask_") => ("ALPHA Bravo", "ALPHA 2", "BTTask") + "|(?<=[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 * @param {Number} c2 */ static linkRightSVGPath = (start, c1, c2) => { let end = 100 - start return `M ${start} 0 C ${c1.toFixed(3)} 0, ${c2.toFixed(3)} 0, 50 50 S ${(end - c1 + start).toFixed(3)} 100, ${end.toFixed(3)} 100` } static maxZoom = 7 static minZoom = -12 static mouseWheelFactor = 0.2 static nodeDragGeneralEventName = "ueb-node-drag-general" static nodeDragEventName = "ueb-node-drag" static nodeName = (name, counter) => `${name}_${counter}` static nodeRadius = 8 // px static nodeReflowEventName = "ueb-node-reflow" static nodeType = { addDelegate: "/Script/BlueprintGraph.K2Node_AddDelegate", callArrayFunction: "/Script/BlueprintGraph.K2Node_CallArrayFunction", callFunction: "/Script/BlueprintGraph.K2Node_CallFunction", comment: "/Script/UnrealEd.EdGraphNode_Comment", commutativeAssociativeBinaryOperator: "/Script/BlueprintGraph.K2Node_CommutativeAssociativeBinaryOperator", componentBoundEvent: "/Script/BlueprintGraph.K2Node_ComponentBoundEvent", createDelegate: "/Script/BlueprintGraph.K2Node_CreateDelegate", customEvent: "/Script/BlueprintGraph.K2Node_CustomEvent", doN: "/Engine/EditorBlueprintResources/StandardMacros.StandardMacros:Do N", doOnce: "/Engine/EditorBlueprintResources/StandardMacros.StandardMacros:DoOnce", dynamicCast: "/Script/BlueprintGraph.K2Node_DynamicCast", enum: "/Script/CoreUObject.Enum", enumLiteral: "/Script/BlueprintGraph.K2Node_EnumLiteral", event: "/Script/BlueprintGraph.K2Node_Event", executionSequence: "/Script/BlueprintGraph.K2Node_ExecutionSequence", forEachElementInEnum: "/Script/BlueprintGraph.K2Node_ForEachElementInEnum", forEachLoop: "/Engine/EditorBlueprintResources/StandardMacros.StandardMacros:ForEachLoop", forEachLoopWithBreak: "/Engine/EditorBlueprintResources/StandardMacros.StandardMacros:ForEachLoopWithBreak", forLoop: "/Engine/EditorBlueprintResources/StandardMacros.StandardMacros:ForLoop", forLoopWithBreak: "/Engine/EditorBlueprintResources/StandardMacros.StandardMacros:ForLoopWithBreak", functionEntry: "/Script/BlueprintGraph.K2Node_FunctionEntry", getInputAxisKeyValue: "/Script/BlueprintGraph.K2Node_GetInputAxisKeyValue", ifThenElse: "/Script/BlueprintGraph.K2Node_IfThenElse", inputAxisKeyEvent: "/Script/BlueprintGraph.K2Node_InputAxisKeyEvent", inputDebugKey: "/Script/InputBlueprintNodes.K2Node_InputDebugKey", inputKey: "/Script/BlueprintGraph.K2Node_InputKey", inputVectorAxisEvent: "/Script/BlueprintGraph.K2Node_InputVectorAxisEvent", isValid: "/Engine/EditorBlueprintResources/StandardMacros.StandardMacros:IsValid", knot: "/Script/BlueprintGraph.K2Node_Knot", macro: "/Script/BlueprintGraph.K2Node_MacroInstance", makeArray: "/Script/BlueprintGraph.K2Node_MakeArray", makeMap: "/Script/BlueprintGraph.K2Node_MakeMap", makeSet: "/Script/BlueprintGraph.K2Node_MakeSet", multiGate: "/Script/BlueprintGraph.K2Node_MultiGate", pawn: "/Script/Engine.Pawn", promotableOperator: "/Script/BlueprintGraph.K2Node_PromotableOperator", reverseForEachLoop: "/Engine/EditorBlueprintResources/StandardMacros.StandardMacros:ReverseForEachLoop", select: "/Script/BlueprintGraph.K2Node_Select", spawnActorFromClass: "/Script/BlueprintGraph.K2Node_SpawnActorFromClass", switchEnum: "/Script/BlueprintGraph.K2Node_SwitchEnum", userDefinedEnum: "/Script/Engine.UserDefinedEnum", variableGet: "/Script/BlueprintGraph.K2Node_VariableGet", variableSet: "/Script/BlueprintGraph.K2Node_VariableSet", whileLoop: "/Engine/EditorBlueprintResources/StandardMacros.StandardMacros:WhileLoop", } static pinColor = { "/Script/CoreUObject.Rotator": css`157, 177, 251`, "/Script/CoreUObject.Transform": css`227, 103, 0`, "/Script/CoreUObject.Vector": css`251, 198, 34`, "bool": css`147, 0, 0`, "byte": css`0, 109, 99`, "class": css`88, 0, 186`, "default": css`255, 255, 255`, "delegate": css`255, 56, 56`, "enum": css`0, 109, 99`, "exec": css`240, 240, 240`, "int": css`31, 224, 172`, "int64": css`169, 223, 172`, "interface": css`238, 252, 168`, "name": css`201, 128, 251`, "object": css`0, 167, 240`, "real": css`54, 208, 0`, "string": css`251, 0, 209`, "struct": css`0, 88, 201`, "text": css`226, 121, 167`, "wildcard": css`128, 120, 120`, } static pinInputWrapWidth = 134 // px static removeEventName = "ueb-element-delete" static scale = { [-12]: 0.133333, [-11]: 0.166666, [-10]: 0.2, [-9]: 0.233333, [-8]: 0.266666, [-7]: 0.3, [-6]: 0.333333, [-5]: 0.375, [-4]: 0.5, [-3]: 0.675, [-2]: 0.75, [-1]: 0.875, 0: 1, 1: 1.25, 2: 1.375, 3: 1.5, 4: 1.675, 5: 1.75, 6: 1.875, 7: 2, } static selectAllKeyboardKey = "(bCtrl=True,Key=A)" static smoothScrollTime = 1000 // ms static stringEscapedCharacters = /['"\\]/g static trackingMouseEventName = { begin: "ueb-tracking-mouse-begin", end: "ueb-tracking-mouse-end", } static windowApplyEventName = "ueb-window-apply" static windowApplyButtonText = "OK" static windowCancelEventName = "ueb-window-cancel" static windowCancelButtonText = "Cancel" static windowCloseEventName = "ueb-window-close" static ModifierKeys = [ "Ctrl", "Shift", "Alt", "Meta", ] static Keys = { /* UE name: JS name */ "Backspace": "Backspace", "Tab": "Tab", "LeftControl": "ControlLeft", "RightControl": "ControlRight", "LeftShift": "ShiftLeft", "RightShift": "ShiftRight", "LeftAlt": "AltLeft", "RightAlt": "AltRight", "Enter": "Enter", "Pause": "Pause", "CapsLock": "CapsLock", "Escape": "Escape", "Space": "Space", "PageUp": "PageUp", "PageDown": "PageDown", "End": "End", "Home": "Home", "ArrowLeft": "Left", "ArrowUp": "Up", "ArrowRight": "Right", "ArrowDown": "Down", "PrintScreen": "PrintScreen", "Insert": "Insert", "Delete": "Delete", "Zero": "Digit0", "One": "Digit1", "Two": "Digit2", "Three": "Digit3", "Four": "Digit4", "Five": "Digit5", "Six": "Digit6", "Seven": "Digit7", "Eight": "Digit8", "Nine": "Digit9", "A": "KeyA", "B": "KeyB", "C": "KeyC", "D": "KeyD", "E": "KeyE", "F": "KeyF", "G": "KeyG", "H": "KeyH", "I": "KeyI", "K": "KeyK", "L": "KeyL", "M": "KeyM", "N": "KeyN", "O": "KeyO", "P": "KeyP", "Q": "KeyQ", "R": "KeyR", "S": "KeyS", "T": "KeyT", "U": "KeyU", "V": "KeyV", "W": "KeyW", "X": "KeyX", "Y": "KeyY", "Z": "KeyZ", "NumPadZero": "Numpad0", "NumPadOne": "Numpad1", "NumPadTwo": "Numpad2", "NumPadThree": "Numpad3", "NumPadFour": "Numpad4", "NumPadFive": "Numpad5", "NumPadSix": "Numpad6", "NumPadSeven": "Numpad7", "NumPadEight": "Numpad8", "NumPadNine": "Numpad9", "Multiply": "NumpadMultiply", "Add": "NumpadAdd", "Subtract": "NumpadSubtract", "Decimal": "NumpadDecimal", "Divide": "NumpadDivide", "F1": "F1", "F2": "F2", "F3": "F3", "F4": "F4", "F5": "F5", "F6": "F6", "F7": "F7", "F8": "F8", "F9": "F9", "F10": "F10", "F11": "F11", "F12": "F12", "NumLock": "NumLock", "ScrollLock": "ScrollLock", } }