You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
[Backout] - CL23746516
[FYI] Yoan.StAmant Original CL Desc ----------------------------------------------------------------- [SmartObject] updated the smartobject blueprint library: - renamed 'K2_SetSmartObjectEnabled' to 'AddOrRemoveSmartObject' since 'Enabled= false' is a concept used when the object is no longer available for queries but active interactions can finish. - added functions to add to/remove from the simulation all smart objects from a single or a list of actors. - added functions to enable/disable smart objects on a single or a list of actors. #jira UE-165689 #rb mikko.mononen #rb maxime.mercier #rb patrick.carroll #preflight 63c6fda33f587d9e1403726c [CL 23752173 by bob tellez in ue5-main branch]
This commit is contained in:
@@ -1,5 +1,2 @@
|
||||
[/Script/SmartObjectsModule.SmartObjectSubsystem]
|
||||
SpacePartitionClassName=/Script/SmartObjectsModule.SmartObjectHashGrid
|
||||
|
||||
[CoreRedirects]
|
||||
+FunctionRedirects=(OldName="K2_SetSmartObjectEnabled",NewName="AddOrRemoveSmartObject")
|
||||
|
||||
@@ -30,102 +30,27 @@ void USmartObjectBlueprintFunctionLibrary::SetValueAsSOClaimHandle(UBlackboardCo
|
||||
BlackboardComponent->SetValue<UBlackboardKeyType_SOClaimHandle>(KeyID, Value);
|
||||
}
|
||||
|
||||
bool USmartObjectBlueprintFunctionLibrary::AddOrRemoveSmartObject(AActor* SmartObjectActor, const bool bAdd)
|
||||
bool USmartObjectBlueprintFunctionLibrary::K2_SetSmartObjectEnabled(AActor* SmartObject, const bool bEnabled)
|
||||
{
|
||||
return AddOrRemoveMultipleSmartObjects({SmartObjectActor}, bAdd);
|
||||
}
|
||||
|
||||
bool USmartObjectBlueprintFunctionLibrary::AddSmartObject(AActor* SmartObjectActor)
|
||||
{
|
||||
return AddOrRemoveMultipleSmartObjects({SmartObjectActor}, /*bAdd*/true);
|
||||
}
|
||||
|
||||
bool USmartObjectBlueprintFunctionLibrary::AddMultipleSmartObjects(const TArray<AActor*>& SmartObjectActors)
|
||||
{
|
||||
return AddOrRemoveMultipleSmartObjects(SmartObjectActors, /*bAdd*/true);
|
||||
}
|
||||
|
||||
bool USmartObjectBlueprintFunctionLibrary::RemoveSmartObject(AActor* SmartObjectActor)
|
||||
{
|
||||
return AddOrRemoveMultipleSmartObjects({SmartObjectActor}, /*bAdd*/false);
|
||||
}
|
||||
|
||||
bool USmartObjectBlueprintFunctionLibrary::RemoveMultipleSmartObjects(const TArray<AActor*>& SmartObjectActors)
|
||||
{
|
||||
return AddOrRemoveMultipleSmartObjects(SmartObjectActors, /*bAdd*/false);
|
||||
}
|
||||
|
||||
bool USmartObjectBlueprintFunctionLibrary::AddOrRemoveMultipleSmartObjects(const TArray<AActor*>& SmartObjectActors, const bool bAdd)
|
||||
{
|
||||
bool bSuccess = true;
|
||||
if (SmartObjectActors.IsEmpty())
|
||||
if (SmartObject == nullptr)
|
||||
{
|
||||
return bSuccess;
|
||||
return false;
|
||||
}
|
||||
|
||||
USmartObjectSubsystem* Subsystem = nullptr;
|
||||
for (const AActor* SmartObjectActor : SmartObjectActors)
|
||||
UWorld* World = SmartObject->GetWorld();
|
||||
if (World == nullptr)
|
||||
{
|
||||
if (SmartObjectActor == nullptr)
|
||||
{
|
||||
UE_LOG(LogSmartObject, Warning, TEXT("Null actor found and skipped"))
|
||||
bSuccess = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Subsystem == nullptr)
|
||||
{
|
||||
Subsystem = USmartObjectSubsystem::GetCurrent(SmartObjectActor->GetWorld());
|
||||
if (Subsystem == nullptr)
|
||||
{
|
||||
UE_LOG(LogSmartObject, Warning, TEXT("Unable to find SmartObjectSubsystem for the provided actors."))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bSuccess = bAdd ? Subsystem->RegisterSmartObjectActor(*SmartObjectActor) : Subsystem->RemoveSmartObjectActor(*SmartObjectActor) && bSuccess;
|
||||
return false;
|
||||
}
|
||||
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
bool USmartObjectBlueprintFunctionLibrary::SetSmartObjectEnabled(AActor* SmartObjectActor, const bool bEnabled)
|
||||
{
|
||||
return SetMultipleSmartObjectsEnabled({SmartObjectActor}, bEnabled);
|
||||
}
|
||||
|
||||
bool USmartObjectBlueprintFunctionLibrary::SetMultipleSmartObjectsEnabled(const TArray<AActor*>& SmartObjectActors, const bool bEnabled)
|
||||
{
|
||||
bool bSuccess = true;
|
||||
if (SmartObjectActors.IsEmpty())
|
||||
USmartObjectSubsystem* Subsystem = USmartObjectSubsystem::GetCurrent(World);
|
||||
if (Subsystem == nullptr)
|
||||
{
|
||||
return bSuccess;
|
||||
return false;
|
||||
}
|
||||
|
||||
USmartObjectSubsystem* Subsystem = nullptr;
|
||||
for (const AActor* SmartObjectActor : SmartObjectActors)
|
||||
{
|
||||
if (SmartObjectActor == nullptr)
|
||||
{
|
||||
UE_LOG(LogSmartObject, Warning, TEXT("Null actor found and skipped"))
|
||||
bSuccess = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Subsystem == nullptr)
|
||||
{
|
||||
Subsystem = USmartObjectSubsystem::GetCurrent(SmartObjectActor->GetWorld());
|
||||
if (Subsystem == nullptr)
|
||||
{
|
||||
UE_LOG(LogSmartObject, Warning, TEXT("Unable to find SmartObjectSubsystem for the provided actors."))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bSuccess = Subsystem->SetSmartObjectActorEnabled(*SmartObjectActor, bEnabled) && bSuccess;
|
||||
}
|
||||
|
||||
return bSuccess;
|
||||
return bEnabled ? Subsystem->RegisterSmartObjectActor(*SmartObject)
|
||||
: Subsystem->RemoveSmartObjectActor(*SmartObject);
|
||||
}
|
||||
|
||||
void USmartObjectBlueprintFunctionLibrary::SetBlackboardValueAsSOClaimHandle(UBTNode* NodeOwner, const FBlackboardKeySelector& Key, const FSmartObjectClaimHandle& Value)
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "SmartObjectRuntime.h"
|
||||
#include "SmartObjectBlueprintFunctionLibrary.generated.h"
|
||||
|
||||
struct FBlackboardKeySelector;
|
||||
struct FGameplayTagContainer;
|
||||
class UBlackboardComponent;
|
||||
class AAIController;
|
||||
@@ -26,99 +25,8 @@ public:
|
||||
UFUNCTION(BlueprintCallable, Category = "SmartObject")
|
||||
static bool IsValidSmartObjectClaimHandle(const FSmartObjectClaimHandle Handle) { return Handle.IsValid(); }
|
||||
|
||||
/**
|
||||
* Adds to the simulation all smart objects for an actor or removes them according to 'bAdd'.
|
||||
* @param SmartObjectActor The actor containing the smart objects to add or remove from the simulation
|
||||
* @param bAdd Whether the smart objects should be added or removed from the simulation
|
||||
* @return True if the requested operation succeeded; false otherwise
|
||||
* @note Removing a smart object from the simulation will interrupt all active interactions. If you simply need
|
||||
* to make the object unavailable for queries consider using one of the SetSmartObjectEnabled functions so active
|
||||
* interactions can be gracefully completed.
|
||||
* @see SetSmartObjectEnabled, SetMultipleSmartObjectsEnabled
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, Category = "SmartObject")
|
||||
static bool AddOrRemoveSmartObject(UPARAM(DisplayName = "SmartObjectActor") AActor* SmartObject, UPARAM(DisplayName = "bAdd") const bool bEnabled);
|
||||
|
||||
/**
|
||||
* Adds to the simulation all smart objects for multiple actors or removes them according to 'bAdd'.
|
||||
* @param SmartObjectActors The actors containing the smart objects to add or remove from the simulation
|
||||
* @param bAdd Whether the smart objects should be added or removed from the simulation
|
||||
* @return True if all actors were valid and the requested operation succeeded; false otherwise
|
||||
* @note Removing a smart object from the simulation will interrupt all active interactions. If you simply need
|
||||
* to make the object unavailable for queries consider using one of the SetSmartObjectEnabled functions so active
|
||||
* interactions can be gracefully completed.
|
||||
* @see SetSmartObjectEnabled, SetMultipleSmartObjectsEnabled
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, Category = "SmartObject")
|
||||
static bool AddOrRemoveMultipleSmartObjects(const TArray<AActor*>& SmartObjectActors, const bool bAdd);
|
||||
|
||||
/**
|
||||
* Adds to the simulation all smart objects for an actor.
|
||||
* @param SmartObjectActor The actor containing the smart objects to add to the simulation
|
||||
* @return True if the requested operation succeeded; false otherwise
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, Category = "SmartObject")
|
||||
static bool AddSmartObject(AActor* SmartObjectActor);
|
||||
|
||||
/**
|
||||
* Adds to the simulation all smart objects for multiple actors.
|
||||
* @param SmartObjectActors The actors containing the smart objects to add to the simulation
|
||||
* @return True if the requested operation succeeded; false otherwise
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, Category = "SmartObject")
|
||||
static bool AddMultipleSmartObjects(const TArray<AActor*>& SmartObjectActors);
|
||||
|
||||
/**
|
||||
* Removes from the simulation all smart objects for an actor.
|
||||
* @param SmartObjectActor The actor containing the smart objects to add or remove from the simulation
|
||||
* @return True if the requested operation succeeded; false otherwise
|
||||
* @note Removing a smart object from the simulation will interrupt all active interactions. If you simply need
|
||||
* to make the object unavailable for queries consider using one of the SetSmartObjectEnabled functions so active
|
||||
* interactions can be gracefully completed.
|
||||
* @see SetSmartObjectEnabled, SetMultipleSmartObjectsEnabled
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, Category = "SmartObject")
|
||||
static bool RemoveSmartObject(AActor* SmartObjectActor);
|
||||
|
||||
/**
|
||||
* Removes from the simulation all smart objects for multiple actors.
|
||||
* @param SmartObjectActors The actors containing the smart objects to remove from the simulation
|
||||
* @return True if the requested operation succeeded; false otherwise
|
||||
* @note Removing a smart object from the simulation will interrupt all active interactions. If you simply need
|
||||
* to make the object unavailable for queries consider using one of the SetSmartObjectEnabled functions so active
|
||||
* interactions can be gracefully completed.
|
||||
* @see SetSmartObjectEnabled, SetMultipleSmartObjectsEnabled
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, Category = "SmartObject")
|
||||
static bool RemoveMultipleSmartObjects(const TArray<AActor*>& SmartObjectActors);
|
||||
|
||||
/**
|
||||
* Marks all smart objects for an actor as enabled or not according to 'bEnabled'. A smart object marked as Enabled is available for queries.
|
||||
* @param SmartObjectActor The actor containing the smart objects to enable/disable
|
||||
* @param bEnabled Whether the smart objects should be enabled or not
|
||||
* @return True if the requested operation succeeded; false otherwise
|
||||
* @note Disabling a smart object will not interrupt active interactions, it will simply
|
||||
* mark the object unavailable for new queries and broadcast an event that can be handled
|
||||
* by the interacting agent to complete earlier. If the object should not be consider usable anymore
|
||||
* and the interactions aborted then consider using one of the Add/RemoveSmartObject functions.
|
||||
* @see AddOrRemoveSmartObject, AddOrRemoveMultipleSmartObjects, AddSmartObject, AddMultipleSmartObjects, RemoveSmartObject, RemoveMultipleSmartObjects
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, Category = "SmartObject")
|
||||
static bool SetSmartObjectEnabled(AActor* SmartObjectActor, const bool bEnabled);
|
||||
|
||||
/**
|
||||
* Marks all smart objects for a list of actors as enabled or not according to 'bEnabled'. A smart object marked as Enabled is available for queries.
|
||||
* @param SmartObjectActors The actors containing the smart objects to enable/disable
|
||||
* @param bEnabled Whether the smart objects should be in the simulation (added) or not (removed)
|
||||
* @return True if all actors were valid and the requested operation succeeded; false otherwise
|
||||
* @note Disabling a smart object will not interrupt active interactions, it will simply
|
||||
* mark the object unavailable for new queries and broadcast an event that can be handled
|
||||
* by the interacting agent to complete earlier. If the object should not be consider usable anymore
|
||||
* and the interactions aborted then consider using one of the Add/RemoveSmartObject functions.
|
||||
* @see AddOrRemoveSmartObject, AddOrRemoveMultipleSmartObjects, AddSmartObject, AddMultipleSmartObjects, RemoveSmartObject, RemoveMultipleSmartObjects
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, Category = "SmartObject", meta = (DisplayName = "SetMultipleSmartObjectsEnabled"))
|
||||
static bool SetMultipleSmartObjectsEnabled(const TArray<AActor*>& SmartObjectActors, const bool bEnabled);
|
||||
UFUNCTION(BlueprintCallable, Category = "SmartObject", meta = (DisplayName = "SetSmartObjectEnabled"))
|
||||
static bool K2_SetSmartObjectEnabled(AActor* SmartObject, const bool bEnabled);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "AI|BehaviorTree", meta = (HidePin = "NodeOwner", DefaultToSelf = "NodeOwner", DisplayName = "Set Blackboard Value As Smart Object Claim Handle"))
|
||||
static void SetBlackboardValueAsSOClaimHandle(UBTNode* NodeOwner, const FBlackboardKeySelector& Key, const FSmartObjectClaimHandle& Value);
|
||||
|
||||
Reference in New Issue
Block a user