Commit Graph

54 Commits

Author SHA1 Message Date
mikko mononen
abc2561ecf StateTree: Fix property binding for direct struct access
#jira none
#rb Yoan.StAmant
#preflight 6299c84c1941378d7c97e7aa

[CL 20484161 by mikko mononen in ue5-main branch]
2022-06-03 04:55:42 -04:00
Ben Marsh
f379f98a78 Fix warning for incorrectly included header.
#preflight none

[CL 20470758 by Ben Marsh in ue5-main branch]
2022-06-02 12:03:12 -04:00
Ben Marsh
727313243d Fix non-unity compile errors.
#preflight none

[CL 20469864 by Ben Marsh in ue5-main branch]
2022-06-02 11:03:50 -04:00
Yoan StAmant
fabace42c8 [StateTree] log verbosity for Tick changed from Verbose to VeryVerbose to make it easier to prune logs and find transitions
#rnx
#rb trivial
#preflight skip

[CL 20467859 by Yoan StAmant in ue5-main branch]
2022-06-02 07:49:30 -04:00
robert manuszewski
d1443992e1 Deprecating ANY_PACKAGE.
This change consists of multiple changes:

Core:
- Deprecation of ANY_PACKAGE macro. Added ANY_PACKAGE_DEPRECATED macro which can still be used for backwards compatibility purposes (only used in CoreUObject)
- Deprecation of StaticFindObjectFast* functions that take bAnyPackage parameter
- Added UStruct::GetStructPathName function that returns FTopLevelAssetPath representing the path name (package + object FName, super quick compared to UObject::GetPathName) + wrapper UClass::GetClassPathName to make it look better when used with UClasses
- Added (Static)FindFirstObject* functions that find a first object given its Name (no Outer). These functions are used in places I consider valid to do global UObject (UClass) lookups like parsing command line parameters / checking for unique object names
- Added static UClass::TryFindType function which serves a similar purpose as FindFirstObject however it's going to throw a warning (with a callstack / maybe ensure in the future?) if short class name is provided. This function is used  in places that used to use short class names but now should have been converted to use path names to catch any potential regressions and or edge cases I missed.
- Added static UClass::TryConvertShortNameToPathName utility function
- Added static UClass::TryFixShortClassNameExportPath utility function
- Object text export paths will now also include class path (Texture2D'/Game/Textures/Grass.Grass' -> /Script/Engine.Texture2D'/Game/Textures/Grass.Grass')
- All places that manually generated object export paths for objects will now use FObjectPropertyBase::GetExportPath
- Added a new startup test that checks for short type names in UClass/FProperty MetaData values

AssetRegistry:
- Deprecated any member variables (FAssetData / FARFilter) or functions that use FNames to represent class names and replaced them with FTopLevelAssetPath
- Added new member variables and new function overloads that use FTopLevelAssetPath to represent class names
- This also applies to a few other modules' APIs to match AssetRegistry changes

Everything else:
- Updated code that used ANY_PACKAGE (depending on the use case) to use FindObject(nullptr, PathToObject), UClass::TryFindType (used when path name is expected, warns if it's a short name) or FindFirstObject (usually for finding types based on user input but there's been a few legitimate use cases not related to user input)
- Updated code that used AssetRegistry API to use FTopLevelAssetPaths and USomeClass::StaticClass()->GetClassPathName() instead of GetFName()
- Updated meta data and hardcoded FindObject(ANY_PACKAGE, "EEnumNameOrClassName") calls to use path names

#jira UE-99463
#rb many.people
[FYI] Marcus.Wassmer
#preflight 629248ec2256738f75de9b32

#codereviewnumbers 20320742, 20320791, 20320799, 20320756, 20320809, 20320830, 20320840, 20320846, 20320851, 20320863, 20320780, 20320765, 20320876, 20320786

#ROBOMERGE-OWNER: robert.manuszewski
#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 20430220 via CL 20433854 via CL 20435474 via CL 20435484
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v949-20362246)

[CL 20448496 by robert manuszewski in ue5-main branch]
2022-06-01 03:46:59 -04:00
mikko mononen
cd197fcb3e StateTree: refactored index types
- Changed FStateTreeHandle to FStateTreeStateHandle, used only for indexing states
- Added uint16 and uin8 index types, which can represent invalid index (aka INDEX_NONE)
- Changed indices that can be optional to the index types above
- Added validation and error loggic when index types overflow during compile
- Removed 2 indirections (in common case) and halved the memory usage of property copies

#jira none
#rb Mieszko.Zielinski
#preflight 6295d26e91004dd61ced370b

[CL 20434838 by mikko mononen in ue5-main branch]
2022-05-31 04:51:18 -04:00
mikko mononen
66e1f36595 StateTree: Changed runtime data to contain only active tasks
- Commented and cleaned up the members of UStateTree a bit
- Changed StateTree Node storage to FInstancedStructArray (contiguous memory)
- Changed StateTree SharedData to FInstancedStructArray
- Changed StateTree instance data to use FInstancedStructArray
- StateTree statistics shows estimated mem usage per state and max for tree (heaviest linked chain)
- Added explicit bLinked state for UStateTree
- Cleaned up UStateTree::ResetCompiled()/ResetLinked()
- Changed StateTree execution context to allocate task instance data on Start() and EnterState()
- StateTree tick uses execution order counters to access the instance data instead of compile time specific index

#jira  UE-153269
#rb Stephen.Holmes Yoan.StAmant
#preflight 628df39faf7a2e956bb45dc5

[CL 20361823 by mikko mononen in ue5-main branch]
2022-05-25 05:34:50 -04:00
mikko mononen
24df3e11e6 StateTree: Fixed handling of missing instance data types
- Fixed alignment of null structs from 0 to 1
- 0 causes the offset to reset, which in turn could could cause 0 size malloc

#jira none
#rb Yoan.StAmant
#fyi Yoan.StAmant
#preflight 6285fbb67a2503cd8986ce1f

[CL 20277269 by mikko mononen in ue5-main branch]
2022-05-19 04:24:56 -04:00
Yoan StAmant
88efcf58d0 Static analysis fix for FStateTreeReference
#rnx
#jira UE-152695
#rb trivial
#preflight none

[CL 20246231 by Yoan StAmant in ue5-main branch]
2022-05-17 13:18:02 -04:00
mikko mononen
a841531c2b StateTree: moved evaluators global to tree
- Deprecated per state evaluators and moved them to global to the tree
- Tick evals once per Tick()
- Updated editor node customizations to work on UStateTreeEditorData
- Added separate detail customization for UStateTreeEditorData

#jira UE-147508
#rb Yoan.StAmant
#preflight 62820e55046b81bf93911605

[CL 20221385 by mikko mononen in ue5-main branch]
2022-05-16 05:13:27 -04:00
mikko mononen
3077ab6616 StateTree: Commandlet to compile all StateTree assets
- Added StateTreeCompileAllCommandlet
- Fixed StateTree editor compile button indication

#jira UE-151007 UE-150881 UE-150883 UE-149897
#rb Yoan.StAmant
#preflight 627e31b9d445061f2a881a4f

[CL 20179071 by mikko mononen in ue5-main branch]
2022-05-13 06:32:28 -04:00
mikko mononen
97d82b0cb0 StateTree: shared instance data
- Separated condition instance data into a shared instance data (mutable but no persistent state)
- Made BP TestCondition() const, conditions should not hold state
- Added macro to define runtime data POD for faster init
- Added custom serialization version for UStateTree, older assets need recompile
- Updated memory reporting to be a bit more accurate, separated shared and unique data

#jira UE-147508
#rb Mieszko.Zielinski
#preflight 627b657d2d608c533b5cde15

[CL 20134929 by mikko mononen in ue5-main branch]
2022-05-11 04:04:58 -04:00
Yoan StAmant
5875739cb2 [StateTree] added StateTreeReference type customization
- StateTree asset allowed by a StateTreeReference can be filtered by using "meta=(schema="SomeSchema")" on the UPROPERTY of type StateTreeReference.
#rnx
#rb mikko.mononen
#preflight 627a6fd7e713fc6e2c4cddae

[CL 20122645 by Yoan StAmant in ue5-main branch]
2022-05-10 10:15:17 -04:00
Yoan StAmant
9a7f402070 [StateTree] validate Parameter view index instead of using a check since trees need to be recompiled to set it but we don't want to force it to be able to use older asset.
#rnx
#rb none
#preflight 62750b15594b7a203155eb23

[CL 20074000 by Yoan StAmant in ue5-main branch]
2022-05-06 08:00:26 -04:00
Yoan StAmant
35cf1ec0cb [StateTree] NamedExternalDataDescs are now copied from schema to the StateTree at compilation. Schema derived classes need to override only one method to provide their descriptors.
#rnx
#rb mikko.mononen
#preflight 6274282203269096abd41d8f

[CL 20063572 by Yoan StAmant in ue5-main branch]
2022-05-05 15:58:09 -04:00
Yoan StAmant
af7394cf27 [StateTree] replaced StateTreeParameters by InstancedPropertyBag
#rnx
#rb mikko.mononen
#preflight 6273ec0f03269096abc99574

[CL 20059078 by Yoan StAmant in ue5-main branch]
2022-05-05 12:02:47 -04:00
mikko mononen
90b9339cda StateTree fixes
- Fixed unset index check in UStateTree::Link() and FStateTreeExecutionContext
- Changed FStateTreeExecutionContext to call ExitState() from leaf-to-root
- Fixed handling of empty sources in FStateTreePropertyBindings::CopyTo()

#jira none
#review
#preflight 6273c1005b05fb4f601353b4

[CL 20056497 by mikko mononen in ue5-main branch]
2022-05-05 08:44:57 -04:00
Yoan StAmant
fba345e98b [StateTree ] added Delay and DebugText tasks
#rnx
#rb mikko.mononen
#preflight 627115a3f96717d2a1f3ebc2

[CL 20023815 by Yoan StAmant in ue5-main branch]
2022-05-03 08:30:05 -04:00
Yoan StAmant
f4f130cbae GameplatStateTree Plugin
- moved StateTreeBrainComponent (from StateTreeModule) and renamed StateTreeComponent
- added FStateTreeTaskCommonBase (similar to FStateTreeTaskCommonCondition)
#rnx
#rb mikko.mononen
#preflight 626fd50d645c64f3a236325a

[CL 20007596 by Yoan StAmant in ue5-main branch]
2022-05-02 09:15:14 -04:00
mikko mononen
f6770cf154 StateTree: Parametrized states
- Added specific "subtree" states which can be linked to via a "linked" state
- Subtrees can only bind data back to the their root state (or tree "global" data)
- Added property bag based parameters to subtree and linked states
- Update (transient) property bag structs before resolving property paths
- Linked states reflect their parameters from the state they link to
- Added property binding to and from parameters
- Relaxed the property binding to fail if the source data is not available
- Allow enter conditions to bind to tasks, and fail the expression if trying to access unaccessible data
- Added icon for linked and subtree states
- Added source type for all binding source structs
- Added UStateTreeEditorData::VisitHierarchy to simplify iterating over all states

#jira UE-147507
#rb Yoan.StAmant
#preflight 626a47182d28b9d0f77223f5

[CL 19954567 by mikko mononen in ue5-main branch]
2022-04-28 03:54:07 -04:00
bob tellez
637948f95a #StateTree Make GetActiveStateName(s) available when WITH_STATETREE_DEBUG is 0
[FYI] mikko.mononen

#ROBOMERGE-AUTHOR: bob.tellez
#ROBOMERGE-SOURCE: CL 19952052 via CL 19952055
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v943-19904690)

[CL 19953111 by bob tellez in ue5-main branch]
2022-04-28 02:19:09 -04:00
mikko mononen
44d3945983 StateTree: fix PVS warnings
- The 'TargetProperty' pointer was utilized before it was verified against nullpt
- The modification of the 'TreeDescIndex' variable is unsequenced relative to another operation on the same variable. This may lead to undefined behavior.

#jira UE-148951 UE-149238
#rb Mieszko.Zielinski
#preflight 625feaafdd47b4ad2167447e

[CL 19827521 by mikko mononen in ue5-main branch]
2022-04-20 07:19:18 -04:00
mikko mononen
6ed68b3b02 StateTree: Allow to bind StateTree source structs directly.
#jira UE-147507
#review
#preflight 6257f5e9d606fd159eb7f743

[CL 19753012 by mikko mononen in ue5-main branch]
2022-04-14 06:28:13 -04:00
Yoan StAmant
c135ebcd95 [StateTree]
+ Added StateTree parameters usable for data bindings and that could be overriden on context initialization by a StateTreeReference
+ Added StateTreeReference struct to hold a reference to a StateTree asset along with a list of values to parameterized the tree.
+ Added named external data items that are defined bt the Schema and for which values must be provided at runtime through the execution context.
+ Added delegate OnPostCompile after successful compilation. The StateTreeReference listens to it to validate its parameters
+ EditorData now contains its own version of the schema and parameters. On successful compilation they are copied over the StateTree own properties.
#rnx
#rb mikko.mononen
#preflight 6255d281647ad886b3593cb0

[CL 19727363 by Yoan StAmant in ue5-main branch]
2022-04-12 15:55:39 -04:00
Yoan StAmant
b4f64a59e0 [StateTree] external data validation from schema supported types
- fixed external requirements set by StateTreeBrainComponent to find more specific actor classes first before defaulting on AActor
- added missing supported type FMassSharedFragment for MassStateTreeSchema
- moved StateTreeLinker to it own file and handle its potential failures
#rb mikko.mononen
#rnx
#preflight 624d98fd8e5ae00f0aca3123

[CL 19646871 by Yoan StAmant in ue5-main branch]
2022-04-06 10:04:05 -04:00