From 821277c08899c14f0d7815150d86c58c48925f66 Mon Sep 17 00:00:00 2001 From: Harrison Hough Date: Fri, 18 Oct 2024 08:50:28 +0300 Subject: [PATCH] fix: updated preview method to load character asset correctly (#16) - fixed an issue that caused assets of the same type to stack after switching asset types. EG multiple pants being equipped --- CHANGELOG.md | 6 ++++++ .../Blueprints/BP_SampleRpmActor.uasset | Bin 38771 -> 39244 bytes .../Samples/BasicLoader/RpmBasicLoader.umap | Bin 138177 -> 138177 bytes Source/RpmNextGen/Private/RpmActor.cpp | 2 ++ .../RpmNextGen/Private/RpmLoaderComponent.cpp | 8 ++++---- Source/RpmNextGen/Public/RpmLoaderComponent.h | 4 ++-- 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27edb30..e7ab79c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [0.2.1] 2024-10-18 + +### Fixed + +- Fixed issue where previously selected assets were not being removed + ## [0.2.0] 2024-10-05 ### Added diff --git a/Content/Samples/BasicLoader/Blueprints/BP_SampleRpmActor.uasset b/Content/Samples/BasicLoader/Blueprints/BP_SampleRpmActor.uasset index c4b2c179e633801d066050bc3c5c487c3b7f4784..bbe76f1fd27373bf36e9409b59ad5d9dc43f426b 100644 GIT binary patch delta 1896 zcmaJ?drVVT7(eGyuvV;98)>mXf$~(KMS6Q%9&2wOpn^DT+d2wdf)W6K9-@ zPd>*UD$`8=m`>fiCQFtvh%Va_oo-q7$~LEyx%dau#W-P6pav&_Ch+PDAr`Nn&*2+VR?;TzaSW8biO6wd1V^86gYpcmgLD}$%U@L)fEHPj?4w(s4-4J0RWUjx;wuA= z_3Qni@|N0qe?6)Cbk{9pMXv<4Z~fs6{H0hd?3i+J3e&d|D!Z~_QJkGJ@WIYGsOjLl zI0Mt}1Jjm#$klMn@R+KG(;5Sl?+-^rQw7;tHFJN|byaJCrj2sw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Pm7L4&RVx2^#Jl`ab~I4v+XE;BPO zF*3JKFafH#m%-=(GneA(0o|9p7Xk>k{OAF%0hhn)0mBfFFsF4gGyPAR{FML0Bj&@G Rk#hk!lb}=*x7_RjDestroyComponent(); + ComponentToRemove = nullptr; } } LoadedMeshComponentsByAssetType.Remove(AssetType); @@ -132,6 +133,7 @@ void ARpmActor::RemoveAllMeshes() if (ComponentToRemove) { ComponentToRemove->DestroyComponent(); + ComponentToRemove = nullptr; } } } diff --git a/Source/RpmNextGen/Private/RpmLoaderComponent.cpp b/Source/RpmNextGen/Private/RpmLoaderComponent.cpp index 4d6ac76..9669c48 100644 --- a/Source/RpmNextGen/Private/RpmLoaderComponent.cpp +++ b/Source/RpmNextGen/Private/RpmLoaderComponent.cpp @@ -76,12 +76,12 @@ void URpmLoaderComponent::LoadGltfRuntimeAssetFromCache(const FAsset& Asset) { UE_LOG(LogReadyPlayerMe, Error, TEXT("Failed to load gltf asset")); } - OnNewAssetLoaded.Broadcast(Asset, GltfRuntimeAsset); + OnAssetLoaded.Broadcast(Asset, GltfRuntimeAsset); return; } } UE_LOG(LogReadyPlayerMe, Error, TEXT("Failed to load gltf asset from cache")); - OnNewAssetLoaded.Broadcast(Asset, nullptr); + OnAssetLoaded.Broadcast(Asset, nullptr); } void URpmLoaderComponent::LoadCharacterAssetsFromCache(TMap AssetMap) @@ -137,7 +137,7 @@ void URpmLoaderComponent::LoadAssetPreview(FAsset AssetData, bool bUseCache) PreviewRequest.Params.Assets = ParamAssets; const FString& Url = CharacterApi->GeneratePreviewUrl(PreviewRequest); - FileApi->LoadAssetFileFromUrl(Url, AssetData); + FileApi->LoadFileFromUrl(Url); } void URpmLoaderComponent::HandleAssetLoaded(const TArray* Data, const FAsset& Asset) @@ -152,7 +152,7 @@ void URpmLoaderComponent::HandleAssetLoaded(const TArray* Data, c { UE_LOG(LogReadyPlayerMe, Error, TEXT("Failed to load gltf asset")); } - OnNewAssetLoaded.Broadcast(Asset, GltfRuntimeAsset); + OnAssetLoaded.Broadcast(Asset, GltfRuntimeAsset); } void URpmLoaderComponent::HandleCharacterAssetLoaded(const TArray* Data, const FString& FileName) diff --git a/Source/RpmNextGen/Public/RpmLoaderComponent.h b/Source/RpmNextGen/Public/RpmLoaderComponent.h index 7a3fac2..167e394 100644 --- a/Source/RpmNextGen/Public/RpmLoaderComponent.h +++ b/Source/RpmNextGen/Public/RpmLoaderComponent.h @@ -22,7 +22,7 @@ DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnCharacterCreated, FRpmCharacterDa DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnCharacterUpdated, FRpmCharacterData, CharacterData); DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnCharacterFound, FRpmCharacterData, CharacterData); DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnCharacterAssetLoaded, const FRpmCharacterData&, CharacterData, UglTFRuntimeAsset*, GltfRuntimeAsset); -DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnNewAssetLoaded, const FAsset&, Asset, UglTFRuntimeAsset*, GltfRuntimeAsset ); +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnAssetLoaded, const FAsset&, Asset, UglTFRuntimeAsset*, GltfRuntimeAsset ); UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) ) class RPMNEXTGEN_API URpmLoaderComponent : public UActorComponent @@ -33,7 +33,7 @@ class RPMNEXTGEN_API URpmLoaderComponent : public UActorComponent UPROPERTY(BlueprintAssignable, Category = "Ready Player Me" ) FOnCharacterAssetLoaded OnCharacterAssetLoaded; UPROPERTY(BlueprintAssignable, Category = "Ready Player Me" ) - FOnNewAssetLoaded OnNewAssetLoaded; + FOnAssetLoaded OnAssetLoaded; UPROPERTY(BlueprintAssignable, Category = "Ready Player Me" ) FOnCharacterCreated OnCharacterCreated; UPROPERTY(BlueprintAssignable, Category = "Ready Player Me" )