Merge pull request #1222 from aws-lumberyard-dev/carlito/stabilization/2106

Carlito/stabilization/2106 fix for LYN-4098, LY-4019, LY-3777
This commit is contained in:
carlitosan
2021-06-09 16:14:41 -07:00
committed by GitHub
9 changed files with 1217 additions and 21 deletions
@@ -103,9 +103,7 @@ namespace EMotionFX
->Attribute("Hidden", AZ::Edit::Attributes::PropertyHidden)
->VirtualProperty("PlayTime", "GetPlayTime", "PlayTime")
->Event("Motion", &SimpleMotionComponentRequestBus::Events::Motion)
->Attribute(AZ::Script::Attributes::Ignore, true)
->Event("GetMotion", &SimpleMotionComponentRequestBus::Events::GetMotion)
->Attribute(AZ::Script::Attributes::Ignore, true)
->VirtualProperty("Motion", "GetMotion", "Motion")
->Event("BlendInTime", &SimpleMotionComponentRequestBus::Events::BlendInTime)
->Event("GetBlendInTime", &SimpleMotionComponentRequestBus::Events::GetBlendInTime)
@@ -70,7 +70,6 @@ namespace EMotionFX
->Attribute("Hidden", AZ::Edit::Attributes::PropertyHidden)
->VirtualProperty("PreviewInEditor", "GetPreviewInEditor", "SetPreviewInEditor")
->Event("GetAssetDuration", &EditorSimpleMotionComponentRequestBus::Events::GetAssetDuration)
->Attribute(AZ::Script::Attributes::Ignore, true)
;
behaviorContext->Class<EditorSimpleMotionComponent>()
@@ -86,7 +86,6 @@ namespace LmbrCentral
{
behaviorContext->Class<TagComponentBehaviorHelper>("Tag Helper")
->Method("Get Entities by Tag", &TagComponentBehaviorHelper::FindTaggedEntities)
->Attribute(AZ::Script::Attributes::Ignore, 0)
->Attribute(AZ::Script::Attributes::Category, "Gameplay/Tag")
->Attribute(AZ::ScriptCanvasAttributes::FloatingFunction, 0)
;
@@ -1220,8 +1220,18 @@ namespace ScriptCanvas
void GraphToLua::WriteClassPropertyRead(Grammar::ExecutionTreeConstPtr execution)
{
WriteFunctionCallInput(execution, 0, IsFormatStringInput::No);
m_dotLua.Write(".%s", Grammar::ToIdentifier(execution->GetName()).c_str());
if (execution->GetInputCount() > 0)
{
WriteFunctionCallInput(execution, 0, IsFormatStringInput::No);
m_dotLua.Write(".");
}
else
{
// it's a constant
WriteResolvedScope(execution, execution->GetNameLexicalScope());
}
m_dotLua.Write(Grammar::ToIdentifier(execution->GetName()).c_str());
}
void GraphToLua::WriteClassPropertyWrite(Grammar::ExecutionTreeConstPtr execution)
@@ -1509,20 +1519,7 @@ namespace ScriptCanvas
}
else
{
const AZStd::string resolvedScope = ResolveScope(lexicalScope.m_namespaces);
auto& abbreviation = FindAbbreviation(resolvedScope);
if (!abbreviation.empty())
{
m_dotLua.Write("%s%.*s", abbreviation.c_str(),
aznumeric_cast<int>(m_configuration.m_lexicalScopeDelimiter.size()), m_configuration.m_lexicalScopeDelimiter.data());
}
else if (!resolvedScope.empty())
{
m_dotLua.Write("%s%.*s", resolvedScope.c_str(),
aznumeric_cast<int>(m_configuration.m_lexicalScopeDelimiter.size()), m_configuration.m_lexicalScopeDelimiter.data());
}
WriteResolvedScope(execution, lexicalScope);
}
}
break;
@@ -2413,5 +2410,28 @@ namespace ScriptCanvas
}
}
void GraphToLua::WriteResolvedScope(Grammar::ExecutionTreeConstPtr execution, const Grammar::LexicalScope& lexicalScope)
{
if (lexicalScope.m_type != Grammar::LexicalScopeType::Class && lexicalScope.m_type != Grammar::LexicalScopeType::Namespace)
{
AddError(execution, aznew Internal::ParseError(execution->GetNodeId(), "Invalid arguments to WriteResolvedScope."));
return;
}
const AZStd::string resolvedScope = ResolveScope(lexicalScope.m_namespaces);
auto& abbreviation = FindAbbreviation(resolvedScope);
if (!abbreviation.empty())
{
m_dotLua.Write("%s%.*s", abbreviation.c_str(),
aznumeric_cast<int>(m_configuration.m_lexicalScopeDelimiter.size()), m_configuration.m_lexicalScopeDelimiter.data());
}
else if (!resolvedScope.empty())
{
m_dotLua.Write("%s%.*s", resolvedScope.c_str(),
aznumeric_cast<int>(m_configuration.m_lexicalScopeDelimiter.size()), m_configuration.m_lexicalScopeDelimiter.data());
}
}
}
}
@@ -160,6 +160,7 @@ namespace ScriptCanvas
void WriteOperatorArithmetic(Grammar::ExecutionTreeConstPtr execution);
void WriteOutputAssignments(Grammar::ExecutionTreeConstPtr execution);
void WriteOutputAssignments(Grammar::ExecutionTreeConstPtr execution, const AZStd::vector<AZStd::pair<const Slot*, Grammar::OutputAssignmentConstPtr>>& output);
void WriteResolvedScope(Grammar::ExecutionTreeConstPtr execution, const Grammar::LexicalScope& lexicalScope);
void WriteReturnStatement(Grammar::ExecutionTreeConstPtr execution);
void WriteReturnValueInitialization(Grammar::ExecutionTreeConstPtr execution);
void WriteStaticInitializerInput(IsLeadingCommaRequired commaRequired);
@@ -170,7 +171,6 @@ namespace ScriptCanvas
void WriteVariableWrite(Grammar::ExecutionTreeConstPtr execution, const AZStd::vector<AZStd::pair<const Slot*, Grammar::OutputAssignmentConstPtr>>& output);
void WriteWrittenMathExpression(Grammar::ExecutionTreeConstPtr execution);
private:
};
}
@@ -53,6 +53,7 @@ namespace ScriptCanvasTestingNodes
->Method("SetString", &BehaviorContextObjectTest::SetString)
->Method("GetString", &BehaviorContextObjectTest::GetString)
->Property("Name", BehaviorValueProperty(&BehaviorContextObjectTest::m_name))
->Constant("Always24", BehaviorConstant(24))
;
}
}
@@ -90,6 +90,11 @@ public:
}
};
TEST_F(ScriptCanvasTestFixture, UseBehaviorContextClassConstant)
{
RunUnitTestGraph("LY_SC_UnitTest_UseBehaviorContextClassConstant");
}
TEST_F(ScriptCanvasTestFixture, ParseFunctionIfBranchWithConnectedInput)
{
RunUnitTestGraph("LY_SC_UnitTest_ParseFunctionIfBranchWithConnectedInput");
@@ -167,6 +167,7 @@ namespace StartingPointInput
{ "actionName", "The name of the Input event action used to create an InputEventNotificationId" } } });
behaviorContext->EBus<InputEventNotificationBus>("InputEventNotificationBus")
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::List)
->Handler<BehaviorInputEventNotificationBusHandler>()
->Event("OnPressed", &InputEventNotificationBus::Events::OnPressed)
->Event("OnHeld", &InputEventNotificationBus::Events::OnHeld)