diff --git a/Gems/EMotionFX/Code/Source/Integration/Components/SimpleMotionComponent.cpp b/Gems/EMotionFX/Code/Source/Integration/Components/SimpleMotionComponent.cpp index 2e0ca16af2..633cb5ed1d 100644 --- a/Gems/EMotionFX/Code/Source/Integration/Components/SimpleMotionComponent.cpp +++ b/Gems/EMotionFX/Code/Source/Integration/Components/SimpleMotionComponent.cpp @@ -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) diff --git a/Gems/EMotionFX/Code/Source/Integration/Editor/Components/EditorSimpleMotionComponent.cpp b/Gems/EMotionFX/Code/Source/Integration/Editor/Components/EditorSimpleMotionComponent.cpp index 4b463958af..ee8a0f7821 100644 --- a/Gems/EMotionFX/Code/Source/Integration/Editor/Components/EditorSimpleMotionComponent.cpp +++ b/Gems/EMotionFX/Code/Source/Integration/Editor/Components/EditorSimpleMotionComponent.cpp @@ -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() diff --git a/Gems/LmbrCentral/Code/Source/Scripting/TagComponent.cpp b/Gems/LmbrCentral/Code/Source/Scripting/TagComponent.cpp index 931ec8041e..ad5c2e499e 100644 --- a/Gems/LmbrCentral/Code/Source/Scripting/TagComponent.cpp +++ b/Gems/LmbrCentral/Code/Source/Scripting/TagComponent.cpp @@ -86,7 +86,6 @@ namespace LmbrCentral { behaviorContext->Class("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) ; diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Translation/GraphToLua.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Translation/GraphToLua.cpp index 905f68604a..a5e9c179e6 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Translation/GraphToLua.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Translation/GraphToLua.cpp @@ -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(m_configuration.m_lexicalScopeDelimiter.size()), m_configuration.m_lexicalScopeDelimiter.data()); - } - else if (!resolvedScope.empty()) - { - m_dotLua.Write("%s%.*s", resolvedScope.c_str(), - aznumeric_cast(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(m_configuration.m_lexicalScopeDelimiter.size()), m_configuration.m_lexicalScopeDelimiter.data()); + } + else if (!resolvedScope.empty()) + { + m_dotLua.Write("%s%.*s", resolvedScope.c_str(), + aznumeric_cast(m_configuration.m_lexicalScopeDelimiter.size()), m_configuration.m_lexicalScopeDelimiter.data()); + } + } } } diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Translation/GraphToLua.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Translation/GraphToLua.h index 82c865da8c..9894a30841 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Translation/GraphToLua.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Translation/GraphToLua.h @@ -160,6 +160,7 @@ namespace ScriptCanvas void WriteOperatorArithmetic(Grammar::ExecutionTreeConstPtr execution); void WriteOutputAssignments(Grammar::ExecutionTreeConstPtr execution); void WriteOutputAssignments(Grammar::ExecutionTreeConstPtr execution, const AZStd::vector>& 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>& output); void WriteWrittenMathExpression(Grammar::ExecutionTreeConstPtr execution); - private: }; } diff --git a/Gems/ScriptCanvasTesting/Assets/ScriptCanvas/UnitTests/LY_SC_UnitTest_UseBehaviorContextClassConstant.scriptcanvas b/Gems/ScriptCanvasTesting/Assets/ScriptCanvas/UnitTests/LY_SC_UnitTest_UseBehaviorContextClassConstant.scriptcanvas new file mode 100644 index 0000000000..d80e4dcac8 --- /dev/null +++ b/Gems/ScriptCanvasTesting/Assets/ScriptCanvas/UnitTests/LY_SC_UnitTest_UseBehaviorContextClassConstant.scriptcanvas @@ -0,0 +1,1173 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Gems/ScriptCanvasTesting/Code/Source/Nodes/BehaviorContextObjectTestNode.h b/Gems/ScriptCanvasTesting/Code/Source/Nodes/BehaviorContextObjectTestNode.h index 7fa3896ff1..eba6b71169 100644 --- a/Gems/ScriptCanvasTesting/Code/Source/Nodes/BehaviorContextObjectTestNode.h +++ b/Gems/ScriptCanvasTesting/Code/Source/Nodes/BehaviorContextObjectTestNode.h @@ -53,6 +53,7 @@ namespace ScriptCanvasTestingNodes ->Method("SetString", &BehaviorContextObjectTest::SetString) ->Method("GetString", &BehaviorContextObjectTest::GetString) ->Property("Name", BehaviorValueProperty(&BehaviorContextObjectTest::m_name)) + ->Constant("Always24", BehaviorConstant(24)) ; } } diff --git a/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_RuntimeInterpreted.cpp b/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_RuntimeInterpreted.cpp index 5bda0f3941..e2665f31cf 100644 --- a/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_RuntimeInterpreted.cpp +++ b/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_RuntimeInterpreted.cpp @@ -90,6 +90,11 @@ public: } }; +TEST_F(ScriptCanvasTestFixture, UseBehaviorContextClassConstant) +{ + RunUnitTestGraph("LY_SC_UnitTest_UseBehaviorContextClassConstant"); +} + TEST_F(ScriptCanvasTestFixture, ParseFunctionIfBranchWithConnectedInput) { RunUnitTestGraph("LY_SC_UnitTest_ParseFunctionIfBranchWithConnectedInput"); diff --git a/Gems/StartingPointInput/Code/Source/StartingPointInputGem.cpp b/Gems/StartingPointInput/Code/Source/StartingPointInputGem.cpp index c08cac0188..28ca91976b 100644 --- a/Gems/StartingPointInput/Code/Source/StartingPointInputGem.cpp +++ b/Gems/StartingPointInput/Code/Source/StartingPointInputGem.cpp @@ -167,6 +167,7 @@ namespace StartingPointInput { "actionName", "The name of the Input event action used to create an InputEventNotificationId" } } }); behaviorContext->EBus("InputEventNotificationBus") + ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::List) ->Handler() ->Event("OnPressed", &InputEventNotificationBus::Events::OnPressed) ->Event("OnHeld", &InputEventNotificationBus::Events::OnHeld)