Integrating github/staging through commit b0dd7ed
This commit is contained in:
+1
-1
@@ -78,7 +78,7 @@ public: \
|
||||
{% if deprecationUuid is defined %} NodeConfiguration GetReplacementNodeConfiguration() const override; \
|
||||
{% endif %}
|
||||
using Node::FindDatum; \
|
||||
{% if Class.attrib['GraphEntryPoint'] is defined %} bool IsEntryPoint() const override { return {%if Class.attrib['GraphEntryPoint'] == True %}true{%else%}false{%endif%}; } \
|
||||
{% if Class.attrib['GraphEntryPoint'] is defined %} bool IsEntryPoint() const override { return {%if Class.attrib['GraphEntryPoint'] == "True" %}true{%else%}false{%endif%}; } \
|
||||
{% endif %}
|
||||
public: \
|
||||
friend struct ::{{ className | replace(' ','') }}Property;
|
||||
|
||||
+5
-2
@@ -171,7 +171,7 @@ bool {{ Class.attrib['QualifiedName'] }}::RequiresDynamicSlotOrdering() const
|
||||
|
||||
bool {{ Class.attrib['QualifiedName'] }}::IsDeprecated() const
|
||||
{
|
||||
return {% if Class.attrib['Deprecated'] is defined %}true{% else %}false{% endif %};
|
||||
return {% if Class.attrib['Deprecated'] is defined or Class.attrib['DeprecationUUID'] is defined %}true{% else %}false{% endif %};
|
||||
}
|
||||
|
||||
{% set deprecationUuid = Class.attrib['DeprecationUUID'] %}
|
||||
@@ -183,6 +183,9 @@ ScriptCanvas::NodeConfiguration {{ Class.attrib['QualifiedName'] }}::GetReplacem
|
||||
{% if Class.attrib['ReplacementMethodName'] is defined %}
|
||||
nodeConfig.m_methodName = "{{Class.attrib['ReplacementMethodName']}}";
|
||||
{% endif %}
|
||||
{% if Class.attrib['ReplacementClassName'] is defined %}
|
||||
nodeConfig.m_className = "{{Class.attrib['ReplacementClassName']}}";
|
||||
{% endif %}
|
||||
return nodeConfig;
|
||||
}
|
||||
{% endif %}
|
||||
@@ -225,7 +228,7 @@ void {{ Class.attrib['QualifiedName'] }}::Reflect(AZ::ReflectContext* context)
|
||||
{% if Class.attrib['Icon'] is defined %}
|
||||
->Attribute(AZ::Edit::Attributes::Icon, "{{ Class.attrib['Icon'] }}")
|
||||
{% endif %}
|
||||
{% if Class.attrib['Deprecated'] is defined %}
|
||||
{% if Class.attrib['Deprecated'] is defined or Class.attrib['DeprecationUUID'] is defined %}
|
||||
->Attribute(ScriptCanvas::Attributes::Node::TitlePaletteOverride, "DeprecatedNodeTitlePalette")
|
||||
->Attribute(AZ::Script::Attributes::Deprecated, true)
|
||||
{% else %}
|
||||
|
||||
@@ -224,6 +224,7 @@ void {{attribute_QualifiedName}}::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
behaviorContext->Class<{{ attribute_Name }}>("{{ attribute_Name }}")
|
||||
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::List)
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
|
||||
{% for inputMethod in Class.iter('Input') %}
|
||||
{% set methodName = inputMethod.attrib['Name'] %}
|
||||
// {{ inputMethod.attrib['Name'] }}
|
||||
|
||||
@@ -121,6 +121,58 @@ namespace ParsingUtilitiesCpp
|
||||
AZStd::string m_result;
|
||||
ExecutionTreeConstPtr m_marker;
|
||||
};
|
||||
|
||||
bool IsBehaviorContextProperty(const Node* node, const Slot* slot, bool checkRead, bool checkWrite)
|
||||
{
|
||||
auto methodNode = azrtti_cast<const Nodes::Core::Method*>(node);
|
||||
if (!methodNode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
auto behaviorContext = AZ::GetDefaultBehaviorContext();
|
||||
if (!behaviorContext)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
auto nameOutcome = methodNode->GetFunctionCallName(slot);
|
||||
if (!nameOutcome.IsSuccess())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
AZStd::string sanitized(nameOutcome.GetValue());
|
||||
AZ::RemovePropertyNameArtifacts(sanitized);
|
||||
|
||||
auto iter = behaviorContext->m_properties.find(sanitized);
|
||||
if (iter == behaviorContext->m_properties.end())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (checkRead && !iter->second->m_getter)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (checkWrite && !iter->second->m_setter)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsBehaviorContextPropertyRead(const Node* node, const Slot* slot)
|
||||
{
|
||||
return IsBehaviorContextProperty(node, slot, true, false);
|
||||
}
|
||||
|
||||
bool IsBehaviorContextPropertyWrite(const Node* node, const Slot* slot)
|
||||
{
|
||||
return IsBehaviorContextProperty(node, slot, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
namespace ScriptCanvas
|
||||
@@ -608,6 +660,20 @@ namespace ScriptCanvas
|
||||
&& execution->GetInput(0).m_value->m_requiresNullCheck;
|
||||
}
|
||||
|
||||
bool IsGlobalPropertyRead(ExecutionTreeConstPtr execution)
|
||||
{
|
||||
return execution->GetSymbol() == Symbol::FunctionCall
|
||||
&& execution->GetInputCount() == 0
|
||||
&& ParsingUtilitiesCpp::IsBehaviorContextPropertyRead(execution->GetId().m_node, execution->GetId().m_slot);
|
||||
}
|
||||
|
||||
bool IsGlobalPropertyWrite(ExecutionTreeConstPtr execution)
|
||||
{
|
||||
return execution->GetSymbol() == Symbol::FunctionCall
|
||||
&& execution->GetInputCount() == 0
|
||||
&& ParsingUtilitiesCpp::IsBehaviorContextPropertyWrite(execution->GetId().m_node, execution->GetId().m_slot);
|
||||
}
|
||||
|
||||
bool IsIfCondition(const ExecutionTreeConstPtr& execution)
|
||||
{
|
||||
return execution->GetId().m_node->IsIfBranch()
|
||||
|
||||
@@ -105,6 +105,10 @@ namespace ScriptCanvas
|
||||
|
||||
bool IsFunctionCallNullCheckRequired(const ExecutionTreeConstPtr& execution);
|
||||
|
||||
bool IsGlobalPropertyRead(ExecutionTreeConstPtr execution);
|
||||
|
||||
bool IsGlobalPropertyWrite(ExecutionTreeConstPtr execution);
|
||||
|
||||
bool IsIfCondition(const ExecutionTreeConstPtr& execution);
|
||||
|
||||
bool IsInfiniteSelfEntityActivationLoop(const AbstractCodeModel& model, ExecutionTreeConstPtr execution);
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
GeneratePropertyFriend="True"
|
||||
Description="adds a failure directly to the unit testing framework"
|
||||
DeprecationUUID="{E42861BD-1956-45AE-8DD7-CCFC1E3E5ACF}"
|
||||
ReplacementClassname="Unit Testing"
|
||||
ReplacementClassName="Unit Testing"
|
||||
ReplacementMethodName="Add Failure"
|
||||
>
|
||||
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
Version="0"
|
||||
GeneratePropertyFriend="True"
|
||||
DeprecationUUID="{E42861BD-1956-45AE-8DD7-CCFC1E3E5ACF}"
|
||||
ReplacementClassname="Unit Testing"
|
||||
ReplacementClassName="Unit Testing"
|
||||
ReplacementMethodName="Add Success"
|
||||
Description="adds a success directly to the unit testing framework">
|
||||
<In Name="In" Description="Input signal"/>
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
Version="0"
|
||||
GeneratePropertyFriend="True"
|
||||
DeprecationUUID="{E42861BD-1956-45AE-8DD7-CCFC1E3E5ACF}"
|
||||
ReplacementClassname="Unit Testing"
|
||||
ReplacementClassName="Unit Testing"
|
||||
ReplacementMethodName="Checkpoint"
|
||||
Description="Add a progress checkpoint for test debugging">
|
||||
<In Name="In" Description="Input signal"/>
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
VersionConverter="ScriptCanvas::UnitTesting::ExpectComparisonVersioner"
|
||||
GeneratePropertyFriend="True"
|
||||
DeprecationUUID="{C1E3C9D0-42E3-4D00-AE73-2A881E7E76A8}"
|
||||
ReplacementClassname="Unit Testing"
|
||||
ReplacementClassName="Unit Testing"
|
||||
ReplacementMethodName="Expect Equal"
|
||||
Description="Expects lhs equal to rhs">
|
||||
<In Name="In" Description="Input signal"/>
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
VersionConverter="ScriptCanvas::UnitTesting::ExpectBooleanVersioner"
|
||||
GeneratePropertyFriend="True"
|
||||
DeprecationUUID="{E42861BD-1956-45AE-8DD7-CCFC1E3E5ACF}"
|
||||
ReplacementClassname="Unit Testing"
|
||||
ReplacementClassName="Unit Testing"
|
||||
ReplacementMethodName="Expect False"
|
||||
Description="Expects a value to be false">
|
||||
<In Name="In" Description="Input signal"/>
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
VersionConverter="ScriptCanvas::UnitTesting::ExpectComparisonVersioner"
|
||||
GeneratePropertyFriend="True"
|
||||
DeprecationUUID="{C1E3C9D0-42E3-4D00-AE73-2A881E7E76A8}"
|
||||
ReplacementClassname="Unit Testing"
|
||||
ReplacementClassName="Unit Testing"
|
||||
ReplacementMethodName="Expect Greater Than"
|
||||
Description="Expects lhs to be greater than rhs">
|
||||
<In Name="In" Description="Input signal"/>
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
VersionConverter="ScriptCanvas::UnitTesting::ExpectComparisonVersioner"
|
||||
GeneratePropertyFriend="True"
|
||||
DeprecationUUID="{C1E3C9D0-42E3-4D00-AE73-2A881E7E76A8}"
|
||||
ReplacementClassname="Unit Testing"
|
||||
ReplacementClassName="Unit Testing"
|
||||
ReplacementMethodName="Expect Greater Than Equal"
|
||||
Description="Expects lhs to be greater than rhs">
|
||||
<In Name="In" Description="Input signal"/>
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
VersionConverter="ScriptCanvas::UnitTesting::ExpectComparisonVersioner"
|
||||
GeneratePropertyFriend="True"
|
||||
DeprecationUUID="{C1E3C9D0-42E3-4D00-AE73-2A881E7E76A8}"
|
||||
ReplacementClassname="Unit Testing"
|
||||
ReplacementClassName="Unit Testing"
|
||||
ReplacementMethodName="Expect Less Than"
|
||||
Description="Expects lhs to be less than rhs">
|
||||
<In Name="In" Description="Input signal"/>
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
VersionConverter="ScriptCanvas::UnitTesting::ExpectComparisonVersioner"
|
||||
GeneratePropertyFriend="True"
|
||||
DeprecationUUID="{C1E3C9D0-42E3-4D00-AE73-2A881E7E76A8}"
|
||||
ReplacementClassname="Unit Testing"
|
||||
ReplacementClassName="Unit Testing"
|
||||
ReplacementMethodName="Expect Less Than Equal"
|
||||
Description="Expects lhs to be greater than rhs">
|
||||
<In Name="In" Description="Input signal"/>
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
VersionConverter="ScriptCanvas::UnitTesting::ExpectComparisonVersioner"
|
||||
GeneratePropertyFriend="True"
|
||||
DeprecationUUID="{C1E3C9D0-42E3-4D00-AE73-2A881E7E76A8}"
|
||||
ReplacementClassname="Unit Testing"
|
||||
ReplacementClassName="Unit Testing"
|
||||
ReplacementMethodName="Expect Not Equal"
|
||||
Description="Expects lhs not equal to rhs">
|
||||
<In Name="In" Description="Input signal"/>
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
VersionConverter="ScriptCanvas::UnitTesting::ExpectBooleanVersioner"
|
||||
GeneratePropertyFriend="True"
|
||||
DeprecationUUID="{E42861BD-1956-45AE-8DD7-CCFC1E3E5ACF}"
|
||||
ReplacementClassname="Unit Testing"
|
||||
ReplacementClassName="Unit Testing"
|
||||
ReplacementMethodName="Expect True"
|
||||
Description="Expects a value to be true">
|
||||
<In Name="In" Description="Input signal"/>
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
Version="0"
|
||||
GeneratePropertyFriend="True"
|
||||
DeprecationUUID="{E42861BD-1956-45AE-8DD7-CCFC1E3E5ACF}"
|
||||
ReplacementClassname="Unit Testing"
|
||||
ReplacementClassName="Unit Testing"
|
||||
ReplacementMethodName="Mark Complete"
|
||||
Description="reports that the graph completed to the unit testing framework">
|
||||
<In Name="In" Description="Input signal"/>
|
||||
|
||||
+4
-1
@@ -388,7 +388,10 @@ namespace ScriptCanvas
|
||||
{
|
||||
AZ::ScriptCanvasAttributes::HiddenIndices uniqueIdIndex = { 0 };
|
||||
|
||||
auto builder = behaviorContext->Class<EventSender>("Unit Testing");
|
||||
auto builder = behaviorContext->Class<EventSender>("Unit Testing")
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
|
||||
;
|
||||
|
||||
builder->Method("Add Failure", &EventSender::AddFailure, { { {"", "", behaviorContext->MakeDefaultValue(UniqueId)}, {"Report", "additional notes for the test report"} } })
|
||||
->Attribute(AZ::ScriptCanvasAttributes::HiddenParameterIndex, uniqueIdIndex)
|
||||
->Method("Add Success", &EventSender::AddSuccess, { { {"", "", behaviorContext->MakeDefaultValue(UniqueId)}, {"Report", "additional notes for the test report"} } })
|
||||
|
||||
@@ -237,6 +237,13 @@ namespace ScriptCanvas
|
||||
writer.Indent();
|
||||
}
|
||||
|
||||
AZStd::string GraphToLua::SanitizeFunctionCallName(AZStd::string_view name)
|
||||
{
|
||||
AZStd::string sanitized(name);
|
||||
AZ::RemovePropertyNameArtifacts(sanitized);
|
||||
return Grammar::ToIdentifier(sanitized);
|
||||
}
|
||||
|
||||
AZ::Outcome<TargetResult, ErrorList> GraphToLua::Translate(const Grammar::AbstractCodeModel& model)
|
||||
{
|
||||
GraphToLua translation(model);
|
||||
@@ -626,6 +633,10 @@ namespace ScriptCanvas
|
||||
{
|
||||
WriteEventDisconnectCall(execution, PostDisconnectAction::SetToNil);
|
||||
}
|
||||
else if (Grammar::IsGlobalPropertyRead(execution))
|
||||
{
|
||||
WriteGlobalPropertyRead(execution);
|
||||
}
|
||||
else
|
||||
{
|
||||
const bool isNullCheckRequired = Grammar::IsFunctionCallNullCheckRequired(execution);
|
||||
@@ -1765,7 +1776,12 @@ namespace ScriptCanvas
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void GraphToLua::WriteGlobalPropertyRead(Grammar::ExecutionTreeConstPtr execution)
|
||||
{
|
||||
m_dotLua.WriteLine(SanitizeFunctionCallName(execution->GetName()));
|
||||
}
|
||||
|
||||
void GraphToLua::WriteHeader()
|
||||
{
|
||||
// no one will ever the see header or the do not modify, so these will not be necessary
|
||||
|
||||
@@ -60,7 +60,8 @@ namespace ScriptCanvas
|
||||
enum class IsNamed { No, Yes };
|
||||
|
||||
static IsNamed IsInputNamed(Grammar::VariableConstPtr input, Grammar::ExecutionTreeConstPtr execution);
|
||||
|
||||
static AZStd::string SanitizeFunctionCallName(AZStd::string_view name);
|
||||
|
||||
RuntimeInputs m_runtimeInputs;
|
||||
BuildConfiguration m_executionConfig = BuildConfiguration::Release;
|
||||
FunctionBlockConfig m_functionBlockConfig = FunctionBlockConfig::Ignored;
|
||||
@@ -143,6 +144,7 @@ namespace ScriptCanvas
|
||||
void WriteFunctionCallNullCheckPost(Grammar::ExecutionTreeConstPtr execution);
|
||||
void WriteFunctionCallNullCheckPre(Grammar::ExecutionTreeConstPtr execution);
|
||||
void WriteFunctionCallOfNode(Grammar::ExecutionTreeConstPtr, AZStd::string nameOverride = "", size_t inputOverride = AZStd::numeric_limits<size_t>::max());
|
||||
void WriteGlobalPropertyRead(Grammar::ExecutionTreeConstPtr);
|
||||
void WriteHeader();
|
||||
void WriteInfiniteLoopCheckPost(Grammar::ExecutionTreeConstPtr execution);
|
||||
void WriteInfiniteLoopCheckPre(Grammar::ExecutionTreeConstPtr execution);
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "BehaviorContextUtils.h"
|
||||
|
||||
#include <AzCore/std/containers/map.h>
|
||||
#include <AzCore/RTTI/BehaviorContextUtilities.h>
|
||||
#include <ScriptCanvas/Core/GraphData.h>
|
||||
#include <ScriptCanvas/Libraries/Core/Method.h>
|
||||
|
||||
@@ -245,23 +246,13 @@ namespace ScriptCanvas
|
||||
}
|
||||
else
|
||||
{
|
||||
// The method is not in the behaviorContext Global Methods, so check the Global Properties
|
||||
for (auto [propertyName, behaviorProperty] : behaviorContext->m_properties)
|
||||
AZStd::string propertyName(methodName);
|
||||
AZ::RemovePropertyNameArtifacts(propertyName);
|
||||
|
||||
auto iter = behaviorContext->m_properties.find(propertyName);
|
||||
if (iter != behaviorContext->m_properties.end())
|
||||
{
|
||||
AZStd::string getterName = AZStd::string::format("%s::Getter", methodName.data());
|
||||
AZStd::string setterName = AZStd::string::format("%s::Setter", methodName.data());
|
||||
|
||||
if (behaviorProperty->m_getter && (behaviorProperty->m_getter->m_name == methodName || behaviorProperty->m_getter->m_name == getterName))
|
||||
{
|
||||
method = behaviorProperty->m_getter;
|
||||
break;
|
||||
}
|
||||
if (behaviorProperty->m_setter && (behaviorProperty->m_setter->m_name == methodName || behaviorProperty->m_setter->m_name == setterName))
|
||||
{
|
||||
method = behaviorProperty->m_setter;
|
||||
break;
|
||||
}
|
||||
|
||||
method = iter->second->m_getter ? iter->second->m_getter : iter->second->m_setter;
|
||||
}
|
||||
|
||||
if (!method)
|
||||
|
||||
Reference in New Issue
Block a user