Skip to content

Commit

Permalink
[Unreal] Bug:解决错误的将父类的hideCategories赋值给蓝图以及错误的覆盖了ts收集到的hideCategories…
Browse files Browse the repository at this point in the history
…元数据 (#1723)

* [Unreal] Bug:解决错误的将父类的hideCategories赋值给蓝图以及错误的覆盖了ts收集到的hideCategories元数据

* 格式化文件
  • Loading branch information
YBYCS authored May 17, 2024
1 parent 950d895 commit af516e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
17 changes: 7 additions & 10 deletions unreal/Puerts/Source/PuertsEditor/Private/PEBlueprintMetaData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,20 @@ void UPEClassMetaData::MergeClassCategories(UClass* InParentClass)
return;
}

TArray<FString> ParentHideCategories = GetClassMetaDataValues(InParentClass, NAME_HideCategories);
TArray<FString> ParentShowCategories = GetClassMetaDataValues(InParentClass, NAME_ShowCategories);
TArray<FString> ParentHideFunctions = GetClassMetaDataValues(InParentClass, NAME_HideFunctions);
TArray<FString> ParentAutoExpandCategories = GetClassMetaDataValues(InParentClass, NAME_AutoExpandCategories);
TArray<FString> ParentAutoCollapseCategories = GetClassMetaDataValues(InParentClass, NAME_AutoCollapseCategories);

// add parent categories
HideCategories.Append(MoveTemp(ParentHideCategories));
ShowSubCategories.Append(MoveTemp(ParentShowCategories));
HideFunctions.Append(MoveTemp(ParentHideFunctions));
// If metadata is collected from ts
FString* ExistingValue = MetaData.Find(NAME_HideCategories);
if (ExistingValue)
{
ExistingValue->ParseIntoArray(HideCategories, TEXT(" "), true);
}

// for show categories
for (const FString& Value : ShowCategories)
Expand Down Expand Up @@ -204,10 +208,6 @@ void UPEClassMetaData::MergeClassCategories(UClass* InParentClass)
{
MetaData.Add(NAME_AutoExpandCategories, FString::Join(AutoExpandCategories, TEXT(" ")));
}
if (HideCategories.Num() > 0)
{
MetaData.Add(NAME_HideCategories, FString::Join(HideCategories, TEXT(" ")));
}
if (ShowSubCategories.Num() > 0)
{
MetaData.Add(NAME_ShowCategories, FString::Join(ShowSubCategories, TEXT(" ")));
Expand Down Expand Up @@ -330,10 +330,7 @@ void UPEClassMetaData::SyncClassToBlueprint(UClass* InClass, UBlueprint* InBluep
InClass->HasMetaData(TEXT("DisplayName")) ? InClass->GetMetaData(TEXT("DisplayName")) : FString{};
InBlueprint->BlueprintType = (InClass->ClassFlags & CLASS_Const) ? BPTYPE_Const : BPTYPE_Normal;
InBlueprint->BlueprintCategory = InClass->HasMetaData(TEXT("Category")) ? InClass->GetMetaData(TEXT("Category")) : FString{};
if (InClass->HasMetaData(TEXT("HideCategories")))
{
InClass->GetMetaData(TEXT("HideCategories")).ParseIntoArray(InBlueprint->HideCategories, TEXT(" "), true);
}
InBlueprint->HideCategories = HideCategories;
}

void UPEClassMetaData::SetAndValidateWithinClass(UClass* InClass)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ class PUERTSEDITOR_API UPEClassMetaData : public UObject
* @param InClass
* @param InBlueprint
*/
static void SyncClassToBlueprint(UClass* InClass, UBlueprint* InBlueprint);
void SyncClassToBlueprint(UClass* InClass, UBlueprint* InBlueprint);

private:
/**
Expand Down

0 comments on commit af516e8

Please sign in to comment.