mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-22 02:06:03 +08:00
[ue] Temporary (disabled) hack to get atlas and skeleton assets to display in content browsers. This doesn't work, as the UE editor thinks the assets are cooked. It also only loads assets that are referenced. As soon as the references no longer exist, the assets are unloaded. See #2368.
This commit is contained in:
parent
c2425dbdde
commit
65d68ed45f
@ -52,24 +52,21 @@ void USpineAtlasAsset::PostInitProperties() {
|
||||
Super::PostInitProperties();
|
||||
}
|
||||
|
||||
void USpineAtlasAsset::GetAssetRegistryTags(TArray<FAssetRegistryTag> &OutTags) const {
|
||||
Super::GetAssetRegistryTags(OutTags);
|
||||
}
|
||||
|
||||
void USpineAtlasAsset::Serialize(FArchive &Ar) {
|
||||
Super::Serialize(Ar);
|
||||
if (Ar.IsLoading() && Ar.UE4Ver() < VER_UE4_ASSET_IMPORT_DATA_AS_JSON && !importData)
|
||||
importData = NewObject<UAssetImportData>(this, TEXT("AssetImportData"));
|
||||
}
|
||||
|
||||
FPrimaryAssetId USpineAtlasAsset::GetPrimaryAssetId() const {
|
||||
return FPrimaryAssetId("spine-atlas", GetFName());
|
||||
}
|
||||
|
||||
void USpineAtlasAsset::PostLoadAssetRegistryTags(const FAssetData& InAssetData,
|
||||
TArray<FAssetRegistryTag>& OutTagsAndValuesToUpdate) const
|
||||
{
|
||||
UObject::PostLoadAssetRegistryTags(InAssetData, OutTagsAndValuesToUpdate);
|
||||
TArray<FAssetRegistryTag>& OutTagsAndValuesToUpdate) const {
|
||||
// FIXME: this is a massive hack. It will set the PackageFlags of the FAssetData
|
||||
// in the AssetRegistry to PKG_FilterEditorOnly so the content browser displays it.
|
||||
// This is necessary in UE 5.3 due to a regression in ContentBrowserAssetDataCore::IsPrimaryAsset
|
||||
// See https://github.com/EsotericSoftware/spine-runtimes/issues/2368
|
||||
FAssetData& MutableAssetData = const_cast<FAssetData&>(InAssetData);
|
||||
// MutableAssetData.PackageFlags = EPackageFlags::PKG_FilterEditorOnly;
|
||||
UObject::PostLoadAssetRegistryTags(MutableAssetData, OutTagsAndValuesToUpdate);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -80,6 +80,18 @@ void USpineSkeletonDataAsset::Serialize(FArchive &Ar) {
|
||||
LoadInfo();
|
||||
}
|
||||
|
||||
|
||||
void USpineSkeletonDataAsset::PostLoadAssetRegistryTags(const FAssetData& InAssetData,
|
||||
// FIXME: this is a massive hack. It will set the PackageFlags of the FAssetData
|
||||
// in the AssetRegistry to PKG_FilterEditorOnly so the content browser displays it.
|
||||
// This is necessary in UE 5.3 due to a regression in ContentBrowserAssetDataCore::IsPrimaryAsset
|
||||
// See https://github.com/EsotericSoftware/spine-runtimes/issues/2368
|
||||
TArray<FAssetRegistryTag>& OutTagsAndValuesToUpdate) const {
|
||||
FAssetData& MutableAssetData = const_cast<FAssetData&>(InAssetData);
|
||||
// MutableAssetData.PackageFlags = EPackageFlags::PKG_FilterEditorOnly;
|
||||
UObject::PostLoadAssetRegistryTags(MutableAssetData, OutTagsAndValuesToUpdate);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void USpineSkeletonDataAsset::ClearNativeData() {
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
// clang-format on
|
||||
|
||||
UCLASS(BlueprintType, ClassGroup = (Spine))
|
||||
class SPINEPLUGIN_API USpineAtlasAsset : public UObject {
|
||||
class SPINEPLUGIN_API USpineAtlasAsset : public UPrimaryDataAsset {
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
@ -70,9 +70,7 @@ protected:
|
||||
class UAssetImportData *importData;
|
||||
|
||||
virtual void PostInitProperties() override;
|
||||
virtual void GetAssetRegistryTags(TArray<FAssetRegistryTag> &OutTags) const override;
|
||||
virtual void Serialize(FArchive &Ar) override;
|
||||
virtual FPrimaryAssetId GetPrimaryAssetId() const override;
|
||||
virtual void PostLoadAssetRegistryTags(const FAssetData& InAssetData, TArray<FAssetRegistryTag>& OutTagsAndValuesToUpdate) const override;
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -116,6 +116,7 @@ protected:
|
||||
virtual void PostInitProperties() override;
|
||||
virtual void GetAssetRegistryTags(TArray<FAssetRegistryTag> &OutTags) const override;
|
||||
virtual void Serialize(FArchive &Ar) override;
|
||||
virtual void PostLoadAssetRegistryTags(const FAssetData& InAssetData, TArray<FAssetRegistryTag>& OutTagsAndValuesToUpdate) const override;
|
||||
#endif
|
||||
|
||||
void LoadInfo();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user