diff --git a/src/controls/utils/color-utils.ts b/src/controls/utils/color-utils.ts index 11d5d14..39e87b0 100644 --- a/src/controls/utils/color-utils.ts +++ b/src/controls/utils/color-utils.ts @@ -13,7 +13,7 @@ export enum StructClass { export class ColorUtils { public static getPinColor(pin: PinProperty): string { - return this.getPinColorByCategory(pin.category, pin.subCategoryObject.class); + return this.getPinColorByCategory(pin.category, pin.subCategoryObject?.class); } public static getPinColorByCategory(category: PinCategory, subCategoryObject?: string): string { @@ -23,6 +23,7 @@ export class ColorUtils { case PinCategory.bool: return 'rgb(146, 1, 1)'; case PinCategory.float: + case PinCategory.real: return 'rgb(158, 250, 68)'; case PinCategory.int: return 'rgb(30, 226, 174)'; diff --git a/src/data/pin/pin-category.ts b/src/data/pin/pin-category.ts index 73e8cc3..d8bd101 100644 --- a/src/data/pin/pin-category.ts +++ b/src/data/pin/pin-category.ts @@ -8,6 +8,7 @@ export enum PinCategory { string = "string", text = "text", float = "float", + real = "real", struct = "struct", class = "class", bool = "bool", diff --git a/src/data/pin/pin-property.ts b/src/data/pin/pin-property.ts index 7d8058b..77cdbb5 100644 --- a/src/data/pin/pin-property.ts +++ b/src/data/pin/pin-property.ts @@ -27,6 +27,7 @@ export class PinProperty extends CustomProperty { isConst: boolean; isWeakPointer: boolean; isUObjectWrapper: boolean; + serializeAsSinglePrecisionFloat: boolean; linkedTo: PinLink[]; persistentGUID: string; @@ -49,6 +50,8 @@ export class PinProperty extends CustomProperty { hideName: boolean; showInHead: boolean; + subPins: string; + parentPin: string; constructor(nodeName: string) { super(); diff --git a/src/parser/node-parsers/call-function-node.parser.ts b/src/parser/node-parsers/call-function-node.parser.ts index 1e140f3..d0574fe 100644 --- a/src/parser/node-parsers/call-function-node.parser.ts +++ b/src/parser/node-parsers/call-function-node.parser.ts @@ -26,6 +26,7 @@ export class CallFunctionNodeParser extends NodeParser { constructor() { super({ "bIsPureFunc": (node: CallFunctionNode, value: string) => { node.isPureFunc = (value === "True"); }, + "bDefaultsToPureFunc": (node: CallFunctionNode, value: string) => { node.isPureFunc = (value === "True"); }, "bIsConstFunc": (node: CallFunctionNode, value: string) => { node.isConstFunc = (value === "True"); }, "FunctionReference": (node: CallFunctionNode, value: string) => { const parser = new NodeDataReferenceParser(); diff --git a/src/parser/node-parsers/generic-node.parser.ts b/src/parser/node-parsers/generic-node.parser.ts index 49fb07b..0d1784b 100644 --- a/src/parser/node-parsers/generic-node.parser.ts +++ b/src/parser/node-parsers/generic-node.parser.ts @@ -84,6 +84,7 @@ export class GenericNodeParser extends NodeParser { [key: string]: () => CustomPropertyParser } = { "Pin": () => new PinPropertyParser(), + "UserDefinedPin": () => new PinPropertyParser(), } constructor() { @@ -162,7 +163,8 @@ export class GenericNodeParser extends NodeParser { data.node.customProperties.push(property); if (property instanceof PinProperty) { - if ((property as PinProperty).subCategoryObject.class === StructClass.LatentActionInfo) { + const pinProp = property as PinProperty; + if (pinProp.subCategoryObject && pinProp.subCategoryObject.class === StructClass.LatentActionInfo) { data.node.latent = true; } } diff --git a/src/parser/pin-property.parser.ts b/src/parser/pin-property.parser.ts index 22e7f29..9a6418e 100644 --- a/src/parser/pin-property.parser.ts +++ b/src/parser/pin-property.parser.ts @@ -25,7 +25,15 @@ export class PinPropertyParser implements CustomPropertyParser { "PinName": (p: PinProperty, value: string) => { p.name = prettifyText(BlueprintParserUtils.parseString(value)); }, "PinFriendlyName": (p: PinProperty, value: string) => { p.friendlyName = prettifyText(PinPropertyParser.parsePinFriendlyName(value)); }, "PinType.PinCategory": (p: PinProperty, value: string) => { p.category = PinPropertyParser.parsePinCategory(value); }, + "PinType": (p: PinProperty, value: string) => { + // UserDefinedPin format: PinType=(PinCategory="bool") + const categoryMatch = value.match(/PinCategory="([^"]+)"/); + if (categoryMatch) { + p.category = PinPropertyParser.parsePinCategory(`"${categoryMatch[1]}"`); + } + }, "Direction": (p: PinProperty, value: string) => { p.direction = PinPropertyParser.parseDirection(value); }, + "DesiredPinDirection": (p: PinProperty, value: string) => { p.direction = PinPropertyParser.parseDirection(value); }, "PinToolTip": (p: PinProperty, value: string) => { p.toolTip = BlueprintParserUtils.parseString(value); }, "PinType.PinSubCategory": (p: PinProperty, value: string) => { p.subCategory = BlueprintParserUtils.parseString(value); }, "PinType.PinSubCategoryObject": (p: PinProperty, value: string) => { p.subCategoryObject = PinPropertyParser.parseSubCategoryObject(value); }, @@ -72,6 +80,15 @@ export class PinPropertyParser implements CustomPropertyParser { // console.log(`Found interesting attribute 'PinType.PinSubCategoryMemberReference' for which a value other than '()' was set. PinType.PinSubCategoryMemberReference='${value}' [pin-name: ${p.name}]`); // } }, + "PinType.bSerializeAsSinglePrecisionFloat": (p: PinProperty, value: string) => { + p.serializeAsSinglePrecisionFloat = value.toLowerCase() === "true"; + }, + "SubPins": (p: PinProperty, value: string) => { + p.subPins = value; + }, + "ParentPin": (p: PinProperty, value: string) => { + p.parentPin = BlueprintParserUtils.parseString(value); + }, } parse(propertyData: string, nodeName: string): PinProperty { @@ -206,6 +223,11 @@ export class PinPropertyParser implements CustomPropertyParser { key = lastValue; args[key] = value; } + } else if (prop.startsWith("INVTEXT")) { + const invtextMatch = prop.match(/INVTEXT\("([^"]*)"\)/); + if (invtextMatch && (index + offset) % 2 == 1) { + args[namingkKey] = invtextMatch[1]; + } } else { if ((index + offset) % 2 == 0) { namingkKey = prop.replace(/"/g, ''); @@ -257,13 +279,16 @@ export class PinPropertyParser implements CustomPropertyParser { switch (p.category) { case PinCategory.float: + case PinCategory.real: return { control: TextBoxControl, data: removeInsignificantTrailingZeros(BlueprintParserUtils.parseString(value)) }; case PinCategory.bool: return { control: CheckBoxControl, data: (BlueprintParserUtils.parseString(value).toLowerCase() === "true") }; case PinCategory.struct: - return this.parseDefaultValueStruct(p.subCategoryObject.class, value); + if (p.subCategoryObject && p.subCategoryObject.class) { + return this.parseDefaultValueStruct(p.subCategoryObject.class, value); + } case PinCategory.byte: - if (p.subCategoryObject.type === "Enum") { + if (p.subCategoryObject && p.subCategoryObject.type === "Enum") { return { control: TextBoxControl, data: BlueprintParserUtils.parseEnumValue(p.subCategoryObject.class, value) }; } else { return { control: TextBoxControl, data: BlueprintParserUtils.parseString(value) }; @@ -292,6 +317,16 @@ export class PinPropertyParser implements CustomPropertyParser { color.applyGamma(); return { control: ColorBoxControl, data: color}; default: + if (subCategoryObject.includes('LinearColor')) { + const cParams = this.parseDefaultValueStructCommon(value).map(p => Number(p.value)); + const color = new Color( + (cParams[0] || 0) * 255, + (cParams[1] || 0) * 255, + (cParams[2] || 0) * 255, + cParams[3]); + color.applyGamma(); + return { control: ColorBoxControl, data: color}; + } return { control: StructBoxControl, data: this.parseDefaultValueStructCommon(value) }; } } @@ -356,13 +391,15 @@ export class PinPropertyParser implements CustomPropertyParser { p.defaultValue = " "; p.defaultValueControlClass = TextBoxControl; case PinCategory.struct: - switch (p.subCategoryObject.class) { - case StructClass.VECTOR2D: - p.defaultValue = [ - { key: 'X', value: '0.0' }, - { key: 'Y', value: '0.0' }]; - p.defaultValueControlClass = StructBoxControl; - break; + if (p.subCategoryObject && p.subCategoryObject.class) { + switch (p.subCategoryObject.class) { + case StructClass.VECTOR2D: + p.defaultValue = [ + { key: 'X', value: '0.0' }, + { key: 'Y', value: '0.0' }]; + p.defaultValueControlClass = StructBoxControl; + break; + } } break; }