Skip to content

Commit b8071e1

Browse files
committed
The wrong props appear on the Fori
1 parent c15ded3 commit b8071e1

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

Source/Bomber/Private/Components/MySkeletalMeshComponent.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void UMySkeletalMeshComponent::AttachProps()
101101
{
102102
const UPlayerRow* PlayerRow = PlayerMeshDataInternal.PlayerRow;
103103
if (!PlayerRow
104-
|| ArePropsAttached())
104+
|| !ArePropsWantToUpdate())
105105
{
106106
return;
107107
}
@@ -161,8 +161,8 @@ void UMySkeletalMeshComponent::AttachProps()
161161
}
162162
}
163163

164-
// Returns true if all props are attached
165-
bool UMySkeletalMeshComponent::ArePropsAttached() const
164+
// Returns true when is needed to attach or detach props
165+
bool UMySkeletalMeshComponent::ArePropsWantToUpdate() const
166166
{
167167
const UPlayerRow* PlayerRow = PlayerMeshDataInternal.PlayerRow;
168168
if (!PlayerRow)
@@ -174,8 +174,9 @@ bool UMySkeletalMeshComponent::ArePropsAttached() const
174174
const bool bEmptyPropsList = PlayerProps.Num() == 0;
175175
if (bEmptyPropsList)
176176
{
177-
// Props are not required, so it could be not set
178-
return true;
177+
// Returns false to do not update when props list is empty and is nothing already attached
178+
const bool bAttachedOutdated = AttachedMeshesInternal.Num() > 0;
179+
return bAttachedOutdated;
179180
}
180181

181182
for (const FAttachedMesh& AttachedMeshIt : PlayerProps)
@@ -196,11 +197,11 @@ bool UMySkeletalMeshComponent::ArePropsAttached() const
196197

197198
if (!bContains)
198199
{
199-
return false;
200+
return true;
200201
}
201202
}
202203

203-
return true;
204+
return false;
204205
}
205206

206207
// Some bomber characters have more than 1 texture, it will change a player skin if possible

Source/Bomber/Public/Components/MySkeletalMeshComponent.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ class UMySkeletalMeshComponent final : public USkeletalMeshComponent
8080
UFUNCTION(BlueprintCallable, Category = "C++")
8181
void AttachProps();
8282

83-
/** Returns true if all props are attached. */
83+
/** Returns true when is needed to attach or detach props. */
8484
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "C++")
85-
bool ArePropsAttached() const;
85+
bool ArePropsWantToUpdate() const;
8686

8787
/**
8888
* Set the skin, specified by index, to this mesh and its attached props

0 commit comments

Comments
 (0)