Merge branch 'develop' into LYN-1767-AB

This commit is contained in:
igarri
2021-06-16 12:30:10 +01:00
875 changed files with 200447 additions and 106012 deletions
@@ -360,6 +360,8 @@ namespace ScriptCanvasEditor
}
}
AzToolsFramework::ScopedUndoBatch undo("Update Entity With New SC Graph");
AzToolsFramework::ToolsApplicationRequests::Bus::Broadcast(&AzToolsFramework::ToolsApplicationRequests::Bus::Events::AddDirtyEntity, GetEntityId());
AzToolsFramework::ToolsApplicationEvents::Bus::Broadcast(&AzToolsFramework::ToolsApplicationEvents::InvalidatePropertyDisplay, AzToolsFramework::Refresh_AttributesAndValues);
}
@@ -66,6 +66,7 @@ namespace ScriptCanvasEditor
SystemComponent::~SystemComponent()
{
AzToolsFramework::UnregisterViewPane(LyViewPane::ScriptCanvas);
AzToolsFramework::EditorContextMenuBus::Handler::BusDisconnect();
AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect();
AzFramework::AssetCatalogEventBus::Handler::BusDisconnect();
AzToolsFramework::AssetSeedManagerRequests::Bus::Handler::BusDisconnect();
@@ -119,6 +120,7 @@ namespace ScriptCanvasEditor
void SystemComponent::Init()
{
AzToolsFramework::EditorEvents::Bus::Handler::BusConnect();
AzToolsFramework::EditorContextMenuBus::Handler::BusConnect();
}
void SystemComponent::Activate()
@@ -165,6 +167,8 @@ namespace ScriptCanvasEditor
options.canHaveMultipleInstances = false;
options.isPreview = true;
options.showInMenu = true;
options.showOnToolsToolbar = true;
options.toolbarIcon = ":/Menu/script_canvas_editor.svg";
AzToolsFramework::RegisterViewPane<ScriptCanvasEditor::MainWindow>(LyViewPane::ScriptCanvas, LyViewPane::CategoryTools, options);
}
@@ -22,6 +22,7 @@
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
#include <AzToolsFramework/AssetBrowser/AssetBrowserBus.h>
#include <AzToolsFramework/Editor/EditorContextMenuBus.h>
#include <Editor/Assets/ScriptCanvasAssetTracker.h>
#include <AzToolsFramework/Asset/AssetSeedManager.h>
@@ -42,6 +43,7 @@ namespace ScriptCanvasEditor
, private AZ::Data::AssetBus::MultiHandler
, private AZ::Interface<IUpgradeRequests>::Registrar
, private AzToolsFramework::AssetSeedManagerRequests::Bus::Handler
, private AzToolsFramework::EditorContextMenuBus::Handler
{
public:
AZ_COMPONENT(SystemComponent, "{1DE7A120-4371-4009-82B5-8140CB1D7B31}");
@@ -71,8 +73,12 @@ namespace ScriptCanvasEditor
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
// AztoolsFramework::EditorEvents::Bus::Handler...
// AztoolsFramework::EditorContextMenuBus::Handler...
void PopulateEditorGlobalContextMenu(QMenu* menu, const AZ::Vector2& point, int flags) override;
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
// AztoolsFramework::EditorEvents::Bus::Handler...
void NotifyRegisterViews() override;
////////////////////////////////////////////////////////////////////////
@@ -3356,23 +3356,27 @@ namespace ScriptCanvas
if (executionIf->GetId().m_node->IsIfBranchPrefacedWithBooleanExpression())
{
auto removeChildOutcome = RemoveChild(executionIf->ModParent(), executionIf);
if (!removeChildOutcome.IsSuccess())
ExecutionTreePtr booleanExpression;
{
AddError(executionIf->GetNodeId(), executionIf, ScriptCanvas::ParseErrors::FailedToRemoveChild);
auto removeChildOutcome = RemoveChild(executionIf->ModParent(), executionIf);
if (!removeChildOutcome.IsSuccess())
{
AddError(executionIf->GetNodeId(), executionIf, ScriptCanvas::ParseErrors::FailedToRemoveChild);
}
if (!IsErrorFree())
{
return;
}
const auto indexAndChild = removeChildOutcome.TakeValue();
booleanExpression = CreateChild(executionIf->ModParent(), executionIf->GetId().m_node, executionIf->GetId().m_slot);
executionIf->ModParent()->InsertChild(indexAndChild.first, { indexAndChild.second.m_slot, indexAndChild.second.m_output, booleanExpression });
executionIf->SetParent(booleanExpression);
}
if (!IsErrorFree())
{
return;
}
const auto indexAndChild = removeChildOutcome.TakeValue();
ExecutionTreePtr booleanExpression = CreateChild(executionIf->ModParent(), executionIf->GetId().m_node, executionIf->GetId().m_slot);
executionIf->ModParent()->InsertChild(indexAndChild.first, { indexAndChild.second.m_slot, indexAndChild.second.m_output, booleanExpression });
executionIf->SetParent(booleanExpression);
// make a condition here
auto symbol = CheckLogicalExpressionSymbol(booleanExpression);
if (symbol != Symbol::FunctionCall && symbol != Symbol::Count)
@@ -3402,7 +3406,7 @@ namespace ScriptCanvas
return;
}
const auto indexAndChild2 = removeChildOutcome.TakeValue();
const auto indexAndChild2 = removeChildOutcome2.TakeValue();
// parse if statement internal function
ExecutionTreePtr internalFunction = CreateChild(booleanExpression->ModParent(), booleanExpression->GetId().m_node, booleanExpression->GetId().m_slot);
@@ -4782,7 +4786,7 @@ namespace ScriptCanvas
{
PropertyExtractionPtr extraction = AZStd::make_shared<PropertyExtraction>();
extraction->m_slot = slot;
extraction->m_name = propertyField.first;
extraction->m_name = AZ::ReplaceCppArtifacts(propertyField.first);
execution->AddPropertyExtractionSource(slot, extraction);
}
else
@@ -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:
};
}