Started rework of clothing slots and UI
This commit is contained in:
@@ -77,7 +77,7 @@ public:
|
||||
FText Name;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
|
||||
UTexture2D* Icon;
|
||||
TObjectPtr<UTexture2D> Icon;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
|
||||
EClothingSlotType SlotType;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "ClothingItemInstance.h"
|
||||
#include "GameFramework/Character.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "NakedDesire/Player/NakedDesireCharacter.h"
|
||||
#include "NakedDesire/SaveGame/GlobalSaveGameData.h"
|
||||
#include "NakedDesire/SaveGame/ItemSaveRecord.h"
|
||||
#include "NakedDesire/SaveGame/SaveSubsystem.h"
|
||||
@@ -97,6 +98,37 @@ float UClothingManager::GetHeelHeight()
|
||||
return 0;
|
||||
}
|
||||
|
||||
USkeletalMeshComponent* UClothingManager::GetMeshComponent(const EClothingSlotType SlotType) const
|
||||
{
|
||||
const ANakedDesireCharacter* Player = Cast<ANakedDesireCharacter>(GetOwner());
|
||||
if (!Player)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
switch (SlotType)
|
||||
{
|
||||
case EClothingSlotType::Nipples: return Player->NipplesMeshComponent;
|
||||
case EClothingSlotType::Anal: return Player->AnalMeshComponent;
|
||||
case EClothingSlotType::Vagina: return Player->VaginaMeshComponent;
|
||||
case EClothingSlotType::Head: return Player->HeadMeshComponent;
|
||||
case EClothingSlotType::Neck: return Player->NeckMeshComponent;
|
||||
case EClothingSlotType::Face: return Player->FaceMeshComponent;
|
||||
case EClothingSlotType::Eyes: return Player->EyesMeshComponent;
|
||||
case EClothingSlotType::Bodysuit: return Player->BodySuitMeshComponent;
|
||||
case EClothingSlotType::Top: return Player->TopMeshComponent;
|
||||
case EClothingSlotType::Bottom: return Player->BottomMeshComponent;
|
||||
case EClothingSlotType::UnderwearTop: return Player->UnderwearTopMeshComponent;
|
||||
case EClothingSlotType::UnderwearBottom:return Player->UnderwearBottomMeshComponent;
|
||||
case EClothingSlotType::Socks: return Player->SocksMeshComponent;
|
||||
case EClothingSlotType::Footwear: return Player->FootwearMeshComponent;
|
||||
case EClothingSlotType::Outerwear: return Player->OuterwearMeshComponent;
|
||||
case EClothingSlotType::WristRestraint: return Player->WristRestraintMeshComponent;
|
||||
case EClothingSlotType::AnkleRestraint: return Player->AnkleRestraintMeshComponent;
|
||||
case EClothingSlotType::NeckRestraint: return Player->NeckRestraintMeshComponent;
|
||||
default: return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void UClothingManager::PutOnClothing(UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
if (!ClothingItemInstance)
|
||||
@@ -107,19 +139,20 @@ void UClothingManager::PutOnClothing(UClothingItemInstance* ClothingItemInstance
|
||||
FClothingSlotData ClothingSlotData;
|
||||
GetClothingSlotData(ClothingSlotType, ClothingSlotData);
|
||||
|
||||
ClothingSlotData.MeshComponent->SetSkeletalMesh(ClothingItemInstance->GetClothingItem()->SkeletalMesh);
|
||||
USkeletalMeshComponent* MeshComponent = GetMeshComponent(ClothingSlotType);
|
||||
MeshComponent->SetSkeletalMesh(ClothingItemInstance->GetClothingItem()->SkeletalMesh);
|
||||
if (!ClothingItemInstance->GetClothingItem()->Materials.IsEmpty())
|
||||
{
|
||||
for (const TPair<FName, UMaterialInstance*>& Material : ClothingItemInstance->GetClothingItem()->Materials)
|
||||
{
|
||||
ClothingSlotData.MeshComponent->SetMaterialByName(Material.Key, Material.Value);
|
||||
MeshComponent->SetMaterialByName(Material.Key, Material.Value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SetClothingSlotItem(ClothingSlotType, ClothingItemInstance);
|
||||
if (ClothingItemInstance->GetClothingItem()->UseLeaderPose)
|
||||
{
|
||||
ClothingSlotData.MeshComponent->SetLeaderPoseComponent(Cast<ACharacter>(GetOwner())->GetMesh());
|
||||
MeshComponent->SetLeaderPoseComponent(Cast<ACharacter>(GetOwner())->GetMesh());
|
||||
}
|
||||
|
||||
UClothingItem* ClothingItem = ClothingItemInstance->GetClothingItem();
|
||||
@@ -177,13 +210,13 @@ UClothingItemInstance* UClothingManager::RemoveClothing(const EClothingSlotType
|
||||
|
||||
UClothingItemInstance* ClothingItemInstance = ClothingSlotData.ClothingItemInstance;
|
||||
SetClothingSlotItem(ClothingSlotType, nullptr);
|
||||
|
||||
USkeletalMeshComponent* MeshComponent = ClothingSlotData.MeshComponent;
|
||||
|
||||
USkeletalMeshComponent* MeshComponent = GetMeshComponent(ClothingSlotType);
|
||||
MeshComponent->SetSkeletalMesh(nullptr);
|
||||
|
||||
if (ClothingItemInstance->GetClothingItem()->UseLeaderPose)
|
||||
{
|
||||
ClothingSlotData.MeshComponent->SetLeaderPoseComponent(nullptr);
|
||||
MeshComponent->SetLeaderPoseComponent(nullptr);
|
||||
}
|
||||
|
||||
OnClothingUnequip.Broadcast(ClothingItemInstance);
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
UPROPERTY(BlueprintReadWrite, Category = "Clothing Manager|Clothing")
|
||||
USkeletalMeshComponent* RootMesh = nullptr;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, Category = "Clothing Manager|Clothing")
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Clothing Manager|Clothing")
|
||||
TArray<FClothingSlotData> ClothingSlots;
|
||||
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
@@ -73,4 +73,7 @@ public:
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
float GetHeelHeight();
|
||||
|
||||
private:
|
||||
USkeletalMeshComponent* GetMeshComponent(EClothingSlotType SlotType) const;
|
||||
};
|
||||
|
||||
@@ -9,37 +9,32 @@
|
||||
class UClothingItemInstance;
|
||||
enum class EClothingSlotType : uint8;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct NAKEDDESIRE_API FClothingSlotData
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
FClothingSlotData()
|
||||
: MeshComponent(nullptr), ClothingSlotType(EClothingSlotType::Anal), ClothingItemInstance(nullptr), Name(FText::GetEmpty())
|
||||
{
|
||||
}
|
||||
|
||||
FClothingSlotData(USkeletalMeshComponent* MeshComponent, const EClothingSlotType ClothingSlotType, UClothingItemInstance* ClothingItemInstance, const FText& Name)
|
||||
|
||||
FClothingSlotData(const EClothingSlotType ClothingSlotType, const FText& Name, UTexture2D* Icon = nullptr)
|
||||
{
|
||||
this->MeshComponent = MeshComponent;
|
||||
this->ClothingSlotType = ClothingSlotType;
|
||||
this->ClothingItemInstance = ClothingItemInstance;
|
||||
this->Name = Name;
|
||||
this->Icon = Icon;
|
||||
}
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, Category = "Clothing")
|
||||
TObjectPtr<USkeletalMeshComponent> MeshComponent = nullptr;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, Category = "Clothing")
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Clothing")
|
||||
EClothingSlotType ClothingSlotType = EClothingSlotType::Anal;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, Category = "Clothing")
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Clothing")
|
||||
TObjectPtr<UClothingItemInstance> ClothingItemInstance = nullptr;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, Category = "Clothing")
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Clothing")
|
||||
FText Name = FText::GetEmpty();
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Clothing")
|
||||
TObjectPtr<UTexture2D> Icon = nullptr;
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
// © 2025 Naked People Team. All Rights Reserved.
|
||||
|
||||
|
||||
#include "ClothingSlotsData.h"
|
||||
@@ -0,0 +1,34 @@
|
||||
// © 2025 Naked People Team. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "ClothingSlotType.h"
|
||||
#include "Engine/DataAsset.h"
|
||||
#include "ClothingSlotsData.generated.h"
|
||||
|
||||
USTRUCT()
|
||||
struct NAKEDDESIRE_API FClothingSlotData
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
FClothingSlotData()
|
||||
{
|
||||
}
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Clothing")
|
||||
UTexture2D Icon;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Clothing")
|
||||
FText Name;
|
||||
};
|
||||
|
||||
UCLASS()
|
||||
class NAKEDDESIRE_API UClothingSlotsData : public UPrimaryDataAsset
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Clothing")
|
||||
TMap<EClothingSlotType, FClothingSlotData> ClothingSlotsData;
|
||||
};
|
||||
Reference in New Issue
Block a user