mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 17:56:04 +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();
|
Super::PostInitProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
void USpineAtlasAsset::GetAssetRegistryTags(TArray<FAssetRegistryTag> &OutTags) const {
|
|
||||||
Super::GetAssetRegistryTags(OutTags);
|
|
||||||
}
|
|
||||||
|
|
||||||
void USpineAtlasAsset::Serialize(FArchive &Ar) {
|
void USpineAtlasAsset::Serialize(FArchive &Ar) {
|
||||||
Super::Serialize(Ar);
|
Super::Serialize(Ar);
|
||||||
if (Ar.IsLoading() && Ar.UE4Ver() < VER_UE4_ASSET_IMPORT_DATA_AS_JSON && !importData)
|
if (Ar.IsLoading() && Ar.UE4Ver() < VER_UE4_ASSET_IMPORT_DATA_AS_JSON && !importData)
|
||||||
importData = NewObject<UAssetImportData>(this, TEXT("AssetImportData"));
|
importData = NewObject<UAssetImportData>(this, TEXT("AssetImportData"));
|
||||||
}
|
}
|
||||||
|
|
||||||
FPrimaryAssetId USpineAtlasAsset::GetPrimaryAssetId() const {
|
|
||||||
return FPrimaryAssetId("spine-atlas", GetFName());
|
|
||||||
}
|
|
||||||
|
|
||||||
void USpineAtlasAsset::PostLoadAssetRegistryTags(const FAssetData& InAssetData,
|
void USpineAtlasAsset::PostLoadAssetRegistryTags(const FAssetData& InAssetData,
|
||||||
TArray<FAssetRegistryTag>& OutTagsAndValuesToUpdate) const
|
TArray<FAssetRegistryTag>& OutTagsAndValuesToUpdate) const {
|
||||||
{
|
// FIXME: this is a massive hack. It will set the PackageFlags of the FAssetData
|
||||||
UObject::PostLoadAssetRegistryTags(InAssetData, OutTagsAndValuesToUpdate);
|
// 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
|
#endif
|
||||||
|
|||||||
@ -80,6 +80,18 @@ void USpineSkeletonDataAsset::Serialize(FArchive &Ar) {
|
|||||||
LoadInfo();
|
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
|
#endif
|
||||||
|
|
||||||
void USpineSkeletonDataAsset::ClearNativeData() {
|
void USpineSkeletonDataAsset::ClearNativeData() {
|
||||||
|
|||||||
@ -36,7 +36,7 @@
|
|||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
UCLASS(BlueprintType, ClassGroup = (Spine))
|
UCLASS(BlueprintType, ClassGroup = (Spine))
|
||||||
class SPINEPLUGIN_API USpineAtlasAsset : public UObject {
|
class SPINEPLUGIN_API USpineAtlasAsset : public UPrimaryDataAsset {
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -70,9 +70,7 @@ protected:
|
|||||||
class UAssetImportData *importData;
|
class UAssetImportData *importData;
|
||||||
|
|
||||||
virtual void PostInitProperties() override;
|
virtual void PostInitProperties() override;
|
||||||
virtual void GetAssetRegistryTags(TArray<FAssetRegistryTag> &OutTags) const override;
|
|
||||||
virtual void Serialize(FArchive &Ar) override;
|
virtual void Serialize(FArchive &Ar) override;
|
||||||
virtual FPrimaryAssetId GetPrimaryAssetId() const override;
|
|
||||||
virtual void PostLoadAssetRegistryTags(const FAssetData& InAssetData, TArray<FAssetRegistryTag>& OutTagsAndValuesToUpdate) const override;
|
virtual void PostLoadAssetRegistryTags(const FAssetData& InAssetData, TArray<FAssetRegistryTag>& OutTagsAndValuesToUpdate) const override;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|||||||
@ -116,6 +116,7 @@ protected:
|
|||||||
virtual void PostInitProperties() override;
|
virtual void PostInitProperties() override;
|
||||||
virtual void GetAssetRegistryTags(TArray<FAssetRegistryTag> &OutTags) const override;
|
virtual void GetAssetRegistryTags(TArray<FAssetRegistryTag> &OutTags) const override;
|
||||||
virtual void Serialize(FArchive &Ar) override;
|
virtual void Serialize(FArchive &Ar) override;
|
||||||
|
virtual void PostLoadAssetRegistryTags(const FAssetData& InAssetData, TArray<FAssetRegistryTag>& OutTagsAndValuesToUpdate) const override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void LoadInfo();
|
void LoadInfo();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user