Merge pull request #3964 from aws-lumberyard-dev/carlitosan/development
Upgrades and stability fixes for version explorer
This commit is contained in:
@@ -135,8 +135,19 @@ namespace ScriptCanvas
|
||||
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<VersionData>()
|
||||
->Version(2, [](AZ::SerializeContext& context, AZ::SerializeContext::DataElementNode& classElement)
|
||||
{
|
||||
if (classElement.GetVersion() < 2)
|
||||
{
|
||||
FileVersion fileVersion = ScriptCanvas::FileVersion::Initial;
|
||||
classElement.AddElementWithData(context, "_fileVersion", fileVersion);
|
||||
}
|
||||
|
||||
return true;
|
||||
})
|
||||
->Field("_grammarVersion", &VersionData::grammarVersion)
|
||||
->Field("_runtimeVersion", &VersionData::runtimeVersion)
|
||||
->Field("_fileVersion", &VersionData::fileVersion)
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -152,6 +163,7 @@ namespace ScriptCanvas
|
||||
{
|
||||
grammarVersion = GrammarVersion::Current;
|
||||
runtimeVersion = RuntimeVersion::Current;
|
||||
fileVersion = FileVersion::Current;
|
||||
}
|
||||
|
||||
void ReflectEventTypeOnDemand(const AZ::TypeId& typeId, AZStd::string_view name, AZ::IRttiHelper* rttiHelper)
|
||||
|
||||
@@ -57,6 +57,8 @@ namespace ScriptCanvas
|
||||
constexpr const char* k_OnVariableWriteEventName = "OnVariableValueChanged";
|
||||
constexpr const char* k_OnVariableWriteEbusName = "VariableNotification";
|
||||
|
||||
constexpr const AZStd::string_view k_VersionExplorerWindow = "VersionExplorerWindow";
|
||||
|
||||
class Node;
|
||||
class Edge;
|
||||
|
||||
@@ -69,6 +71,13 @@ namespace ScriptCanvas
|
||||
using NodePtrList = AZStd::vector<Node*>;
|
||||
using NodePtrConstList = AZStd::vector<const Node*>;
|
||||
|
||||
enum class PropertyStatus : AZ::u8
|
||||
{
|
||||
Getter,
|
||||
None,
|
||||
Setter,
|
||||
};
|
||||
|
||||
enum class GrammarVersion : int
|
||||
{
|
||||
Initial = -1,
|
||||
@@ -87,11 +96,13 @@ namespace ScriptCanvas
|
||||
Current,
|
||||
};
|
||||
|
||||
enum class PropertyStatus : AZ::u8
|
||||
enum class FileVersion : int
|
||||
{
|
||||
Getter,
|
||||
None,
|
||||
Setter,
|
||||
Initial = -1,
|
||||
JSON = 0,
|
||||
|
||||
// add new entries above
|
||||
Current,
|
||||
};
|
||||
|
||||
struct VersionData
|
||||
@@ -104,10 +115,13 @@ namespace ScriptCanvas
|
||||
|
||||
GrammarVersion grammarVersion = GrammarVersion::Initial;
|
||||
RuntimeVersion runtimeVersion = RuntimeVersion::Initial;
|
||||
FileVersion fileVersion = FileVersion::Initial;
|
||||
|
||||
bool operator == (const VersionData& rhs) const
|
||||
{
|
||||
return grammarVersion == rhs.grammarVersion && runtimeVersion == rhs.runtimeVersion;
|
||||
return grammarVersion == rhs.grammarVersion
|
||||
&& runtimeVersion == rhs.runtimeVersion
|
||||
&& fileVersion == rhs.fileVersion;
|
||||
}
|
||||
|
||||
bool IsLatest() const
|
||||
|
||||
@@ -17,5 +17,23 @@ namespace ScriptCanvas
|
||||
AZ_CVAR(bool, g_printAbstractCodeModelAtPrefabTime, false, {}, AZ::ConsoleFunctorFlags::Null, "Print out the Abstract Code Model at the end of parsing (at prefab time) for debug purposes.");
|
||||
AZ_CVAR(bool, g_saveRawTranslationOuputToFile, true, {}, AZ::ConsoleFunctorFlags::Null, "Save out the raw result of translation for debug purposes.");
|
||||
AZ_CVAR(bool, g_saveRawTranslationOuputToFileAtPrefabTime, false, {}, AZ::ConsoleFunctorFlags::Null, "Save out the raw result of translation (at prefab time) for debug purposes.");
|
||||
|
||||
SettingsCache::SettingsCache()
|
||||
{
|
||||
m_disableParseOnGraphValidation = g_disableParseOnGraphValidation;
|
||||
m_printAbstractCodeModel = g_printAbstractCodeModel;
|
||||
m_printAbstractCodeModelAtPrefabTime = g_printAbstractCodeModelAtPrefabTime;
|
||||
m_saveRawTranslationOuputToFile = g_saveRawTranslationOuputToFile;
|
||||
m_saveRawTranslationOuputToFileAtPrefabTime = g_saveRawTranslationOuputToFileAtPrefabTime;
|
||||
}
|
||||
|
||||
SettingsCache::~SettingsCache()
|
||||
{
|
||||
g_disableParseOnGraphValidation = m_disableParseOnGraphValidation;
|
||||
g_printAbstractCodeModel = m_printAbstractCodeModel;
|
||||
g_printAbstractCodeModelAtPrefabTime = m_printAbstractCodeModelAtPrefabTime;
|
||||
g_saveRawTranslationOuputToFile = m_saveRawTranslationOuputToFile;
|
||||
g_saveRawTranslationOuputToFileAtPrefabTime = m_saveRawTranslationOuputToFileAtPrefabTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,6 +248,22 @@ namespace ScriptCanvas
|
||||
AZ_CVAR_EXTERNED(bool, g_saveRawTranslationOuputToFile);
|
||||
AZ_CVAR_EXTERNED(bool, g_saveRawTranslationOuputToFileAtPrefabTime);
|
||||
|
||||
class SettingsCache
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(SettingsCache, AZ::SystemAllocator, 0);
|
||||
|
||||
SettingsCache();
|
||||
~SettingsCache();
|
||||
|
||||
private:
|
||||
bool m_disableParseOnGraphValidation;
|
||||
bool m_printAbstractCodeModel;
|
||||
bool m_printAbstractCodeModelAtPrefabTime;
|
||||
bool m_saveRawTranslationOuputToFile;
|
||||
bool m_saveRawTranslationOuputToFileAtPrefabTime;
|
||||
};
|
||||
|
||||
struct DependencyInfo
|
||||
{
|
||||
AZ::Data::AssetId assetId;
|
||||
|
||||
@@ -681,6 +681,13 @@ namespace ScriptCanvas
|
||||
outType = eventType;
|
||||
return true;
|
||||
}
|
||||
|
||||
AZ_Warning("Script Canvas"
|
||||
, !m_warnOnMissingFunction
|
||||
, "Could not find event: %s, in bus: %s, anywhere in BehaviorContext"
|
||||
, methodName.c_str()
|
||||
, m_className.c_str());
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -693,6 +700,12 @@ namespace ScriptCanvas
|
||||
outType = EventType::Count;
|
||||
return true;
|
||||
}
|
||||
|
||||
AZ_Warning("Script Canvas"
|
||||
, !m_warnOnMissingFunction
|
||||
, "Could not find free method: %s anywhere in BehaviorContext"
|
||||
, methodName.c_str());
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -709,15 +722,27 @@ namespace ScriptCanvas
|
||||
outType = EventType::Count;
|
||||
return true;
|
||||
}
|
||||
|
||||
AZ_Warning("Script Canvas"
|
||||
, !m_warnOnMissingFunction
|
||||
, "Could not find method or property: %s in class %s: , anywhere in BehaviorContext"
|
||||
, methodName.c_str()
|
||||
, m_className.c_str());
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
AZ_Warning("Script Canvas", !m_warnOnMissingFunction, "unsupported method type in method");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
AZ_Warning("Script Canvas"
|
||||
, !m_warnOnMissingFunction
|
||||
, "Could not find overloaded method: %s, class or event name: %s, anywhere in BehaviorContext"
|
||||
, methodName.c_str()
|
||||
, m_className.c_str());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -353,7 +353,7 @@ namespace ScriptCanvas
|
||||
|
||||
AZStd::optional<size_t> ReceiveScriptEvent::GetEventIndex(AZStd::string eventName) const
|
||||
{
|
||||
return m_handler->GetFunctionIndex(eventName.c_str());;
|
||||
return m_handler ? AZStd::optional<size_t>(m_handler->GetFunctionIndex(eventName.c_str())) : AZStd::nullopt;
|
||||
}
|
||||
|
||||
AZStd::vector<SlotId> ReceiveScriptEvent::GetEventSlotIds() const
|
||||
@@ -556,29 +556,6 @@ namespace ScriptCanvas
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReceiveScriptEvent::SetupHandler()
|
||||
{
|
||||
if (!m_handler)
|
||||
{
|
||||
if (!m_asset.IsReady() && m_scriptEventAssetId.IsValid())
|
||||
{
|
||||
m_asset = AZ::Data::AssetManager::Instance().GetAsset<ScriptEvents::ScriptEventsAsset>(m_scriptEventAssetId, AZ::Data::AssetLoadBehavior::PreLoad);
|
||||
m_asset.BlockUntilLoadComplete();
|
||||
CreateHandler(m_asset);
|
||||
CreateEbus();
|
||||
}
|
||||
|
||||
if (!m_handler)
|
||||
{
|
||||
AZStd::string error = AZStd::string::format("Script Event receiver node was not initialized (%s)!", m_definition.GetName().c_str());
|
||||
SCRIPTCANVAS_REPORT_ERROR((*this), error.c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReceiveScriptEvent::IsOutOfDate(const VersionData& graphVersion) const
|
||||
{
|
||||
AZ_UNUSED(graphVersion);
|
||||
|
||||
@@ -88,7 +88,6 @@ namespace ScriptCanvas
|
||||
private:
|
||||
|
||||
bool CreateEbus();
|
||||
bool SetupHandler();
|
||||
|
||||
AZ::BehaviorEBusHandler* m_handler = nullptr;
|
||||
AZ::BehaviorEBus* m_ebus = nullptr;
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace AZ
|
||||
{
|
||||
listeners->push_back(outputDatum);
|
||||
}
|
||||
|
||||
|
||||
return context.Report(result, result.GetProcessing() != JSR::Processing::Halted
|
||||
? "DatumSerializer Load finished loading Datum"
|
||||
: "DatumSerializer Load failed to load Datum");
|
||||
@@ -145,13 +145,13 @@ namespace AZ
|
||||
|
||||
auto inputScriptDataPtr = reinterpret_cast<const Datum*>(inputValue);
|
||||
auto defaultScriptDataPtr = reinterpret_cast<const Datum*>(defaultValue);
|
||||
|
||||
|
||||
if (defaultScriptDataPtr)
|
||||
{
|
||||
if (*inputScriptDataPtr == *defaultScriptDataPtr)
|
||||
{
|
||||
return context.Report
|
||||
( JSR::Tasks::WriteValue, JSR::Outcomes::DefaultsUsed, "DatumSerializer Store used defaults for Datum");
|
||||
(JSR::Tasks::WriteValue, JSR::Outcomes::DefaultsUsed, "DatumSerializer Store used defaults for Datum");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user