add compiler flag for object stream support of SC editor assets

Signed-off-by: chcurran <82187351+carlitosan@users.noreply.github.com>
This commit is contained in:
chcurran
2021-08-18 10:56:02 -07:00
parent 1ad182105b
commit b813f2fbf4
13 changed files with 46 additions and 6 deletions
@@ -210,7 +210,9 @@ void {{ Class.attrib['QualifiedName'] }}::Reflect(AZ::ReflectContext* context)
{
serializeContext->Class<{{ Class.attrib['QualifiedName'] }}, {{ baseClass }}>()
{% if Class.attrib['EventHandler'] is defined %}
#if defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)////
->EventHandler<{{ Class.attrib['EventHandler'] }}>()
#endif//defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)
{% endif %}
{% if Class.attrib['Version'] is defined %}
->Version({{ Class.attrib['Version'] }}{% if Class.attrib['VersionConverter'] is defined %}, &{{ Class.attrib['VersionConverter'] }}{% endif %})
@@ -160,7 +160,9 @@ void {{attribute_QualifiedName}}::Reflect(AZ::ReflectContext* context)
{
{% if ExtendReflectionSerialize is defined %} auto {{preSerialize}} = {% else %} {% endif %}serializeContext->Class<{{ attribute_Name }}{% if attribute_Base is defined %}, {{ attribute_Base }}{% endif %}>(){{postSerialize}}
{% if attribute_EventHandler is defined %}
#if defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)////
{{preSerialize}}->EventHandler<{{ attribute_EventHandler }}>(){{postSerialize}}
#endif//defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)
{% endif %}
{# Serialized Properties #}
@@ -2056,11 +2056,6 @@ namespace ScriptCanvas
}
}
void Datum::OnReadBegin()
{
OnSerializeBegin();
}
void Datum::OnDeserialize()
{
if (m_type.GetType() == Data::eType::BehaviorContextObject)
@@ -2084,10 +2079,17 @@ namespace ScriptCanvas
}
}
#if defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)////
void Datum::OnReadBegin()
{
OnSerializeBegin();
}
void Datum::OnWriteEnd()
{
OnSerializeEnd();
}
#endif//defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)
void Datum::Reflect(AZ::ReflectContext* reflection)
{
@@ -2095,7 +2097,9 @@ namespace ScriptCanvas
{
serializeContext->Class<Datum>()
->Version(DatumHelpers::Version::Current, &DatumHelpers::VersionConverter)
#if defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)////
->EventHandler<SerializeContextEventHandler>()
#endif//defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)
->Field("m_isUntypedStorage", &Datum::m_isOverloadedStorage)
->Field("m_type", &Datum::m_type)
->Field("m_originality", &Datum::m_originality)
@@ -236,6 +236,7 @@ namespace ScriptCanvas
}
};
#if defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)////
class SerializeContextEventHandler : public AZ::SerializeContext::IEventHandler
{
public:
@@ -253,6 +254,7 @@ namespace ScriptCanvas
datum->OnWriteEnd();
}
};
#endif//defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)
friend class SerializeContextEventHandler;
@@ -353,10 +355,12 @@ namespace ScriptCanvas
void OnSerializeBegin() override;
void OnDeserialize() override;
#if defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)////
void OnReadBegin();
void OnWriteEnd();
#endif//defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)
AZ_INLINE bool SatisfiesTraits(AZ::u8 behaviorValueTraits) const;
@@ -19,6 +19,7 @@ namespace AZ
namespace ScriptCanvas
{
#if defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)////
class GraphDataEventHandler : public AZ::SerializeContext::IEventHandler
{
public:
@@ -28,6 +29,7 @@ namespace ScriptCanvas
reinterpret_cast<GraphData*>(classPtr)->OnDeserialized();
}
};
#endif//defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)
void GraphData::Reflect(AZ::ReflectContext* context)
{
@@ -40,7 +42,9 @@ namespace ScriptCanvas
serializeContext->Class<GraphData>()
->Version(4, &GraphData::VersionConverter)
#if defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)////
->EventHandler<GraphDataEventHandler>()
#endif//defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)
->Field("m_nodes", &GraphData::m_nodes)
->Field("m_connections", &GraphData::m_connections)
->Field("m_dependentAssets", &GraphData::m_dependentAssets)
@@ -60,6 +60,7 @@ namespace ScriptCanvas
// Node
/////////
#if defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)////
class NodeEventHandler
: public AZ::SerializeContext::IEventHandler
{
@@ -70,6 +71,7 @@ namespace ScriptCanvas
node->OnDeserialize();
}
};
#endif//defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)
bool NodeVersionConverter(AZ::SerializeContext& context, AZ::SerializeContext::DataElementNode& nodeElementNode)
{
@@ -420,7 +422,9 @@ namespace ScriptCanvas
serializeContext->RegisterGenericType<AZStd::unordered_map<SlotId, Deprecated::VariableInfo>>();
serializeContext->Class<Node, AZ::Component>()
#if defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)////
->EventHandler<NodeEventHandler>()
#endif//defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)
->Version(NodeCpp::Version::Current, &NodeVersionConverter)
->Field("Slots", &Node::m_slots)
->Field("Datums", &Node::m_slotDatums)
@@ -63,6 +63,7 @@ namespace ScriptCanvas
struct BehaviorContextMethodHelper;
#if defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)////
template<typename t_Class>
class SerializeContextReadWriteHandler : public AZ::SerializeContext::IEventHandler
{
@@ -126,6 +127,7 @@ namespace ScriptCanvas
deserializedObject->OnWriteEnd();
}
};
#endif//defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)
// List of slots that will be create visual only slots on the nodes.
// Useful for special configurations or editor only concepts.
@@ -614,10 +614,12 @@ namespace ScriptCanvas
Node::OnDeserialize();
}
#if defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)////
void EBusEventHandler::OnWriteEnd()
{
OnDeserialize();
}
#endif//defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)
NodeTypeIdentifier EBusEventHandler::GetOutputNodeType(const SlotId& slotId) const
{
@@ -140,7 +140,9 @@ namespace ScriptCanvas
void OnDeserialize();
#if defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)////
void OnWriteEnd();
#endif//defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)
AZStd::string GetNodeName() const override
{
@@ -771,10 +771,12 @@ namespace ScriptCanvas
Node::OnDeserialize();
}
#if defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)////
void Method::OnWriteEnd()
{
OnDeserialize();
}
#endif//defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)
bool Method::BranchesOnResult() const
{
@@ -838,7 +840,9 @@ namespace ScriptCanvas
{
serializeContext->Class<Method, Node>()
->Version(MethodCPP::eVersion::Current, &MethodCPP::MethodVersionConverter)
#if defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)////
->EventHandler<SerializeContextOnWriteEndHandler<Method>>()
#endif//defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)
->Field("methodType", &Method::m_methodType)
->Field("methodName", &Method::m_lookupName)
->Field("className", &Method::m_className)
@@ -109,7 +109,9 @@ namespace ScriptCanvas
void OnDeserialize();
#if defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)////
void OnWriteEnd();
#endif//defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)
virtual bool IsMethodOverloaded() const { return false; }
@@ -60,7 +60,9 @@ namespace ScriptCanvas
{
serializeContext->Class<MethodOverloaded, Method>()
->Version(MethodOverloadedCpp::Version::Current, &MethodOverloadedVersionConverter)
#if defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)////
->EventHandler<SerializeContextReadWriteHandler<MethodOverloaded>>()
#endif//defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)
->Field("orderedInputSlotIds", &MethodOverloaded::m_orderedInputSlotIds)
->Field("outputSlotIds", &MethodOverloaded::m_outputSlotIds)
;
@@ -397,6 +399,7 @@ namespace ScriptCanvas
return signature;
}
#if defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)////
void MethodOverloaded::OnWriteBegin()
{
}
@@ -405,6 +408,7 @@ namespace ScriptCanvas
{
OnDeserialize();
}
#endif//defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)
void MethodOverloaded::OnDeserialize()
{
@@ -33,7 +33,9 @@ namespace ScriptCanvas
, public OverloadContractInterface
{
private:
#if defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)////
friend class SerializeContextReadWriteHandler<MethodOverloaded>;
#endif//defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)
public:
static void Reflect(AZ::ReflectContext* reflectContext);
@@ -91,12 +93,14 @@ namespace ScriptCanvas
// \todo make execution thread sensitive, which can then support generic programming
Grammar::FunctionPrototype GetInputSignature() const;
#if defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)////
// SerializeContextReadWriteHandler
void OnReadBegin() {}
void OnReadEnd() {}
void OnWriteBegin();
void OnWriteEnd();
#endif//defined(OBJECT_STREAM_EDITOR_ASSET_LOADING_SUPPORT_ENABLED)
void OnDeserialize() override;