vault backup: 2024-10-12 17:19:45

This commit is contained in:
2024-10-12 17:19:46 +08:00
parent ff94ddca61
commit 244c0c52f6
960 changed files with 31348 additions and 10 deletions

View File

@@ -0,0 +1,55 @@
# AssetRegistrySearchable
- **功能描述:** 标记该属性可以作为AssetRegistry的Tag和Value值来进行资产的过滤搜索
- **元数据类型:** bool
- **引擎模块:** Asset
- **作用机制:** 在PropertyFlags中加入[CPF_AssetRegistrySearchable](../../../../Flags/EPropertyFlags/CPF_AssetRegistrySearchable.md)在Meta中加入[RequiredAssetDataTags](../../../../Meta/Asset/RequiredAssetDataTags/RequiredAssetDataTags.md)、[DisallowedAssetDataTags](../../../../Meta/Asset/DisallowedAssetDataTags.md)
- **常用程度:** ★★★
不能用在结构属性上。
子类也可以重载GetAssetRegistryTags以提供自定义的Tag。
## 测试代码:
```cpp
UCLASS(Blueprintable, BlueprintType)
class INSIDER_API UMyProperty_AssetRegistrySearchable :public UDataAsset
{
public:
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, AssetRegistrySearchable, Category = DataRegistry)
FString MyIdForSearch;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 OtherValue = 123;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = DataRegistry)
FString MyOtherIdForSearch;
public:
virtual void GetAssetRegistryTags(FAssetRegistryTagsContext Context) const override
{
//called on CDO and instances
Super::GetAssetRegistryTags(Context);
Context.AddTag(FAssetRegistryTag(TEXT("MyOtherId"),MyOtherIdForSearch, UObject::FAssetRegistryTag::TT_Alphabetical));
}
};
```
## 测试结果:
在EditorUtilityWidget中测试可见ListAssetByTagValue都可以搜索找到该Asset。
![Untitled](Untitled.png)
测试的蓝图代码也可用IAssetRegistry::Get()->GetAssetsByTagValues(tagValues,outAssets);来进行搜索不过要注意搜索的时机要在AssetRegistry加载之后AssetRegistry如果是Runtime要记得序列化到磁盘
```cpp
//DefaultEngine.ini
[AssetRegistry]
bSerializeAssetRegistry=true
```
## 原理:
可查看GetAssetRegistryTags的函数的实现和调用。在UObject::GetAssetRegistryTags中调用使用把该属性的值作为AssetData的Tag供给AssetRegistry

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 KiB

View File

@@ -0,0 +1,6 @@
# Localized
- **功能描述:** 此属性的值将拥有一个定义的本地化值。多用于字符串。暗示为 ReadOnly。该值有一个本地化值。最常标记在string上
- **元数据类型:** bool
- **引擎模块:** Behavior
- **限制类型:** FString