Refactor clothing visuals
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "NakedDesire/Censorship/CensorshipComponent.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemDefinition.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemInstance.h"
|
||||
#include "NakedDesire/Clothing/ClothingVisualsComponent.h"
|
||||
#include "NakedDesire/Global/Constants.h"
|
||||
#include "NakedDesire/Global/NakedDesireHUD.h"
|
||||
#include "NakedDesire/Global/NakedDesireUserSettings.h"
|
||||
@@ -33,42 +34,7 @@ ANakedDesireCharacter::ANakedDesireCharacter()
|
||||
StatsManager = CreateDefaultSubobject<UStatsManager>("Stats Manager");
|
||||
MissionsManager = CreateDefaultSubobject<UMissionsManager>("Missions Manager");
|
||||
|
||||
NipplesMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>("Nipples");
|
||||
NipplesMeshComponent->SetupAttachment(GetMesh());
|
||||
AnalMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>("Anal");
|
||||
AnalMeshComponent->SetupAttachment(GetMesh());
|
||||
VaginaMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>("Vagina");
|
||||
VaginaMeshComponent->SetupAttachment(GetMesh());
|
||||
HeadMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>("Head");
|
||||
HeadMeshComponent->SetupAttachment(GetMesh());
|
||||
NeckMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>("Neck");
|
||||
NeckMeshComponent->SetupAttachment(GetMesh());
|
||||
FaceMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>("Face");
|
||||
FaceMeshComponent->SetupAttachment(GetMesh());
|
||||
EyesMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>("Eyes");
|
||||
EyesMeshComponent->SetupAttachment(GetMesh());
|
||||
BodySuitMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>("Body Suit");
|
||||
BodySuitMeshComponent->SetupAttachment(GetMesh());
|
||||
TopMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>("Top");
|
||||
TopMeshComponent->SetupAttachment(GetMesh());
|
||||
BottomMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>("Bottom");
|
||||
BottomMeshComponent->SetupAttachment(GetMesh());
|
||||
UnderwearTopMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>("Underwear Top");
|
||||
UnderwearTopMeshComponent->SetupAttachment(GetMesh());
|
||||
UnderwearBottomMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>("Underwear Bottom");
|
||||
UnderwearBottomMeshComponent->SetupAttachment(GetMesh());
|
||||
SocksMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>("Socks");
|
||||
SocksMeshComponent->SetupAttachment(GetMesh());
|
||||
FootwearMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>("Footwear");
|
||||
FootwearMeshComponent->SetupAttachment(GetMesh());
|
||||
OuterwearMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>("Outerwear");
|
||||
OuterwearMeshComponent->SetupAttachment(GetMesh());
|
||||
WristRestraintMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>("Wrist Restraint");
|
||||
WristRestraintMeshComponent->SetupAttachment(GetMesh());
|
||||
AnkleRestraintMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>("Ankle Restraint");
|
||||
AnkleRestraintMeshComponent->SetupAttachment(GetMesh());
|
||||
NeckRestraintMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>("Neck Restraint");
|
||||
NeckRestraintMeshComponent->SetupAttachment(GetMesh());
|
||||
ClothingVisualsComponent = CreateDefaultSubobject<UClothingVisualsComponent>(TEXT("Clothing Visuals Component"));
|
||||
|
||||
BoobLCensorship = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Boob L Censorship"));
|
||||
BoobLCensorship->SetupAttachment(GetMesh(), FName(TEXT("boob_l")));
|
||||
@@ -157,7 +123,8 @@ void ANakedDesireCharacter::BeginPlay()
|
||||
StimuliSourceComponent->RegisterWithPerceptionSystem();
|
||||
|
||||
// Initialize after Super::BeginPlay so clothing hydration has populated the
|
||||
// equipped set; the component recomputes censorship from that final state.
|
||||
// equipped set; both components sync from that final state.
|
||||
ClothingVisualsComponent->Initialize(GetMesh(), ClothingManager);
|
||||
CensorshipComponent->Initialize(ClothingManager, BoobLCensorship, BoobRCensorship, VaginaCensorship, AnalCensorship);
|
||||
|
||||
HUD = Cast<ANakedDesireHUD>(UGameplayStatics::GetPlayerController(GetWorld(), 0)->GetHUD());
|
||||
|
||||
@@ -19,6 +19,7 @@ class UClothingItemInstance;
|
||||
class UClothingSlotsData;
|
||||
class UAIPerceptionStimuliSourceComponent;
|
||||
class UClothingManager;
|
||||
class UClothingVisualsComponent;
|
||||
class UCensorshipComponent;
|
||||
class UStatsManager;
|
||||
class UMissionsManager;
|
||||
@@ -57,60 +58,9 @@ public:
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Input")
|
||||
UInputAction* InteractAction;
|
||||
|
||||
// Clothing
|
||||
// Clothing slot meshes are spawned per equipped slot at runtime by ClothingVisualsComponent.
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Clothing")
|
||||
USkeletalMeshComponent* NipplesMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Clothing")
|
||||
USkeletalMeshComponent* AnalMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Clothing")
|
||||
USkeletalMeshComponent* VaginaMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Clothing")
|
||||
USkeletalMeshComponent* HeadMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Clothing")
|
||||
USkeletalMeshComponent* NeckMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Clothing")
|
||||
USkeletalMeshComponent* FaceMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Clothing")
|
||||
USkeletalMeshComponent* EyesMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Clothing")
|
||||
USkeletalMeshComponent* BodySuitMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Clothing")
|
||||
USkeletalMeshComponent* TopMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Clothing")
|
||||
USkeletalMeshComponent* BottomMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Clothing")
|
||||
USkeletalMeshComponent* UnderwearTopMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Clothing")
|
||||
USkeletalMeshComponent* UnderwearBottomMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Clothing")
|
||||
USkeletalMeshComponent* SocksMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Clothing")
|
||||
USkeletalMeshComponent* FootwearMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Clothing")
|
||||
USkeletalMeshComponent* OuterwearMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Clothing")
|
||||
USkeletalMeshComponent* WristRestraintMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Clothing")
|
||||
USkeletalMeshComponent* AnkleRestraintMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Clothing")
|
||||
USkeletalMeshComponent* NeckRestraintMeshComponent;
|
||||
UClothingVisualsComponent* ClothingVisualsComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Censorship")
|
||||
UStaticMeshComponent* BoobLCensorship;
|
||||
|
||||
@@ -1,44 +1,16 @@
|
||||
#include "PlayerCinematic.h"
|
||||
#include "PlayerCinematic.h"
|
||||
|
||||
#include "NakedDesireCharacter.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemDefinition.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemInstance.h"
|
||||
#include "NakedDesire/Clothing/ClothingManager.h"
|
||||
#include "NakedDesire/Clothing/ClothingVisualsComponent.h"
|
||||
|
||||
|
||||
// Sets default values
|
||||
APlayerCinematic::APlayerCinematic()
|
||||
{
|
||||
PrimaryActorTick.bCanEverTick = false;
|
||||
|
||||
NipplesMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Nipples"));
|
||||
NipplesMeshComponent->SetupAttachment(GetMesh());
|
||||
AnalMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Anal"));
|
||||
AnalMeshComponent->SetupAttachment(GetMesh());
|
||||
VaginaMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Vagina"));
|
||||
VaginaMeshComponent->SetupAttachment(GetMesh());
|
||||
HeadMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Head"));
|
||||
HeadMeshComponent->SetupAttachment(GetMesh());
|
||||
NeckMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Neck"));
|
||||
NeckMeshComponent->SetupAttachment(GetMesh());
|
||||
FaceMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Face"));
|
||||
FaceMeshComponent->SetupAttachment(GetMesh());
|
||||
EyesMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Eyes"));
|
||||
EyesMeshComponent->SetupAttachment(GetMesh());
|
||||
BodyMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Body"));
|
||||
BodyMeshComponent->SetupAttachment(GetMesh());
|
||||
TopMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Top"));
|
||||
TopMeshComponent->SetupAttachment(GetMesh());
|
||||
BottomMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Bottom"));
|
||||
BottomMeshComponent->SetupAttachment(GetMesh());
|
||||
BraMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Bra"));
|
||||
BraMeshComponent->SetupAttachment(GetMesh());
|
||||
PantiesMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Panties"));
|
||||
PantiesMeshComponent->SetupAttachment(GetMesh());
|
||||
SocksMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Socks"));
|
||||
SocksMeshComponent->SetupAttachment(GetMesh());
|
||||
ShoesMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Shoes"));
|
||||
ShoesMeshComponent->SetupAttachment(GetMesh());
|
||||
|
||||
ClothingVisualsComponent = CreateDefaultSubobject<UClothingVisualsComponent>(TEXT("Clothing Visuals Component"));
|
||||
}
|
||||
|
||||
void APlayerCinematic::BeginPlay()
|
||||
@@ -51,83 +23,5 @@ void APlayerCinematic::BeginPlay()
|
||||
return;
|
||||
}
|
||||
|
||||
Player->ClothingManager->OnClothingEquip.AddUniqueDynamic(this, &APlayerCinematic::OnClothingEquip);
|
||||
Player->ClothingManager->OnClothingUnequip.AddUniqueDynamic(this, &APlayerCinematic::OnClothingUnequip);
|
||||
|
||||
for (const UClothingItemInstance* ClothingItemInstance : Player->ClothingManager->GetEquippedClothing())
|
||||
{
|
||||
EquipClothing(ClothingItemInstance);
|
||||
}
|
||||
}
|
||||
|
||||
void APlayerCinematic::OnClothingEquip(UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
EquipClothing(ClothingItemInstance);
|
||||
}
|
||||
|
||||
void APlayerCinematic::OnClothingUnequip(UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
UnequipClothing(ClothingItemInstance);
|
||||
}
|
||||
|
||||
USkeletalMeshComponent* APlayerCinematic::GetMeshByType(const EClothingSlotType SlotType) const
|
||||
{
|
||||
switch (SlotType)
|
||||
{
|
||||
case EClothingSlotType::Nipples:
|
||||
return NipplesMeshComponent;
|
||||
case EClothingSlotType::Anal:
|
||||
return AnalMeshComponent;
|
||||
case EClothingSlotType::Vagina:
|
||||
return VaginaMeshComponent;
|
||||
case EClothingSlotType::Head:
|
||||
return HeadMeshComponent;
|
||||
case EClothingSlotType::Neck:
|
||||
return NeckMeshComponent;
|
||||
case EClothingSlotType::Face:
|
||||
return FaceMeshComponent;
|
||||
case EClothingSlotType::Eyes:
|
||||
return EyesMeshComponent;
|
||||
case EClothingSlotType::Bodysuit:
|
||||
return BodyMeshComponent;
|
||||
case EClothingSlotType::Top:
|
||||
return TopMeshComponent;
|
||||
case EClothingSlotType::Bottom:
|
||||
return BottomMeshComponent;
|
||||
case EClothingSlotType::UnderwearTop:
|
||||
return BraMeshComponent;
|
||||
case EClothingSlotType::UnderwearBottom:
|
||||
return PantiesMeshComponent;
|
||||
case EClothingSlotType::Socks:
|
||||
return SocksMeshComponent;
|
||||
case EClothingSlotType::Footwear:
|
||||
return ShoesMeshComponent;
|
||||
default:
|
||||
return NipplesMeshComponent;
|
||||
}
|
||||
}
|
||||
|
||||
void APlayerCinematic::EquipClothing(const UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
USkeletalMeshComponent* MeshComponent = GetMeshByType(ClothingItemInstance->GetClothingItemDefinition()->SlotType);
|
||||
MeshComponent->SetSkeletalMesh(ClothingItemInstance->GetClothingItemDefinition()->SkeletalMesh);
|
||||
if (ClothingItemInstance->GetClothingItemDefinition()->UseLeaderPose)
|
||||
{
|
||||
MeshComponent->SetLeaderPoseComponent(GetMesh());
|
||||
}
|
||||
|
||||
if (!ClothingItemInstance->GetClothingItemDefinition()->Materials.IsEmpty())
|
||||
{
|
||||
for (const TPair<FName, UMaterialInstance*>& Material : ClothingItemInstance->GetClothingItemDefinition()->Materials)
|
||||
{
|
||||
MeshComponent->SetMaterialByName(Material.Key, Material.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void APlayerCinematic::UnequipClothing(const UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
USkeletalMeshComponent* MeshComponent = GetMeshByType(ClothingItemInstance->GetClothingItemDefinition()->SlotType);
|
||||
MeshComponent->SetSkeletalMesh(nullptr);
|
||||
MeshComponent->SetLeaderPoseComponent(nullptr);
|
||||
}
|
||||
ClothingVisualsComponent->Initialize(GetMesh(), Player->ClothingManager);
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Character.h"
|
||||
#include "NakedDesire/Clothing/ClothingSlotType.h"
|
||||
#include "PlayerCinematic.generated.h"
|
||||
|
||||
class UClothingItemInstance;
|
||||
class ANakedDesireCharacter;
|
||||
class UClothingVisualsComponent;
|
||||
|
||||
UCLASS()
|
||||
class NAKEDDESIRE_API APlayerCinematic : public ACharacter
|
||||
@@ -14,63 +13,13 @@ class NAKEDDESIRE_API APlayerCinematic : public ACharacter
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* NipplesMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* AnalMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* VaginaMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* HeadMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* NeckMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* FaceMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* EyesMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* BodyMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* TopMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* BottomMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* BraMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* PantiesMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* SocksMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* ShoesMeshComponent;
|
||||
UClothingVisualsComponent* ClothingVisualsComponent;
|
||||
|
||||
UPROPERTY()
|
||||
ANakedDesireCharacter* Player;
|
||||
|
||||
public:
|
||||
APlayerCinematic();
|
||||
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
private:
|
||||
UFUNCTION()
|
||||
void OnClothingEquip(UClothingItemInstance* ClothingItemInstance);
|
||||
|
||||
UFUNCTION()
|
||||
void OnClothingUnequip(UClothingItemInstance* ClothingItemInstance);
|
||||
|
||||
USkeletalMeshComponent* GetMeshByType(const EClothingSlotType SlotType) const;
|
||||
void EquipClothing(const UClothingItemInstance* ClothingItemInstance);
|
||||
void UnequipClothing(const UClothingItemInstance* ClothingItemInstance);
|
||||
};
|
||||
virtual void BeginPlay() override;
|
||||
};
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "PlayerImpostor.h"
|
||||
#include "PlayerImpostor.h"
|
||||
|
||||
#include "NakedDesireCharacter.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemDefinition.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemInstance.h"
|
||||
#include "NakedDesire/Clothing/ClothingManager.h"
|
||||
#include "NakedDesire/Clothing/ClothingVisualsComponent.h"
|
||||
|
||||
|
||||
APlayerImpostor::APlayerImpostor()
|
||||
@@ -16,44 +16,7 @@ APlayerImpostor::APlayerImpostor()
|
||||
Mesh = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("RootMesh"));
|
||||
Mesh->SetupAttachment(RootComponent);
|
||||
|
||||
NipplesMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Nipples"));
|
||||
NipplesMeshComponent->SetupAttachment(GetMesh());
|
||||
AnalMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Anal"));
|
||||
AnalMeshComponent->SetupAttachment(GetMesh());
|
||||
VaginaMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Vagina"));
|
||||
VaginaMeshComponent->SetupAttachment(GetMesh());
|
||||
HeadMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Head"));
|
||||
HeadMeshComponent->SetupAttachment(GetMesh());
|
||||
NeckMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Neck"));
|
||||
NeckMeshComponent->SetupAttachment(GetMesh());
|
||||
FaceMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Face"));
|
||||
FaceMeshComponent->SetupAttachment(GetMesh());
|
||||
EyesMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Eyes"));
|
||||
EyesMeshComponent->SetupAttachment(GetMesh());
|
||||
BodyMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Body"));
|
||||
BodyMeshComponent->SetupAttachment(GetMesh());
|
||||
TopMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Top"));
|
||||
TopMeshComponent->SetupAttachment(GetMesh());
|
||||
BottomMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Bottom"));
|
||||
BottomMeshComponent->SetupAttachment(GetMesh());
|
||||
BraMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Bra"));
|
||||
BraMeshComponent->SetupAttachment(GetMesh());
|
||||
PantiesMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Panties"));
|
||||
PantiesMeshComponent->SetupAttachment(GetMesh());
|
||||
SocksMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Socks"));
|
||||
SocksMeshComponent->SetupAttachment(GetMesh());
|
||||
ShoesMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Shoes"));
|
||||
ShoesMeshComponent->SetupAttachment(GetMesh());
|
||||
}
|
||||
|
||||
void APlayerImpostor::OnClothingEquip(UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
EquipClothing(ClothingItemInstance);
|
||||
}
|
||||
|
||||
void APlayerImpostor::OnClothingUnequip(UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
UnequipClothing(ClothingItemInstance);
|
||||
ClothingVisualsComponent = CreateDefaultSubobject<UClothingVisualsComponent>(TEXT("Clothing Visuals Component"));
|
||||
}
|
||||
|
||||
void APlayerImpostor::BeginPlay()
|
||||
@@ -66,73 +29,5 @@ void APlayerImpostor::BeginPlay()
|
||||
return;
|
||||
}
|
||||
|
||||
Player->ClothingManager->OnClothingEquip.AddUniqueDynamic(this, &APlayerImpostor::OnClothingEquip);
|
||||
Player->ClothingManager->OnClothingUnequip.AddUniqueDynamic(this, &APlayerImpostor::OnClothingUnequip);
|
||||
|
||||
for (const UClothingItemInstance* ClothingItemInstance : Player->ClothingManager->GetEquippedClothing())
|
||||
{
|
||||
EquipClothing(ClothingItemInstance);
|
||||
}
|
||||
}
|
||||
|
||||
USkeletalMeshComponent* APlayerImpostor::GetMeshByType(const EClothingSlotType SlotType) const
|
||||
{
|
||||
switch (SlotType)
|
||||
{
|
||||
case EClothingSlotType::Nipples:
|
||||
return NipplesMeshComponent;
|
||||
case EClothingSlotType::Anal:
|
||||
return AnalMeshComponent;
|
||||
case EClothingSlotType::Vagina:
|
||||
return VaginaMeshComponent;
|
||||
case EClothingSlotType::Head:
|
||||
return HeadMeshComponent;
|
||||
case EClothingSlotType::Neck:
|
||||
return NeckMeshComponent;
|
||||
case EClothingSlotType::Face:
|
||||
return FaceMeshComponent;
|
||||
case EClothingSlotType::Eyes:
|
||||
return EyesMeshComponent;
|
||||
case EClothingSlotType::Bodysuit:
|
||||
return BodyMeshComponent;
|
||||
case EClothingSlotType::Top:
|
||||
return TopMeshComponent;
|
||||
case EClothingSlotType::Bottom:
|
||||
return BottomMeshComponent;
|
||||
case EClothingSlotType::UnderwearTop:
|
||||
return BraMeshComponent;
|
||||
case EClothingSlotType::UnderwearBottom:
|
||||
return PantiesMeshComponent;
|
||||
case EClothingSlotType::Socks:
|
||||
return SocksMeshComponent;
|
||||
case EClothingSlotType::Footwear:
|
||||
return ShoesMeshComponent;
|
||||
default:
|
||||
return NipplesMeshComponent;
|
||||
}
|
||||
}
|
||||
|
||||
void APlayerImpostor::EquipClothing(const UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
USkeletalMeshComponent* MeshComponent = GetMeshByType(ClothingItemInstance->GetClothingItemDefinition()->SlotType);
|
||||
MeshComponent->SetSkeletalMesh(ClothingItemInstance->GetClothingItemDefinition()->SkeletalMesh);
|
||||
if (ClothingItemInstance->GetClothingItemDefinition()->UseLeaderPose)
|
||||
{
|
||||
MeshComponent->SetLeaderPoseComponent(GetMesh());
|
||||
}
|
||||
|
||||
if (!ClothingItemInstance->GetClothingItemDefinition()->Materials.IsEmpty())
|
||||
{
|
||||
for (const TPair<FName, UMaterialInstance*>& Material : ClothingItemInstance->GetClothingItemDefinition()->Materials)
|
||||
{
|
||||
MeshComponent->SetMaterialByName(Material.Key, Material.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void APlayerImpostor::UnequipClothing(const UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
USkeletalMeshComponent* MeshComponent = GetMeshByType(ClothingItemInstance->GetClothingItemDefinition()->SlotType);
|
||||
MeshComponent->SetSkeletalMesh(nullptr);
|
||||
MeshComponent->SetLeaderPoseComponent(nullptr);
|
||||
}
|
||||
ClothingVisualsComponent->Initialize(GetMesh(), Player->ClothingManager);
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "NakedDesire/Clothing/ClothingSlotType.h"
|
||||
#include "GameFramework/Pawn.h"
|
||||
#include "PlayerImpostor.generated.h"
|
||||
|
||||
class UClothingItemInstance;
|
||||
class ANakedDesireCharacter;
|
||||
class UClothingVisualsComponent;
|
||||
|
||||
UCLASS()
|
||||
class NAKEDDESIRE_API APlayerImpostor : public APawn
|
||||
@@ -20,46 +19,7 @@ class NAKEDDESIRE_API APlayerImpostor : public APawn
|
||||
USkeletalMeshComponent* Mesh;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* NipplesMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* AnalMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* VaginaMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* HeadMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* NeckMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* FaceMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* EyesMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* BodyMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* TopMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* BottomMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* BraMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* PantiesMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* SocksMeshComponent;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true), Category = "Clothing")
|
||||
USkeletalMeshComponent* ShoesMeshComponent;
|
||||
UClothingVisualsComponent* ClothingVisualsComponent;
|
||||
|
||||
UPROPERTY()
|
||||
ANakedDesireCharacter* Player;
|
||||
@@ -70,14 +30,5 @@ public:
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
private:
|
||||
UFUNCTION()
|
||||
void OnClothingEquip(UClothingItemInstance* ClothingItemInstance);
|
||||
|
||||
UFUNCTION()
|
||||
void OnClothingUnequip(UClothingItemInstance* ClothingItemInstance);
|
||||
|
||||
USkeletalMeshComponent* GetMesh() const { return Mesh; };
|
||||
USkeletalMeshComponent* GetMeshByType(const EClothingSlotType SlotType) const;
|
||||
void EquipClothing(const UClothingItemInstance* ClothingItemInstance);
|
||||
void UnequipClothing(const UClothingItemInstance* ClothingItemInstance);
|
||||
};
|
||||
USkeletalMeshComponent* GetMesh() const { return Mesh; }
|
||||
};
|
||||
Reference in New Issue
Block a user