84 Commits

Author SHA1 Message Date
yoan stamant
5251d1b155 [SmartObject] adding support for SmartObjects on actor instances:
- mass tag, fragments to create/destroy smart objects for entities
- project specific interop component for instanced actors
#rb Mieszko.Zielinski, mikko.mononen

[CL 32478846 by yoan stamant in 5.4 branch]
2024-03-25 14:42:27 -04:00
yoan stamant
b2d519bbd9 [SmartObject] owner component needs to be set before activating world conditions
#rb Luciano.Ferraro
#tests Juno

[CL 31335253 by yoan stamant in 5.4 branch]
2024-02-09 07:34:22 -05:00
yoan stamant
9563f11f2f [SmartObject]
- allow smart object creation from definition, transform and owner descriptor struct that will use dynamic ids
- moved FSmartObjectHandleFactory to the SmartObjectTypes and added method to get a dynamic id
- replaced registration type `WithCollection` by `BindToExistingInstance` in USmartObjectComponent since it can also be used for objects not tied to a component lifetime created from CreateSmartObject
- allow subsystem component accessor to force hydrate the actor associated to a smart object.
- fixed automation test to use the right property to set a definition asset now that it has been renamed
#rb Mieszko.Zielinski, mikko.mononen
#tests QAGame, unit tests, Juno

[CL 31295548 by yoan stamant in 5.4 branch]
2024-02-08 13:21:26 -05:00
mikko mononen
096756af13 SmartObject: Added claim priority which allows higher priority claims to override lower priority claims.
#rb Yoan.StAmant, Mieszko.Zielinski

[CL 30010180 by mikko mononen in ue5-main branch]
2023-11-30 02:26:33 -05:00
yoan stamant
5e375112b9 [SmartObject] added reasons to control the enabled states of smart objects:
- Gameplay tags are used to identify a reason
- Default reason "SmartObject.EnabledReason.Gameplay" is a tag (UE::SmartObject::EnabledReason::Gameplay) provided by the plugin and used by default if no other reason is specified
- Tags are converted to bit masks and stored as disable flags in runtime instance
- External systems can declare new Gameplay Tags for the specific needs. System currently allows 16 different reasons (1 default + 15 custom)
- A Smart Object  instance is considered disabled as soon as at least one reason is set
#rb Luciano.Ferraro, mikko.mononen

[CL 29989734 by yoan stamant in ue5-main branch]
2023-11-29 11:23:11 -05:00
mikko mononen
cc737f3eef [SmartObject] Added method to update SO transform
- Added UpdateSmartObjectTransform() to allow to update the Smart Object location at runtime
- Change spatial partitioning Add() to take ref to the handle to avoid alloc when readding

#rb Yoan.StAmant

[CL 29884931 by mikko mononen in ue5-main branch]
2023-11-22 04:49:00 -05:00
yoan stamant
a788975f6b Fixed type conversion warnings
#rb mikko.mononen

[CL 27890994 by yoan stamant in ue5-main branch]
2023-09-14 15:23:22 -04:00
ben hoffman
04773d7a0d Add a Find Smart Object from Targeting System request to smart objects. The targeting system is often used for player interactions to determine what the player is "targeting", so being able to find the smart objects that a player is looking at will make using smart objects for player interaction easier!
#jira UE-188874
#rb Yoan.StAmant
#prelight 64f791edf140ae6e397ecdd3

[CL 27611983 by ben hoffman in ue5-main branch]
2023-09-05 16:59:33 -04:00
ben hoffman
8c35dff059 Add Find Smart Object functions that take in AActor's and avoid using the normal QueryBox.
This is more friendly to the UE Gameplay Framework and lets you pass in specific actor's that you case about. If you had to use a spatial query, then you may get results from objects that you don't explictly want if they are overlapping objects.

Add a function to check if the subsystem is running on the server or not to make doing some future replication checks easier

#jira UE-180500
#rb mikko.mononen

[CL 27597760 by ben hoffman in ue5-main branch]
2023-09-05 11:29:58 -04:00
mikko mononen
b5f6447b2d [SmartObjects] Made USmartObjectSubsystem::QueryAllValidatedEntranceLocations() static so that it can be used even if SO subsystem is not available.
[CL 27064404 by mikko mononen in ue5-main branch]
2023-08-14 03:40:42 -04:00
mikko mononen
33bb4fe2c0 [SmartObjects] Added ability to validate a smart object definition and return all validated entries.
- Added Object enabled/disabled events to Smart Object lifetime to make it easier to react to the Smart Object enabled status
- Changed FSmartObjectSlotEntranceLocationRequest to be a BP type
- Changed FSmartObjectSlotEntranceLocationRequest.UserCapsule optional to invalid default value to make it easier to interface with BP
- Added FSmartObjectSlotEntranceLocationResult.bIsValid to be able to return results where the validation fails
- Added USmartObjectSubsystem.QueryAllValidatedEntranceLocations() which allows to validate SO definition, but does not require a registered Smart Object (can be used e.g. got object placement UI feedback)
- Added some helpers to allow to reuse validation between multiple methods in USmartObjectSubsystem

[CL 26987173 by mikko mononen in ue5-main branch]
2023-08-10 07:02:20 -04:00
yoan stamant
d05f8826ea [SmartObject] Removed dependency on MassEntity to store slots
#rb mikko.mononen

[CL 26431776 by yoan stamant in ue5-main branch]
2023-07-18 08:42:51 -04:00
ben hoffman
176e409bd8 Add two Smart Object Request Filter options to return claimed and/or disabled slots too
#rb Mikko.Mononen, Yoan.Stamant

#ushell-cherrypick of 26314489 by kristof.morva1

[CL 26329438 by ben hoffman in ue5-main branch]
2023-06-29 17:44:56 -04:00
yoan stamant
753667ce6d [SmartObject] some cleanup in the blueprint API for SmartObjects
- replaced 'SmartObjectSubsystem.Claim' by 'MarkSlotAsClaimed' for native code and 'USmartObjectBlueprintFunctionLibrary::MarkSmartObjectSlotAsClaimed' for Blueprints
- replaced 'SmartObjectSubsystem.Use' by 'MarkSlotAsOccupied' for native code and 'USmartObjectBlueprintFunctionLibrary::MarkSmartObjectSlotAsOccupied' for Blueprints
- replaced 'SmartObjectSubsystem.Release' by 'MarkSlotAsFree' for native code and 'USmartObjectBlueprintFunctionLibrary::MarkSmartObjectSlotAsFree' for Blueprints
- deprecated 'UGameplayBehaviorSmartObjectsBlueprintFunctionLibrary::UseGameplayBehaviorSmartObject' in favor of the aync task based versions
- UFUNCTION versions are redirected directly to the new names. Native versions are deprecated.
- updated 'AITask_UseGameplayInteraction' and 'AITask_UseGameplayBehaviorSmartObject' to be as close as possible since they are two similar use cases but for different plugins.
   - both tasks now propose blueprint callables to create an "interact on spot" or "move to and interact" tasks:
      - 'UseSmartObjectWithGameplayBehavior' and 'MoveToAndUseSmartObjectWithGameplayBehavior'
      - 'UseSmartObjectWithGameplayInteraction' and 'MoveToAndUseSmartObjectWithGameplayInteraction'
   - 'AITask_UseGameplayBehaviorSmartObject::UseClaimedGameplayBehaviorSmartObject' is redirected to 'MoveToAndUseSmartObjectWithGameplayBehavior' to preserve current behavior
   - 'AITask_UseGameplayInteraction::UseClaimedGameplayInteractionSmartObject' is redirected to 'UseSmartObjectWithGameplayInteraction' to preserve current behavior
#jira UE-187209
#rnx

[CL 25871194 by yoan stamant in ue5-main branch]
2023-06-08 10:34:40 -04:00
mikko mononen
1cd2e0af30 GameplayInteractions: added entrance handle to interaction context
- Added entrance handle to the data that is passed to the interaction context, exposed to state tree
- Changed entrance tags to a tag container
- Added State Tree task to get entrance tags from an entrance handle

[CL 25813984 by mikko mononen in ue5-main branch]
2023-06-06 09:07:47 -04:00
yoan stamant
8392b4ee6b [SmartObjects]
- RemoveComponentFromSimulation is now properly unbinding the component
- Unbinding a component from the simulation won't invalidate the registered handle anymore; this is handled by the FSmartObjectContainer.
- Removed obsolete RuntimeCreatedEntries that was replaced by the registration type.
- Added IsBoundToSimulation to the SmartObjectComponent to differentiate a registered component (valid Handle) from a registered component bound to the simulation (linked to its runtime instance)
- DebugUnregisterAllSmartObjects will no longer cause an ensure when calling EndPlay with the previous fixes.
- Added unit tests for IsBoundToSimulation and RemoveComponentFromSimulation+UnregisterSmartObject sequence to simulate the EndPlay issue.
#tests PIE, rebuild collection, WorldPartition levels, used cheats multiple times
#rb mieszko.zielinski
#preflight 64709c8a893dadf035e51c75

[CL 25647084 by yoan stamant in ue5-main branch]
2023-05-26 12:48:38 -04:00
mikko mononen
5ec0776e1f Smart Object: Expose FSmartObjectSlotEntranceLocationResult and FSmartObjectSlotEntranceHandle to Blueprints.
#preflight 6447b4a89770663ce2a504f4

[CL 25178642 by mikko mononen in ue5-main branch]
2023-04-25 08:35:21 -04:00
ben zeigler
9e0ea41c7f Improve blueprint integration with smart objects subsystem:
Deprecate the pure version of FindSmartObjects and add a new non-pure BP wrapper that allows proper iteration of the returned array, both versions are identical when called from C++.
Change TSubclassOf parameters to use values instead of const references, this enables the class picker on those pins.
#jira UE-180500
#preflight skip
#rb yoan.stamant

[CL 25153289 by ben zeigler in ue5-main branch]
2023-04-21 16:47:40 -04:00
yoan stamant
c6f801834a [SmartObject] fixes to SmartObjectCollection build from the world partition builder
- unregisters collections before resetting them to update subsystem internal container and the runtime data. Collection are then registered back as empty collection ready to be populated.
- minor comments improvements
- force debug draw update when registering new objects
- fixed some reported warning regarding failed component unregistration
#rb mieszko.zielinski
#preflight 643e8699bf10538466518715

[CL 25085246 by yoan stamant in ue5-main branch]
2023-04-18 09:40:15 -04:00
mikko mononen
d1a0cd77b7 SmartObjects: Cleaned up unused API.
#jira UE-174418
#preflight 64229dee710ec8400f9f88d1

[CL 24815902 by mikko mononen in ue5-main branch]
2023-03-28 05:20:16 -04:00
mikko mononen
9841195afe SmartObject: Improved validation settings
- Added SmartObjectUserComponent which allows to define validation settings per user actor
- Added option to SO defintion to have preview validation settings or preview user actor (settings pulled from SO user component)
- Move parameters passed to SO annotation CollectDataForGameplayDebugger() into a struct
- Changed USmartObjectSlotValidationFilter to have 2 sets of validation parameters to allow exits to have looser validation
- Changed the API for setting params from Actor in FSmartObjectSlotEntranceLocationRequest (still meh)

#jira UE-174418
#preflight 642173f8a86ae7cbcc25ab0b

[CL 24801238 by mikko mononen in ue5-main branch]
2023-03-27 08:22:19 -04:00
luciano ferraro
78ef1df533 Added an optional flag in the SO find to avoid checking for WC conditions:
- this can be used when we want to forcibly pick a SO
- huge workflow improvement for testing SO interactions in PIE

Fixed a bug with UpdateEntranceLocation testing and potentially returning different entry locations if we are asking for a single one
Fixed a bug with the EntranceHandle not being set when finding entry locations

Added an equality operator to the entrance handle

[REVIEW] [at]Mikko.Mononen
[FYI] phil.cole, wojciech.madry, Parker.Linn, Loic.Devaux
#preflight 641ad870691c5ebc1533656a

[CL 24745942 by luciano ferraro in ue5-main branch]
2023-03-22 08:23:20 -04:00
mikko mononen
7edf169364 Smart Object: Added capsule check for slot and entrance location validation
- Changed default value for entrance annotation ground check to true
- Exposed common function to return preview validation filter
- Added user capsule parameters for into the validation filter (can be optionally tied to nav params)
- Display priority on the entrance slot if other than normal
- Added option to FindEntranceLocationForSlot() to validate slot and entrance location using physics overlap check

#jira UE-174418
#rb Yoan.StAmant
#preflight 64197ec937382f6bf589eecf

[CL 24730129 by mikko mononen in ue5-main branch]
2023-03-21 07:37:13 -04:00
mikko mononen
015d344de7 SmartObjects:
- Renamed some uses of navigation to entrance
- Added priority for entrance selection
- Allow to run the entrance selection only for a specific entrace
- Added instigator as ignored entities when selecting entrances

#jira UE-174418
#preflight 641436f332723d4a20208bd9

[CL 24686648 by mikko mononen in ue5-main branch]
2023-03-17 07:41:24 -04:00
mikko mononen
1ca6e4407c Smart Objects: Added way to project navigation locations on ground and to check collisions between nav location and slot.
- Changed entry annotation to navigation annotation
- Added option for nav annotations to project location on ground
- Added option and settings for nav annotations to check simple trajectory collisions towards slot location
- Added logic in entry location query to project on ground and check trajectory collisions
- Added physics settings struct that handles common query combinations
- Added USmartObjectSlotValidationFilter to define shareable settings for validation (kinda similar to nav query filter)
- Fixed double rendering of preview actor/mesh in SO editor
- added debug draw for the new features

#jira UE-174418
#preflight 641036e470639dfc943ed981

[CL 24632583 by mikko mononen in ue5-main branch]
2023-03-14 06:26:29 -04:00