[LYN-4574] [LYN-4603] [LYN-4669] Saving motions and actors to json-based .assetinfo files in the Animation Editor fails (#1509)
* 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 formatmain
parent
0ad6346e8b
commit
bf0816fb69
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/std/smart_ptr/make_shared.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <SceneAPI/SceneCore/DataTypes/Groups/IGroup.h>
|
||||
#include <SceneAPI/SceneCore/Events/ManifestMetaInfoBus.h>
|
||||
#include <SceneAPIExt/Rules/MotionMetaDataRule.h>
|
||||
|
||||
namespace EMotionFX::Pipeline::Rule
|
||||
{
|
||||
void MotionMetaData::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
if (!serializeContext)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
serializeContext->Class<MotionMetaData>()
|
||||
->Version(1)
|
||||
->Field("motionEventTable", &MotionMetaData::m_motionEventTable)
|
||||
->Field("motionExtractionFlags", &MotionMetaData::m_motionExtractionFlags)
|
||||
;
|
||||
}
|
||||
|
||||
MotionMetaDataRule::MotionMetaDataRule()
|
||||
: ExternalToolRule<MotionMetaData>()
|
||||
{
|
||||
}
|
||||
|
||||
MotionMetaDataRule::MotionMetaDataRule(const MotionMetaData& data)
|
||||
: MotionMetaDataRule()
|
||||
{
|
||||
m_data = data;
|
||||
}
|
||||
|
||||
void MotionMetaDataRule::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
if (serializeContext)
|
||||
{
|
||||
serializeContext->Class<MotionMetaDataRule>()
|
||||
->Version(1)
|
||||
->Field("data", &MotionMetaDataRule::m_data)
|
||||
;
|
||||
}
|
||||
}
|
||||
} // EMotionFX::Pipeline::Rule
|
||||
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <EMotionFX/Source/MotionEventTable.h>
|
||||
#include <SceneAPI/SceneCore/DataTypes/Rules/IRule.h>
|
||||
#include <SceneAPI/SceneData/SceneDataConfiguration.h>
|
||||
#include <SceneAPIExt/Rules/ExternalToolRule.h>
|
||||
|
||||
namespace EMotionFX::Pipeline::Rule
|
||||
{
|
||||
struct MotionMetaData
|
||||
{
|
||||
AZ_RTTI(EMotionFX::Pipeline::Rule::MotionMetaData, "{A381A915-3CB3-4F60-82B3-70865CFA1F4F}");
|
||||
AZ_CLASS_ALLOCATOR(MotionMetaData, AZ::SystemAllocator, 0)
|
||||
|
||||
MotionMetaData() = default;
|
||||
virtual ~MotionMetaData() = default;
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
EMotionFX::MotionEventTable* m_motionEventTable = nullptr;
|
||||
EMotionFX::EMotionExtractionFlags m_motionExtractionFlags;
|
||||
};
|
||||
|
||||
class MotionMetaDataRule
|
||||
: public ExternalToolRule<MotionMetaData>
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(EMotionFX::Pipeline::Rule::MotionMetaDataRule, "{E68D0C3D-CBFF-4536-95C1-676474B351A5}", AZ::SceneAPI::DataTypes::IRule);
|
||||
AZ_CLASS_ALLOCATOR(MotionMetaDataRule, AZ::SystemAllocator, 0)
|
||||
|
||||
MotionMetaDataRule();
|
||||
MotionMetaDataRule(const MotionMetaData& data);
|
||||
~MotionMetaDataRule() final = default;
|
||||
|
||||
const MotionMetaData& GetData() const override { return m_data; }
|
||||
void SetData(const MotionMetaData& data) override { m_data = data; }
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
private:
|
||||
MotionMetaData m_data;
|
||||
};
|
||||
} // EMotionFX::Pipeline::Rule
|
||||
Loading…
Reference in New Issue