More refinement of Wing server

This commit is contained in:
2026-03-19 12:01:38 -04:00
parent a9258f3a86
commit 9812a4a413
15 changed files with 60 additions and 155 deletions

View File

@@ -1,4 +1,5 @@
#include "WingGraphExport.h"
#include "WingProperty.h"
#include "WingTypes.h"
#include "WingUtils.h"
#include "Engine/Blueprint.h"
@@ -263,19 +264,19 @@ void WingGraphExport::EmitNode(UEdGraphNode* Node)
}
}
void WingGraphExport::EmitMaterialProperty(UMaterialExpression* Expression, FProperty* Prop, FStringBuilderBase& Out)
void WingGraphExport::EmitMaterialProperty(const FWingProperty& WP, FStringBuilderBase& Out)
{
FString ValueStr = WingUtils::GetPropertyValueText(Expression, Prop);
FString ValueStr = WP.GetText();
ValueStr.ReplaceInline(TEXT("\r\n"), TEXT(" "));
ValueStr.ReplaceInline(TEXT("\n"), TEXT(" "));
if (ValueStr.Len() > 80)
ValueStr = ValueStr.Left(80) + TEXT("...");
bool bEditable = !Prop->HasAnyPropertyFlags(CPF_EditConst);
bool bEditable = !WP->HasAnyPropertyFlags(CPF_EditConst);
Out.Appendf(TEXT(" %s %s %s = %s\n"),
bEditable ? TEXT("mxeditable") : TEXT("mxreadonly"),
*UWingTypes::TypeToText(Prop),
*WingUtils::FormatName(Prop),
*UWingTypes::TypeToText(WP.Prop),
*WingUtils::FormatName(WP.Prop),
*ValueStr);
}
@@ -286,13 +287,13 @@ void WingGraphExport::EmitMaterialProperties(UEdGraphNode* Node, FStringBuilderB
UMaterialExpression* Expression = MatNode->MaterialExpression;
FString PrimaryCategory = Expression->GetClass()->GetName();
TArray<FProperty*> Props = WingUtils::SearchProperties(Expression, FString(), CPF_Edit, false);
TArray<FWingProperty> Props = FWingProperty::GetAll(Expression, CPF_Edit);
for (FProperty* Prop : Props)
for (const FWingProperty& WP : Props)
{
FString Category = Prop->HasMetaData(TEXT("Category")) ? Prop->GetMetaData(TEXT("Category")) : FString();
FString Category = WP->HasMetaData(TEXT("Category")) ? WP->GetMetaData(TEXT("Category")) : FString();
if ((Category == PrimaryCategory) == bPrimary)
EmitMaterialProperty(Expression, Prop, Out);
EmitMaterialProperty(WP, Out);
}
}