Get rid of lxTangibleInterface
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -114,7 +114,11 @@ void UlxTangible::MaybeExecuteAnimStateChanged() {
|
||||
FString blueprint = AnimTracker.GetCurrentBlueprintName();
|
||||
if (blueprint.IsEmpty()) blueprint = DEFAULT_BLUEPRINT;
|
||||
SetActorBlueprint(blueprint);
|
||||
IlxTangibleInterface::Execute_AnimationQueueChanged(GetActor());
|
||||
AActor *actor = GetActor();
|
||||
UFunction *aqchanged = UlxTangibleManager::GetAnimationQueueChanged(actor->GetClass());
|
||||
if (aqchanged != nullptr) {
|
||||
actor->ProcessEvent(aqchanged, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,34 +10,6 @@
|
||||
|
||||
class UlxTangibleManager;
|
||||
|
||||
// This class does not need to be modified.
|
||||
UINTERFACE(Blueprintable)
|
||||
class UlxTangibleInterface : public UInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* IlxTangibleInterface
|
||||
*
|
||||
* This class implements the interface that an Actor must implement
|
||||
* in order for that Actor to be usable as a Tangible.
|
||||
*
|
||||
*/
|
||||
|
||||
class INTEGRATION_API IlxTangibleInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
// Add interface functions to this class. This is the class that will be inherited to implement this interface.
|
||||
public:
|
||||
// Whenever the animation queue of a tangible changes in any way, this function
|
||||
// gets called automatically.
|
||||
UFUNCTION(BlueprintImplementableEvent, Category = "Luprex|Animation Queue")
|
||||
bool AnimationQueueChanged();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -10,6 +10,13 @@ using namespace DebugPrint;
|
||||
using TanArray = UlxTangibleManager::TanArray;
|
||||
using IdArray = UlxTangibleManager::IdArray;
|
||||
|
||||
UFunction *UlxTangibleManager::GetAnimationQueueChanged(UClass *uclass) {
|
||||
UFunction *result = uclass->FindFunctionByName(FName(TEXT("Animation Queue Changed")));
|
||||
if (result == nullptr) return nullptr;
|
||||
if (result->ParmsSize != 0) return nullptr;
|
||||
return result;
|
||||
}
|
||||
|
||||
UClass *UlxTangibleManager::GetTangibleClass(const FString &name) {
|
||||
if (name.IsEmpty()) {
|
||||
return nullptr;
|
||||
@@ -22,13 +29,18 @@ UClass *UlxTangibleManager::GetTangibleClass(const FString &name) {
|
||||
path += TCHAR('_');
|
||||
path += TCHAR('C');
|
||||
UClass *result = LoadObject<UClass>(nullptr, *path);
|
||||
if (result != nullptr) {
|
||||
if (!result->IsChildOf(AActor::StaticClass())) {
|
||||
return nullptr;
|
||||
}
|
||||
if (!result->ImplementsInterface(UlxTangibleInterface::StaticClass())) {
|
||||
return nullptr;
|
||||
}
|
||||
if (result == nullptr) {
|
||||
UE_LOG(LogBlueprint, Error, TEXT("No such UClass: %s"), *path);
|
||||
return nullptr;
|
||||
}
|
||||
if (!result->IsChildOf(AActor::StaticClass())) {
|
||||
UE_LOG(LogBlueprint, Error, TEXT("UClass is not an actor: %s"), *path);
|
||||
return nullptr;
|
||||
}
|
||||
UFunction *aqchanged = GetAnimationQueueChanged(result);
|
||||
if (aqchanged == nullptr) {
|
||||
UE_LOG(LogBlueprint, Error, TEXT("UClass does not have 'Animation Queue Changed' function: %s"), *path);
|
||||
return nullptr;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -101,5 +101,9 @@ public:
|
||||
// Convert a blueprint name to a blueprint class.
|
||||
//
|
||||
UClass *GetTangibleClass(const FString &name);
|
||||
|
||||
// Get the Animation Queue Changed function from a UClass.
|
||||
//
|
||||
static UFunction *GetAnimationQueueChanged(UClass *uclass);
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,10 @@ void UlxUtilityLibrary::CallFunctionByName(UObject *object, const FString &namep
|
||||
FBlueprintCoreDelegates::ThrowScriptException(FFrame::GetThreadLocalTopStackFrame()->Object, *FFrame::GetThreadLocalTopStackFrame(), ExceptionInfo);
|
||||
return;
|
||||
}
|
||||
UFunction* function = object->FindFunction(FName(*fullname));
|
||||
// UFunction* function = object->FindFunction(FName(*fullname));
|
||||
|
||||
UClass *uclass = object->GetClass();
|
||||
UFunction* function = uclass->FindFunctionByName(FName(*fullname));
|
||||
if (function == nullptr) {
|
||||
function = object->FindFunction(FName(*fallback));
|
||||
if (function == nullptr) {
|
||||
|
||||
Reference in New Issue
Block a user