36 Commits

Author SHA1 Message Date
yoan stamant
4ebd904aaa [SmartObject] updated deprecation by restoring previous property as deprecated and moving deprecation code from PostLoad to Serialize to fix issues where result differ when parent is fully loaded first or is loaded by a child.
Added some additional code as a workaround to the fact that Serialize is not called on CDO.
#rb mikko.mononen

[CL 32498269 by yoan stamant in 5.4 branch]
2024-03-26 01:50:29 -04: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
40ff349f2c Smart Object: Added parameters for Smart Object Definition (take 2)
- Added ability to parameterize the SOD using parameters and property copy
- Each Asset stores and shares a variations based parameter hash

#rb Yoan.StAmant

[CL 30966021 by mikko mononen in 5.4 branch]
2024-01-29 07:16:16 -05:00
edwin maynard
483765d326 [Backout] - CL30836941 (backed out due to potential content errors)
[FYI] mikko.mononen
Original CL Desc
-----------------------------------------------------------------
Smart Object: Added parameters for Smart Object Definition
- Added ability to parameterize the SOD using parameters and property copy
- Each Asset stores and shares a variations based parameter hash

#rb Yoan.StAmant

[CL 30842479 by edwin maynard in ue5-main branch]
2024-01-24 09:54:41 -05:00
mikko mononen
a4f8b85727 Smart Object: Added parameters for Smart Object Definition
- Added ability to parameterize the SOD using parameters and property copy
- Each Asset stores and shares a variations based parameter hash

#rb Yoan.StAmant

[CL 30836942 by mikko mononen in ue5-main branch]
2024-01-24 03:53:02 -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
yoan stamant
203a091b6c [SmartObjects] unified the global UE::SmartObject namespace
#rb mikko.mononen

[CL 29934918 by yoan stamant in ue5-main branch]
2023-11-27 10:57:29 -05:00
ben hoffman
d3561d50e6 Disable Replication of properties on the base Smart Object component class to get rid of warnings on boot
#rb trivial
#rnx

[CL 27282777 by ben hoffman in ue5-main branch]
2023-08-22 15:35:40 -04:00
ben hoffman
c3fe7f0458 Expose some smart object component, definition, and runtime options to blueprints to make it possible to have some very basic interactions with them inside a blueprint.
Mark the handle and SO definiton as replicated on the base Smart object Component class. For now, this won't do anything. Going forward we will create an "Online Smart object Component" that actually stores the additional replication data as to not add a bunch of unused data on existing uses of the component.

#jira UE-188873
#jira UE-180500
#rb Yoan.StAmant

[CL 27274296 by ben hoffman in ue5-main branch]
2023-08-22 12:17:21 -04:00
luciano ferraro
4dfa27e83f Exposed a setter/getter SO enable method to the SO Component
[REVIEW] [at]Mikko.Mononen, [at]Yoan.Stamant
[FYI] Phil.Cole, Parker.Linn

[CL 26952120 by luciano ferraro in ue5-main branch]
2023-08-09 07:28:41 -04:00
yoan stamant
b428fa6832 Fix CIS Issue 332657: NonUnity build for non editor targets
#rnx

[CL 26442005 by yoan stamant in ue5-main branch]
2023-07-18 14:44:30 -04:00
yoan stamant
f7b87690eb [SmartObject] replaced check based on a wrong assumption by if statement
#rnx
#rb none
#preflight skip

[CL 25139731 by yoan stamant in ue5-main branch]
2023-04-20 19:08:41 -04:00
yoan stamant
ca4d7ba5fd [SmartObject] moved registration to BeginPlay/EndPlay for components used in a Game world. This will allow conditions to rely on a fully initialized actor in case they need to access other components. It will also make it easier to spawn a SmartObject actor and setup its definition before finishing the spawning.
#jira-none
#rb mieszko.zielinski
#preflight 644001d0bf10538466b1aa0d

[CL 25116704 by yoan stamant in ue5-main branch]
2023-04-19 17:32:09 -04:00
Mieszko Zielinski
137a53e1e5 Fixed SOComponent trying to annotate it's owner regardless of whether it's a CDO, which is never a good idea.
#rb trivial
#preflight skip
#jira UE-179064

[CL 24499400 by Mieszko Zielinski in ue5-main branch]
2023-03-03 11:07:35 -05:00
luciano ferraro
afb48ac56d Added an exposed native C++ event on the SmartObject component, fired when a StateTree runtime event is fired
#jira
[FYI] Mikko.Mononen, phil.cole, wojciech.madry, Parker.Linn
#preflight 63f8defddd78dd50f67b1ae3

[CL 24406726 by luciano ferraro in ue5-main branch]
2023-02-24 14:59:17 -05:00
stephen holmes
97766341ea Refactored FSructView and FConstStructView as per recent meetings. Both are now const correct in the same way TArrayView and TArrayConstView are (ie const FStructView and const FConstStructView) the view can not point at another view.
Also removed the Mutable named functions and replaced with the constness being part of the template.

#preflight 63ea4fbaec50523134d85665

[CL 24197313 by stephen holmes in ue5-main branch]
2023-02-13 20:06:02 -05:00
yoan stamant
adf6cb0a20 [SmartObjects]
- Added new methods to the API to filter a list of request results or slot handles by evaluating the selection preconditions
- Filter methods can accept external data as a struct with properties which name and type match the WolrdConditionContext.
- FSmartObjectUserContext has been introduced to cover the common case of passing in a user actor to the context.
- Stored UserDescriptor as instanced struct in the runtime slot
- Claim methods now receive a user descriptor
- Removed slot event delegate and reuse the runtime instance one instead. Listeners can filter for a given slot using 'Event.SlotHandle'
- Removed UserTags from the SmartObjectWorldConditionSchema. The user tags are part of the query filter. Conditions requiring user tags could fetch them from the actors passed in the context.
#rb mikko.mononen
#jira UE-157763
#preflight 63dbe99f797b029c0add9806

[CL 23984054 by yoan stamant in ue5-main branch]
2023-02-02 18:43:13 -05:00
henrik karlsson
9183978e29 [Engine/Plugins]
* Removed includes (using IWYU) in private files

#preflight 63c79978ac35a0e9dabbe408
#rb none

[CL 23770038 by henrik karlsson in ue5-main branch]
2023-01-19 00:48:07 -05:00
yoan stamant
1f6c7d722f [SmartObjects]
- Removed synchronization logic between ability system component and smartobject instance tags.
- Added SmartObject subsystem to the SmartObjectWorldConditionSchema to help fixing unit tests where we use a derived subsystem. Updated existing SmartObject world conditions to use it.
- Added support for world conditions to the main smart object instance (in addition to those in each slot). Slots could be also disabled by their parent conditions.
- Removed object tags filter from the definition and replaced it by the newly added condition (FWorldCondition_SmartObjectActorTagQuery)
#rb mikko.mononen
#preflight 63c6c3530b358b97d198a121

[CL 23756420 by yoan stamant in ue5-main branch]
2023-01-18 10:52:51 -05:00
bob tellez
09e68111e3 [Backout] - CL23741166
[FYI] Yoan.StAmant
Original CL Desc
-----------------------------------------------------------------
[SmartObjects]
- Removed synchronization logic between ability system component and smartobject instance tags.
- Added SmartObject subsystem to the SmartObjectWorldConditionSchema to help fixing unit tests where we use a derived subsystem. Updated existing SmartObject world conditions to use it.
- Added support for world conditions to the main smart object instance (in addition to those in each slot). Slots could be also disabled by their parent conditions.
- Removed object tags filter from the definition and replaced it by the newly added condition (FWorldCondition_SmartObjectActorTagQuery)
#rb mikko.mononen
#preflight 63c6c3530b358b97d198a121

[CL 23752170 by bob tellez in ue5-main branch]
2023-01-18 01:06:45 -05:00
yoan stamant
853ad94e66 [SmartObjects]
- Removed synchronization logic between ability system component and smartobject instance tags.
- Added SmartObject subsystem to the SmartObjectWorldConditionSchema to help fixing unit tests where we use a derived subsystem. Updated existing SmartObject world conditions to use it.
- Added support for world conditions to the main smart object instance (in addition to those in each slot). Slots could be also disabled by their parent conditions.
- Removed object tags filter from the definition and replaced it by the newly added condition (FWorldCondition_SmartObjectActorTagQuery)
#rb mikko.mononen
#preflight 63c6c3530b358b97d198a121

[CL 23747892 by yoan stamant in ue5-main branch]
2023-01-17 18:37:13 -05:00
mieszko zielinski
d08bd7242e Made Smart Objects' tag synchronization in USmartObjectComponent::OnRuntimeInstanceBound be performed only for collection-bound Smart Objects
#preflight 6391f815c709c72756a95d60

[CL 23449268 by mieszko zielinski in ue5-main branch]
2022-12-08 12:45:07 -05:00
mieszko zielinski
2da21261b0 Deprecated ESmartObjectUnregistrationMode and its use in SmartObjectComponent registration and unregistration and introduced two explicit paths for smart object removal:
* Unregister - keeps or deletes the runtime SO information based on SmartObjectComponent.RegistrationType
* Remove - called on SmartObject's EndPlay and ends up removing runtime data regardless of the registration type.

Also:
* SmartObjectSubsystem unfriended SmartObjectComponent - it was a toxic relationship anyway! ;)
* Made changes towards simplification of how things are done - Registering, Unregistering, Binding SO Component to a RuntimeInstance.

#preflight 6390906fbb6fefa4721822e4

[CL 23431219 by mieszko zielinski in ue5-main branch]
2022-12-07 13:05:23 -05:00
mieszko zielinski
bccb817a3f SmartObject registrations changes.
- SmartObject gained knowledge whether it was registered as a part of a colleciton, or as a dynamic smart object.
- cleaned up SmartObjectComponents SOHandle setting an resetting - there's a separate function for invalidating the handle.
- added handling of SmartObjectComponent's destruction (as opposed to unregistration due to being streamed out, potentially temporarily)

#preflight 638a25c74c3ce8ae5d20ba60

[CL 23389318 by mieszko zielinski in ue5-main branch]
2022-12-05 08:19:29 -05:00
mieszko zielinski
bf25520ccc SmartObject collection rework, introducing a FSmartObjectContainer type that encapsulates SmartObjectComponent registration and storage. The SmartObjectSubsystem now stores a Container that aggregates all other containers supplied by loaded/streamed in SmartObjectPersistentCollection instances.
In addition:
* SmartObjectCollection got deprecated and there's a auto-update path triggered in SmartObjectCollection::PostLoad
* SmartObjectComponent component can opt out of being a part of a collection with `bCanBePartOfCollection`
* Right now we limit SmartObjects to be registered with at most a single Collection. This might change in the future if required.

Note that this is the first change in a series, we're going to support miltiple collections per level with convenient ways of assigning SmartObjects to individual collections.

#jira UE-168977
#preflight 637f8faa4004f73f627ecaca

#preflight 637fa5378b12eb83a77ad7d9

[CL 23262132 by mieszko zielinski in ue5-main branch]
2022-11-24 14:53:52 -05:00