This translates all usages of MCore::Array to AZStd::vector. It is
designed to be as minimal of a change as possible (no changing to
range-for loops or other C++11 stuff).
We can decide to submit this wholesale, or submit it to a separate
branch that we can then integrate individual files from once we're ready
to do a specific class's transition.
It does not completely solve the `uint32`->`size_t` transition.
One important finding from doing this: `MCore::Array` uses a `memcpy`
when it reallocates. `AZStd::vector` will use the contained type's copy
or move constructor, per element. This is a significant change in
behavior. If you have type, `SomeStruct` that defines a destructor, that
type is copyable and not movable. So if you have a
`MCore::Array<SomeStruct>`, and you call `Add(); Add(); Add()`, that
reallocates 3 times, copying the contents using `memcpy`, and never
invokes `SomeStruct`'s copy constructor or destructor. Translating that
to `AZStd::vector<SomeStruct>` and calling `push_back(); push_back();
push_back();` will still reallocate 3 times, but it sees that
`SomeStruct` is non-movable, and uses the copy constructor to make the
copies, and then the destructor on the previous values. This call to the
destructor wasn't there before, and can cause things to be deleted that
weren't before. The solution to this is to make that struct be a
move-only type. Where possible, this was done by changing that type to
use `AZStd::unique_ptr` instead of a raw pointer, to get the proper move
behavior. Where that is not possible (types that inherit from
`MCore::MemoryObject`), a hand-written move constructor was created.
In general:
GetLength() becomes size()
GetMaxLength() becomes capacity()
GetIsEmpty() becomes empty()
Reserve() becomes reserve()
ReserveExact() becomes reserve()
Resize() becomes resize()
ResizeFast() becomes resize_no_construct()
Add() becomes emplace_back()
AddExact() becomes emplace_back()
AddEmpty() becomes emplace_back()
AddEmptyExact() becomes emplace_back()
GetPtr() becomes data()
GetItem() becomes at()
Shrink() becomes shrink_to_fit()
GetFirst() becomes front()
GetLast() becomes back()
Remove() becomes erase()
RemoveFirst() becomes erase()
RemoveLast() becomes pop_back()
RemoveByValue() becomes if (const auto it = AZStd::find(...); it != end(container)) container.erase(it);
Insert() becomes emplace()
Swap() becomes swap()
Clear(true) becomes clear(); shrink_to_fit()
Clear() becomes clear(); shrink_to_fit()
Clear(false) becomes clear()
Swap() becomes swap()
Find() becomes AZStd::find
MoveElements() becomes AZStd::move
SetMemoryCategory() is removed
Signed-off-by: Chris Burel <burelc@amazon.com>
* Removed collision mesh based AABB rendering.
* Ported to AZ::Aabb
* Reduced the number of triangles used for rendering default spheres for joints to improve rendering times.
Signed-off-by: Benjamin Jillich <jillich@amazon.com>
Relying on the command system's string processing syntax prevents certain
names from being used. This converts the AdjustNodeGroup command to be
directly invokable, so that arguments can be passed directly, instead of
going through the CommandLine string parsing.
Signed-off-by: Chris Burel <burelc@amazon.com>
Relying on the command system's string processing syntax prevents certain
names from being used. This converts the AnimGraphAdjustNodeGroup command
to be directly invokable, so that arguments can be passed directly, instead
of going through the CommandLine string parsing.
Signed-off-by: Chris Burel <burelc@amazon.com>
* Fixed a bug with updating the static aabb for actors. It called that before the mesh was loaded resulting in an invalid aabb.
* Ported a few more places to AZ::Aabb from MCore::AABB
Signed-off-by: Benjamin Jillich <jillich@amazon.com>
* Fixed the emplace function implementations for stack and queue
Cleaned up several functions in the stack, queue and priority_queue
classes that were non-standard or weren't needed.
Updated the "style" of the code to use more modern concepts: "typedef" ->
"using", empty constructor body -> default keyword.
Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
* Replaced the custom implementations of AZStd stack, (proirity)queue
Theses classes now have a template alias to the standard library version
of the classes
Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
User provided model was exporting correctly with an .assetinfo while it was not when just placing the .fbx file in the project folder.
Turned out that the best matching root bone was set by opening the Scene Settings for the first time, so after saving it again it worked correctly.
We're now chosing the best matching root bone when initializing the actor group, which fixes the issue.
Signed-off-by: Benjamin Jillich <jillich@amazon.com>
* Fixing user asset issue having a transform node as root rather than a bone making the whole character not animate.
* Enabled the ability to export animations for transform nodes.
Signed-off-by: Benjamin Jillich <jillich@amazon.com>
* User provided animation resulted in a data integrity error.
* The first track had 0.66 as max time while another had a keyframe more resulting in 0.69.
* When updating the duration before fixing up the last keyframe for each of the tracks, the duration was returned early with 0.66 while there were other tracks having a keyframe more.
* We're now crawling through all tracks to determine the maximum duration.
* This results in a correct fixup of the last frame.
Signed-off-by: Benjamin Jillich <jillich@amazon.com>
* Fix compile error from -Wwritable-strings
Signed-off-by: Chris Burel <burelc@amazon.com>
* Fix flags used to build MaskedOcclusionCulling with clang
Signed-off-by: Chris Burel <burelc@amazon.com>
* Fix class that has a final destructor, but the class itself was not final
Signed-off-by: Chris Burel <burelc@amazon.com>
* Final update copyright headers to reference license files at the repo root
Signed-off-by: spham <spham@amazon.com>
* Fix copyright validator unit tests to support the stale O3DE header scenario
Signed-off-by: spham <spham@amazon.com>
-Re-purposed an unused boolean in RPI::Cullable for previous frame's visiblity to instead represent objects that are hidden in the simulation.
-Updated MeshFeatureProcessor::SetVisible to set this value on the cullable.
-Updated the MeshComponent to handle visiblity changes by not rendering the mesh instead of deactivating and/or reactivating the component.
-Updated the AtomActorInstance to handle changes to the visibility from the ActorComponent.
Tested by creating two entities with static mesh components, on entity hidden and the other visible. Plus three entities with actor components, one where the actor is visible, one where the entity is visible but the 'render character' setting on the actor component is disabled, and one where the 'render character' setting is enabled, but the entity is not visible.
For each of these 5 entities, I added them as 5 loose entities, 5 entities that were children to a parent entity, and a slice with all 5 as children to a parent entity, and tested toggling visibility of the parent entities.
For each of these 3 sets of 5 entities, I added them directly to the level, added them all to a layer where the layer was visible, and added them all to a layer where the layer was not visible, and tested toggling the visibility of the layers.
* Fixes saving motions from within the Animation Editor
* Fixes saving actors from within the Animation Editor
* The motion event chunk of the .motion file format now also stores the event data as json (rather than XML) reducing motion file sizes (Example: 60KB motion went down to 49KB, containing only 4 motion events from 2 tracks).
* Fully backward compatible
* New motion meta data rule stores the event data directly rather than command strings or objects. This is the way that aligns with the Json paradigm and as side-effect bypasses the optionals that we use for the commands which fixes the issue.
* [LYN-4574] Adding new motion event meta data rule that stores the event data directly rather than via commands to align with the Json paradigm
* [LYN-4574] Preparing motion, event table and event track for Json serialization
* [LYN-4574] New chunk to store motion event data in Json format (fully backward compatible to XML)
* [LYN-4669] Json: Empty AZStd::vector<AZStd::shared_ptr<T>> serializes into 1x element with nullptr as data
* [LYN-4603] EMotion FX: Cannot save actors with physics or simulated object setup in Json format
`size_t` is a typedef that is sized differently on different platforms.
Instead, use `AZ::u64`, which is large enough to hold all platforms'
`size_t` types but is a fixed size, to avoid size mismatches per
platform.
* Before we were skipping actors in case there was animation data present in the source asset to avoid having many duplicated actors.
* There was an issue though for simple test fbx files containing a full character with a test motion.
* The new rule is that we will be exporting actors on default whenever there is a skeleton including either skinning data or morph targets, as these usually are not included for animation assets to not increase disk space heavily.
* Tested with several of our assets and always showed the expected behavior with the new way.
* Expose Actor bounding box configurations to component serialize and edit contexts.
Allows one, for example, to have an animation which moves the character far away from the static bounds, and not have that character dissapear when the static bounds are outside of the camera frustum
* Apply suggestions from code review
* Bug fix: name the parameter, place comments in the intended place.
* [LYN-3481] Added new actor instance request and notification buses
* [LYN-3481] Actor instance notifies bus about it being created or destroyed
* [LYN-3481] Selection lists are now automatically removing destroyed actor instances
* [LYN-3481] Morph targets window plugin reinitializing when used actor instance got destroyed
* [LYN-3481] Removing the OnDeleteActorInstance() from the emfx event handler/manager and porting the recorder to the new actor instance bus
* [LYN-3481] Removed the create actor instance calls from the event handler/manager
* [LYN-3481] Fixing automated tests
* [LYN-3481] Added new actor instance request and notification buses
* [LYN-3481] Actor instance notifies bus about it being created or destroyed
* [LYN-3481] Selection lists are now automatically removing destroyed actor instances
* [LYN-3481] Morph targets window plugin reinitializing when used actor instance got destroyed
* [LYN-3481] Removing the OnDeleteActorInstance() from the emfx event handler/manager and porting the recorder to the new actor instance bus
* [LYN-3481] Removed the create actor instance calls from the event handler/manager
* [LYN-3481] Fixing automated tests
* [LYN-3727] Actor Draw Bounds Draw Bounds & [LYN-3725] Actor Draw Skeleton Doesn't Draw Skeleton
* Added skeleton, aabb and emfx debug drawing to the actor component.
* Aux geom rendering is flickering as also reported in the Discord channels. Trick with using the scene notification bus did not work as the actor instance is not bound to a given scene as far as I am aware.
We're opening the Animation Editor now also in case no actor has been chosen yet. In this case the Animation Editor will also just be started without loading any assets.
The actor dirty flag was set to true even after saving the asset info which resulted in the save dirty files dialog to appear providing the user to save the actor another time, just after saving it which is confusing. This might have led to rendering an already deleted actor and the crash. Though, I was not able to stably reproduce the issue and can't reproduce it anymore after this fix.
- Invalidate 'Physics Materials From Mesh' boolean from collider component
- Removed material library from material selector. Default material library will always be used instead.
- Marking failing automated test as xfail
- Added default material to physics configuration.
- Moved material library asset from physx configuration to physics configuration, as it doesn't need to be physx specific.
- Refactor physics material system having into account that there is only one material library in the project.
- Renaming code from DefaultMaterialLibrary to MaterialLibrary.
- All queries about physics materials unified under PhysicsMaterialRequests bus.
- PhysXSystem only manages the material library asset.
- Saving and reloading the same physics material asset with different content didn't trigger a events that the material library has changed.
- Changing Physics Material Request interface to use shared_ptr instead of weak_ptr to be simpler to handle the returned materials and having a more consistent code.
- Refactored Material Manager to improve its implementation. Still following the same approach of "creating materials on the fly as they are requested", but now it's doing it consistently across the interface, with private helpers functions FindOrCreateMaterial that simplify vastly the implementation.
- Material Manager now listens to change event of material library asset and default material configuration so it updates its materials accordingly.
- Complete Material move constructor and operator.