Skip to content

Commit

Permalink
[fix] Change Cast to CastField in template functions of ReflectionHel…
Browse files Browse the repository at this point in the history
…per.h
  • Loading branch information
Panakotta00 committed Nov 13, 2023
1 parent 940d2ba commit 7e95cee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Mods/SML/Source/SML/Public/Reflection/ReflectionHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class SML_API FReflectionHelper {

template <typename T>
static T* FindPropertyChecked(UStruct* Class, const TCHAR* PropertyName) {
T* Property = Cast<T>(Class->FindPropertyByName(PropertyName));
T* Property = CastField<T>(Class->FindPropertyByName(PropertyName));
checkf(Property, TEXT("Property with given name not found in class: %s"), PropertyName);
return Property;
}
Expand All @@ -50,7 +50,7 @@ class SML_API FReflectionHelper {
static T* FindPropertyByShortNameChecked(UStruct* Class, const TCHAR* PropertyName) {
for(FProperty* Property = Class->PropertyLink; Property; Property = Property->PropertyLinkNext) {
if (Property->GetName().StartsWith(PropertyName)) {
if (T* CastedProperty = Cast<T>(Property)) {
if (T* CastedProperty = CastField<T>(Property)) {
return CastedProperty;
}
}
Expand All @@ -61,7 +61,7 @@ class SML_API FReflectionHelper {

template<typename T>
static typename T::TCppType GetPropertyValue(const UObject* Object, const TCHAR* PropertyName, int32 ArrayIndex = 0) {
T* Property = Cast<T>(Object->GetClass()->FindPropertyByName(PropertyName));
T* Property = CastField<T>(Object->GetClass()->FindPropertyByName(PropertyName));
checkf(Property, TEXT("Property not found in class %s: %s"), *Object->GetClass()->GetPathName(), PropertyName);
return Property->GetPropertyValue_InContainer(Object, ArrayIndex);
}
Expand Down

0 comments on commit 7e95cee

Please sign in to comment.