Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/controls/utils/color-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)';
Expand Down
1 change: 1 addition & 0 deletions src/data/pin/pin-category.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export enum PinCategory {
string = "string",
text = "text",
float = "float",
real = "real",
struct = "struct",
class = "class",
bool = "bool",
Expand Down
3 changes: 3 additions & 0 deletions src/data/pin/pin-property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class PinProperty extends CustomProperty {
isConst: boolean;
isWeakPointer: boolean;
isUObjectWrapper: boolean;
serializeAsSinglePrecisionFloat: boolean;

linkedTo: PinLink[];
persistentGUID: string;
Expand All @@ -49,6 +50,8 @@ export class PinProperty extends CustomProperty {

hideName: boolean;
showInHead: boolean;
subPins: string;
parentPin: string;

constructor(nodeName: string) {
super();
Expand Down
1 change: 1 addition & 0 deletions src/parser/node-parsers/call-function-node.parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 3 additions & 1 deletion src/parser/node-parsers/generic-node.parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export class GenericNodeParser extends NodeParser {
[key: string]: () => CustomPropertyParser
} = {
"Pin": () => new PinPropertyParser(),
"UserDefinedPin": () => new PinPropertyParser(),
}

constructor() {
Expand Down Expand Up @@ -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;
}
}
Expand Down
55 changes: 46 additions & 9 deletions src/parser/pin-property.parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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); },
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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, '');
Expand Down Expand Up @@ -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) };
Expand Down Expand Up @@ -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) };
}
}
Expand Down Expand Up @@ -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;
}
Expand Down