Integrating up through commit 90f050496

This commit is contained in:
alexpete
2021-04-07 14:03:29 -07:00
parent 8f2ed080a9
commit c2cbd430fe
2694 changed files with 285622 additions and 176874 deletions
@@ -40,8 +40,20 @@
#include <ScriptCanvas/Bus/RequestBus.h>
#include <ScriptCanvas/Bus/EditorScriptCanvasBus.h>
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
namespace ScriptCanvasEditor
{
const char* GraphVariablesModel::m_columnNames[static_cast<int>(ColumnIndex::Count)] =
{
"Name",
"Type",
"Default Value",
"Scope",
"Initial Value"
};
////////////////////////
// GraphVariablesModel
////////////////////////
@@ -137,6 +149,16 @@ namespace ScriptCanvasEditor
return ScriptCanvas::VariableFlags::GetScopeDisplayLabel(graphVariable->GetScope());
}
}
else if (index.column() == ColumnIndex::InitialValueSource)
{
ScriptCanvas::GraphVariable* graphVariable = nullptr;
ScriptCanvas::GraphVariableManagerRequestBus::EventResult(graphVariable, m_scriptCanvasId, &ScriptCanvas::GraphVariableManagerRequests::FindVariableById, varId.m_identifier);
if (graphVariable)
{
return graphVariable->GetInitialValueSourceName().data();
}
}
}
break;
@@ -232,6 +254,16 @@ namespace ScriptCanvasEditor
return ScriptCanvas::VariableFlags::GetScopeDisplayLabel(graphVariable->GetScope());
}
}
else if (index.column() == ColumnIndex::InitialValueSource)
{
ScriptCanvas::GraphVariable* graphVariable = nullptr;
ScriptCanvas::GraphVariableManagerRequestBus::EventResult(graphVariable, m_scriptCanvasId, &ScriptCanvas::GraphVariableManagerRequests::FindVariableById, varId.m_identifier);
if (graphVariable)
{
return graphVariable->GetInitialValueSourceName().data();
}
}
}
break;
@@ -281,6 +313,19 @@ namespace ScriptCanvasEditor
return QVariant(type.c_str());
}
}
else if (index.column() == ColumnIndex::InitialValueSource)
{
ScriptCanvas::GraphVariable* graphVariable = nullptr;
ScriptCanvas::GraphVariableManagerRequestBus::EventResult(graphVariable, m_scriptCanvasId, &ScriptCanvas::GraphVariableManagerRequests::FindVariableById, varId.m_identifier);
QString tooltipString = QString("The value of this variable can only be set within this graph");
if (graphVariable->GetInitialValueSource() == ScriptCanvas::VariableFlags::InitialValueSource::Component)
{
tooltipString = QString("The value of this variable can be set set on the component's properties");
}
return tooltipString;
}
else
{
AZStd::string variableName;
@@ -296,6 +341,7 @@ namespace ScriptCanvasEditor
return tooltipString;
}
}
break;
case Qt::DecorationRole:
@@ -381,22 +427,17 @@ namespace ScriptCanvasEditor
{
if (index.column() == ColumnIndex::Scope)
{
if (IsFunction())
{
return QStringList{
ScriptCanvas::VariableFlags::GetScopeDisplayLabel(ScriptCanvas::VariableFlags::Scope::Local),
ScriptCanvas::VariableFlags::GetScopeDisplayLabel(ScriptCanvas::VariableFlags::Scope::Input),
ScriptCanvas::VariableFlags::GetScopeDisplayLabel(ScriptCanvas::VariableFlags::Scope::Output),
ScriptCanvas::VariableFlags::GetScopeDisplayLabel(ScriptCanvas::VariableFlags::Scope::InOut)
};
}
else
{
return QStringList{
ScriptCanvas::VariableFlags::GetScopeDisplayLabel(ScriptCanvas::VariableFlags::Scope::Local),
ScriptCanvas::VariableFlags::GetScopeDisplayLabel(ScriptCanvas::VariableFlags::Scope::Input)
};
}
return QStringList{
ScriptCanvas::VariableFlags::GetScopeDisplayLabel(ScriptCanvas::VariableFlags::Scope::Graph),
ScriptCanvas::VariableFlags::GetScopeDisplayLabel(ScriptCanvas::VariableFlags::Scope::Function)
};
}
else if (index.column() == ColumnIndex::InitialValueSource)
{
return QStringList{
tr(ScriptCanvas::GraphVariable::s_InitialValueSourceNames[0]),
tr(ScriptCanvas::GraphVariable::s_InitialValueSourceNames[1])
};
}
}
break;
@@ -496,22 +537,25 @@ namespace ScriptCanvasEditor
}
}
else if (index.column() == ColumnIndex::Scope)
{
// Scope is not changed by users
}
else if (index.column() == ColumnIndex::InitialValueSource)
{
ScriptCanvas::GraphVariable* graphVariable = nullptr;
ScriptCanvas::GraphVariableManagerRequestBus::EventResult(graphVariable, m_scriptCanvasId, &ScriptCanvas::GraphVariableManagerRequests::FindVariableById, varId.m_identifier);
if (graphVariable)
{
QString exposureValue = value.toString();
QString comboBoxValue = value.toString();
if (!exposureValue.isEmpty())
if (!comboBoxValue.isEmpty())
{
ScriptCanvas::VariableFlags::Scope newScope = ScriptCanvas::VariableFlags::GetScopeFromLabel(exposureValue.toUtf8().data());
if (graphVariable->GetScope() != newScope)
if (graphVariable->GetInitialValueSourceName().compare(comboBoxValue.toUtf8().data()) != 0)
{
modifiedData = true;
graphVariable->SetScope(newScope);
graphVariable->SetInitialValueSourceFromName(comboBoxValue.toUtf8().data());
AzToolsFramework::PropertyEditorGUIMessages::Bus::Broadcast(&AzToolsFramework::PropertyEditorGUIMessages::RequestRefresh, AzToolsFramework::Refresh_EntireTree);
}
}
}
@@ -563,8 +607,11 @@ namespace ScriptCanvasEditor
}
else if (index.column() == ColumnIndex::Scope)
{
// Disabling the editing column temporarily, since the combo box doesn't work.
//itemFlags |= Qt::ItemIsEditable;
itemFlags |= Qt::ItemIsEditable;
}
else if (index.column() == ColumnIndex::InitialValueSource)
{
itemFlags |= Qt::ItemIsEditable;
}
return itemFlags;
@@ -778,6 +825,19 @@ namespace ScriptCanvasEditor
}
}
void GraphVariablesModel::OnVariableInitialValueSourceChanged()
{
const ScriptCanvas::GraphScopedVariableId* variableId = ScriptCanvas::VariableNotificationBus::GetCurrentBusId();
int index = FindRowForVariableId((*variableId).m_identifier);
if (index >= 0)
{
QModelIndex modelIndex = createIndex(index, ColumnIndex::InitialValueSource, nullptr);
dataChanged(modelIndex, modelIndex);
}
}
void GraphVariablesModel::OnVariablePriorityChanged()
{
const ScriptCanvas::GraphScopedVariableId* variableId = ScriptCanvas::VariableNotificationBus::GetCurrentBusId();
@@ -793,6 +853,16 @@ namespace ScriptCanvasEditor
}
}
QVariant GraphVariablesModel::headerData(int section, Qt::Orientation orientation, int role /*= Qt::DisplayRole*/) const
{
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
{
return tr(m_columnNames[section]);
}
return QAbstractItemModel::headerData(section, orientation, role);
}
ScriptCanvas::VariableId GraphVariablesModel::FindVariableIdForIndex(const QModelIndex& index) const
{
ScriptCanvas::VariableId variableId;
@@ -977,20 +1047,7 @@ namespace ScriptCanvasEditor
for (auto variableMapData : copiedVariableData.m_variableMapping)
{
AZ::Outcome<ScriptCanvas::VariableId, AZStd::string> variableOutcome = requests->CloneVariable(variableMapData.second);
if (isRuntimeGraph)
{
if (variableOutcome)
{
ScriptCanvas::GraphVariable* variable = requests->FindVariableById(variableOutcome.GetValue());
if (variable)
{
variable->RemoveScope(ScriptCanvas::VariableFlags::Scope::Output);
}
}
}
requests->CloneVariable(variableMapData.second);
}
GeneralRequestBus::Broadcast(&GeneralRequests::PopPreventUndoStateUpdate);
@@ -1015,12 +1072,15 @@ namespace ScriptCanvasEditor
ApplyPreferenceSort();
setItemDelegateForColumn(GraphVariablesModel::Name, aznew GraphCanvas::IconDecoratedNameDelegate(this));
setItemDelegateForColumn(GraphVariablesModel::Scope, aznew GraphCanvas::GenericComboBoxDelegate(this));
setItemDelegateForColumn(GraphVariablesModel::InitialValueSource, aznew GraphCanvas::GenericComboBoxDelegate(this));
horizontalHeader()->setStretchLastSection(false);
horizontalHeader()->setSectionResizeMode(GraphVariablesModel::Type, QHeaderView::ResizeMode::Fixed);
horizontalHeader()->setSectionResizeMode(GraphVariablesModel::Name, QHeaderView::ResizeMode::Stretch);
horizontalHeader()->setSectionResizeMode(GraphVariablesModel::DefaultValue, QHeaderView::ResizeMode::Fixed);
horizontalHeader()->setSectionResizeMode(GraphVariablesModel::Scope, QHeaderView::ResizeMode::Fixed);
horizontalHeader()->setSectionResizeMode(GraphVariablesModel::Name, QHeaderView::ResizeMode::ResizeToContents);
horizontalHeader()->setSectionResizeMode(GraphVariablesModel::DefaultValue, QHeaderView::ResizeMode::ResizeToContents);
horizontalHeader()->setSectionResizeMode(GraphVariablesModel::Type, QHeaderView::ResizeMode::Stretch);
horizontalHeader()->setSectionResizeMode(GraphVariablesModel::Scope, QHeaderView::ResizeMode::Stretch);
horizontalHeader()->setSectionResizeMode(GraphVariablesModel::InitialValueSource, QHeaderView::ResizeMode::Stretch);
horizontalHeader()->show();
{
QAction* deleteAction = new QAction(this);
@@ -1229,16 +1289,18 @@ namespace ScriptCanvasEditor
horizontalHeader()->resizeSection(GraphVariablesModel::Type, typeLength);
horizontalHeader()->resizeSection(GraphVariablesModel::DefaultValue, defaultValueLength);
int exposureLength = aznumeric_cast<int>(availableWidth * 0.2f);
int maxExposureLength = 60;
if (exposureLength >= 60)
horizontalHeader()->resizeSection(GraphVariablesModel::Scope, 100);
int remainingLength = aznumeric_cast<int>(availableWidth * 0.1f);
int maxExposureLength = 80;
if (remainingLength >= maxExposureLength)
{
exposureLength = 60;
remainingLength = maxExposureLength;
}
horizontalHeader()->resizeSection(GraphVariablesModel::Scope, exposureLength);
horizontalHeader()->resizeSection(GraphVariablesModel::InitialValueSource, 120);
}
void GraphVariablesTableView::OnCopySelected()
@@ -45,9 +45,12 @@ namespace ScriptCanvasEditor
Type,
DefaultValue,
Scope,
InitialValueSource,
Count
};
static const char* m_columnNames[static_cast<int>(ColumnIndex::Count)];
enum CustomRole
{
VarIdRole = Qt::UserRole
@@ -84,9 +87,13 @@ namespace ScriptCanvasEditor
// ScriptCanvas::VariableRuntimeNotificationBus
void OnVariableValueChanged() override;
void OnVariableScopeChanged() override;
void OnVariableInitialValueSourceChanged() override;
void OnVariablePriorityChanged() override;
////
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
ScriptCanvas::VariableId FindVariableIdForIndex(const QModelIndex& index) const;
ScriptCanvas::GraphScopedVariableId FindScopedVariableIdForIndex(const QModelIndex& index) const;
@@ -0,0 +1,233 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <precompiled.h>
#include <QAction>
#include <QCompleter>
#include <QEvent>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QAction>
#include <QMenu>
#include <QMessageBox>
#include <QScopedValueRollback>
#include <QLineEdit>
#include <QTimer>
#include <QPushButton>
#include <QHeaderView>
#include <AzCore/Component/ComponentApplication.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/UserSettings/UserSettings.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
#include <AzToolsFramework/Entity/EditorEntityContextPickingBus.h>
#include <AzToolsFramework/ToolsComponents/EditorComponentBase.h>
#include <GraphCanvas/Components/VisualBus.h>
#include <GraphCanvas/Components/SceneBus.h>
#include <GraphCanvas/Components/StyleBus.h>
#include <Editor/View/Widgets/VariablePanel/SlotTypeSelectorWidget.h>
#include <Editor/View/Widgets/VariablePanel/ui_SlotTypeSelectorWidget.h>
#include <Data/Data.h>
#include <Editor/Assets/ScriptCanvasAssetTrackerBus.h>
#include <Editor/GraphCanvas/GraphCanvasEditorNotificationBusId.h>
#include <Editor/QtMetaTypes.h>
#include <Editor/Settings.h>
#include <Editor/Translation/TranslationHelper.h>
#include <Editor/View/Widgets/DataTypePalette/DataTypePaletteModel.h>
#include <Editor/View/Widgets/NodePalette/VariableNodePaletteTreeItemTypes.h>
#include <Editor/View/Widgets/PropertyGridBus.h>
#include <Editor/Include/ScriptCanvas/Bus/EditorScriptCanvasBus.h>
#include <Editor/Include/ScriptCanvas/GraphCanvas/NodeDescriptorBus.h>
#include <ScriptCanvas/Core/NodeBus.h>
#include <ScriptCanvas/Data/DataRegistry.h>
#include <ScriptCanvas/Execution/RuntimeBus.h>
#include <ScriptCanvas/GraphCanvas/NodeDescriptorBus.h>
#include <ScriptCanvas/Asset/RuntimeAsset.h>
namespace ScriptCanvasEditor
{
///////////////////////
// SlotTypeSelectorWidget
///////////////////////
SlotTypeSelectorWidget::SlotTypeSelectorWidget(const ScriptCanvas::ScriptCanvasId& scriptCanvasId, QWidget* parent /*= nullptr*/)
: AzQtComponents::StyledDialog(parent)
, m_manipulatingSelection(false)
, ui(new Ui::SlotTypeSelectorWidget())
, m_scriptCanvasId(scriptCanvasId)
{
ui->setupUi(this);
ui->searchFilter->setClearButtonEnabled(true);
QObject::connect(ui->searchFilter, &QLineEdit::textChanged, this, &SlotTypeSelectorWidget::OnQuickFilterChanged);
QObject::connect(ui->slotName, &QLineEdit::returnPressed, this, &SlotTypeSelectorWidget::OnReturnPressed);
QObject::connect(ui->slotName, &QLineEdit::textChanged, this, &SlotTypeSelectorWidget::OnNameChanged);
QObject::connect(ui->variablePalette, &QTableView::clicked, this, [this]() { ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); });
// Tell the widget to auto create our context menu, for now
setContextMenuPolicy(Qt::ActionsContextMenu);
ui->searchFilter->setEnabled(true);
QObject::connect(ui->variablePalette, &VariablePaletteTableView::CreateVariable, this, &SlotTypeSelectorWidget::OnCreateVariable);
m_filterTimer.setInterval(250);
m_filterTimer.setSingleShot(true);
m_filterTimer.stop();
QObject::connect(&m_filterTimer, &QTimer::timeout, this, &SlotTypeSelectorWidget::UpdateFilter);
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
}
SlotTypeSelectorWidget::~SlotTypeSelectorWidget()
{
}
void SlotTypeSelectorWidget::PopulateVariablePalette(const AZStd::unordered_set< AZ::Uuid >& objectTypes)
{
ui->variablePalette->PopulateVariablePalette(objectTypes);
}
void SlotTypeSelectorWidget::OnEscape()
{
reject();
}
void SlotTypeSelectorWidget::focusOutEvent(QFocusEvent* )
{
reject();
}
const ScriptCanvas::ScriptCanvasId& SlotTypeSelectorWidget::GetActiveScriptCanvasId() const
{
return m_scriptCanvasId;
}
void SlotTypeSelectorWidget::ShowVariablePalette()
{
ClearFilter();
ui->searchFilter->setPlaceholderText("Variable Type...");
FocusOnSearchFilter();
ui->searchFilter->setCompleter(ui->variablePalette->GetVariableCompleter());
AzToolsFramework::EditorEvents::Bus::Handler::BusConnect();
}
void SlotTypeSelectorWidget::FocusOnSearchFilter()
{
ui->searchFilter->setFocus(Qt::FocusReason::MouseFocusReason);
}
void SlotTypeSelectorWidget::ClearFilter()
{
{
QSignalBlocker blocker(ui->searchFilter);
ui->searchFilter->setText("");
}
UpdateFilter();
}
void SlotTypeSelectorWidget::UpdateFilter()
{
ui->variablePalette->SetFilter(ui->searchFilter->userInputText());
}
void SlotTypeSelectorWidget::OnReturnPressed()
{
// Set the type to the slot
if (!m_selectedType.IsNull())
{
m_slotName = ui->slotName->text().toUtf8().data();
accept();
}
}
AZ::Uuid SlotTypeSelectorWidget::GetSelectedType() const
{
return m_selectedType;
}
AZStd::string SlotTypeSelectorWidget::GetSlotName() const
{
return m_slotName;
}
void SlotTypeSelectorWidget::SetSlotName(AZStd::string name)
{
m_slotName = name;
ui->slotName->setText(QString(name.c_str()));
}
void SlotTypeSelectorWidget::OnQuickFilterChanged(const QString& text)
{
if (text.isEmpty())
{
//If field was cleared, update immediately
UpdateFilter();
return;
}
m_filterTimer.stop();
m_filterTimer.start();
}
void SlotTypeSelectorWidget::OnNameChanged(const QString& text)
{
bool nameInUse = false;
const AZStd::unordered_map<ScriptCanvas::VariableId, ScriptCanvas::GraphVariable>* properties = nullptr;
ScriptCanvas::GraphVariableManagerRequestBus::EventResult(properties, m_scriptCanvasId, &ScriptCanvas::GraphVariableManagerRequests::GetVariables);
if (properties)
{
for (const auto& variablePair : (*properties))
{
AZStd::string testName = text.toUtf8().data();
if (testName.compare(variablePair.second.GetVariableName()) == 0)
{
nameInUse = true;
break;
}
}
}
m_slotName = text.toUtf8().data();
if (nameInUse)
{
m_slotName.append(" (duplicate)");
ui->slotName->setText(m_slotName.c_str());
}
}
void SlotTypeSelectorWidget::OnContextMenuRequested(const QPoint&)
{
}
void SlotTypeSelectorWidget::OnCreateVariable(ScriptCanvas::Data::Type varType)
{
m_selectedType = varType.GetAZType();
}
#include <Editor/View/Widgets/VariablePanel/moc_SlotTypeSelectorWidget.cpp>
}
@@ -0,0 +1,131 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#if !defined(Q_MOC_RUN)
#include <AzCore/PlatformDef.h>
#include <QAbstractListModel>
#include <QAbstractItemView>
#include <QListView>
#include <QVBoxLayout>
#include <QHeaderView>
#include <QTimer>
#include <QSortFilterProxyModel>
#include <QStandardItemModel>
#include <QFocusEvent>
#include <QMenu>
#include <AzCore/Component/EntityId.h>
#include <AzCore/Component/ComponentApplicationBus.h>
#include <AzCore/Component/Entity.h>
#include <AzCore/std/containers/vector.h>
#include <AzCore/Casting/numeric_cast.h>
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
#include <AzQtComponents/Components/StyledDialog.h>
#include <GraphCanvas/Editor/AssetEditorBus.h>
#include <GraphCanvas/Components/GraphCanvasPropertyBus.h>
#include <GraphCanvas/Components/SceneBus.h>
#include <GraphCanvas/Components/Nodes/NodeBus.h>
#include <GraphCanvas/Components/Nodes/NodeTitleBus.h>
#include <GraphCanvas/Widgets/GraphCanvasTreeItem.h>
#include <GraphCanvas/Widgets/GraphCanvasTreeModel.h>
#include <ScriptCanvas/Bus/RequestBus.h>
#include <ScriptCanvas/Variable/VariableBus.h>
#include <ScriptCanvas/Variable/GraphVariable.h>
#include <Editor/View/Widgets/VariablePanel/VariablePaletteTableView.h>
#include <Editor/View/Widgets/VariablePanel/GraphVariablesTableView.h>
#endif
class QAction;
class QLineEdit;
class QPushButton;
namespace Ui
{
class SlotTypeSelectorWidget;
}
namespace ScriptCanvasEditor
{
class SlotTypeSelectorWidget
: public AzQtComponents::StyledDialog
, public AzToolsFramework::EditorEvents::Bus::Handler
{
Q_OBJECT
public:
AZ_CLASS_ALLOCATOR(SlotTypeSelectorWidget, AZ::SystemAllocator, 0);
SlotTypeSelectorWidget(const ScriptCanvas::ScriptCanvasId& scriptCanvasId, QWidget* parent = nullptr);
~SlotTypeSelectorWidget();
void PopulateVariablePalette(const AZStd::unordered_set< AZ::Uuid >& objectTypes);
// AzToolsFramework::EditorEvents::Bus
void OnEscape() override;
////
// QWidget
void focusOutEvent(QFocusEvent* focusEvent) override;
////
AZ::Uuid GetSelectedType() const;
AZStd::string GetSlotName() const;
void SetSlotName(AZStd::string);
const ScriptCanvas::ScriptCanvasId& GetActiveScriptCanvasId() const;
public Q_SLOTS:
void OnCreateVariable(ScriptCanvas::Data::Type varType);
Q_SIGNALS:
void OnVariableSelectionChanged(const AZStd::vector<AZ::EntityId>& variableIds);
private:
void ShowVariablePalette();
void FocusOnSearchFilter();
void ClearFilter();
void UpdateFilter();
void OnReturnPressed();
void OnQuickFilterChanged(const QString& text);
void OnNameChanged(const QString& text);
void OnContextMenuRequested(const QPoint& pos);
//bool event(QEvent* ev) override;
bool m_manipulatingSelection;
AZStd::vector< AZStd::unique_ptr<AZ::Entity> > m_propertyHelpers;
ScriptCanvas::ScriptCanvasId m_scriptCanvasId;
AZ::EntityId m_graphCanvasGraphId;
AZ::Uuid m_selectedType;
AZStd::string m_slotName;
AZStd::unique_ptr<Ui::SlotTypeSelectorWidget> ui;
QTimer m_filterTimer;
};
}
@@ -0,0 +1,161 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SlotTypeSelectorWidget</class>
<widget class="QWidget" name="SlotTypeSelectorWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>278</width>
<height>316</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Pick slot name/type</string>
</property>
<property name="floating" stdset="0">
<bool>false</bool>
</property>
<widget class="QWidget" name="widgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>278</width>
<height>278</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>10</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>10</number>
</property>
<property name="bottomMargin">
<number>30</number>
</property>
<item>
<widget class="AzQtComponents::SearchLineEdit" name="searchFilter">
<property name="inputMask">
<string/>
</property>
<property name="placeholderText">
<string>Search...</string>
</property>
</widget>
</item>
<item>
<widget class="ScriptCanvasEditor::VariablePaletteTableView" name="variablePalette">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLineEdit" name="slotName">
<property name="placeholderText">
<string>Type the name for your slot here...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>AzQtComponents::SearchLineEdit</class>
<extends>QLineEdit</extends>
<header location="global">AzQtComponents/Components/SearchLineEdit.h</header>
</customwidget>
<customwidget>
<class>ScriptCanvasEditor::VariablePaletteTableView</class>
<extends>QTableView</extends>
<header location="global">Editor/View/Widgets/VariablePanel/VariablePaletteTableView.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>SlotTypeSelectorWidget</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>77</x>
<y>294</y>
</hint>
<hint type="destinationlabel">
<x>7</x>
<y>296</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>SlotTypeSelectorWidget</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
@@ -117,7 +117,7 @@ namespace ScriptCanvasEditor
{
if (variable)
{
ScriptCanvas::VariableNotificationBus::Handler::BusDisconnect();
ScriptCanvas::VariableNotificationBus::Handler::BusDisconnect();
m_variable = variable;
m_componentTitle.clear();
@@ -180,6 +180,7 @@ namespace ScriptCanvasEditor
{
GeneralRequestBus::Broadcast(&GeneralRequests::PostUndoPoint, m_scriptCanvasGraphId);
PropertyGridRequestBus::Broadcast(&PropertyGridRequests::RefreshPropertyGrid);
AzToolsFramework::ToolsApplicationEvents::Bus::Broadcast(&AzToolsFramework::ToolsApplicationEvents::InvalidatePropertyDisplay, AzToolsFramework::Refresh_AttributesAndValues);
}
void VariablePropertiesComponent::OnVariableRenamed(AZStd::string_view variableName)
@@ -292,6 +293,8 @@ namespace ScriptCanvasEditor
dockWidget->OnDeleteVariables(variableIds);
});
addAction(getAction);
addAction(setAction);
addSeparator();
@@ -299,56 +302,6 @@ namespace ScriptCanvasEditor
addAction(pasteAction);
addAction(duplicateAction);
addAction(deleteAction);
addSeparator();
// Setup exposure options
ScriptCanvas::GraphScopedVariableId variableId;
variableId.m_scriptCanvasId = scriptCanvasId;
variableId.m_identifier = varId;
ScriptCanvas::GraphVariable* variable = nullptr;
ScriptCanvas::VariableRequestBus::EventResult(variable, variableId, &ScriptCanvas::VariableRequests::GetVariable);
AZ_Assert(variable, "The variable must exist at this point");
AZ::Data::AssetType assetType;
AssetTrackerRequestBus::BroadcastResult(assetType, &AssetTrackerRequests::GetAssetType, scriptCanvasId);
// Exposing variables is only available for Function assets
QMenu* scopeSubMenu = new QMenu(QObject::tr("Scope"), this);
QActionGroup* actionGroup = new QActionGroup(scopeSubMenu);
actionGroup->setExclusive(true);
AZStd::vector<ScriptCanvas::VariableFlags::Scope> scopes = { ScriptCanvas::VariableFlags::Scope::Local, ScriptCanvas::VariableFlags::Scope::Input };
if (assetType == azrtti_typeid<ScriptCanvasEditor::ScriptCanvasFunctionAsset >())
{
scopes.emplace_back(ScriptCanvas::VariableFlags::Scope::Output);
scopes.emplace_back(ScriptCanvas::VariableFlags::Scope::InOut);
}
for (auto scopeType : scopes)
{
QAction* exposureAction = new QAction(QObject::tr(ScriptCanvas::VariableFlags::GetScopeDisplayLabel(scopeType)), this);
exposureAction->setCheckable(true);
exposureAction->setChecked(variable->GetScope() == scopeType);
exposureAction->setActionGroup(actionGroup);
exposureAction->setToolTip(QObject::tr(ScriptCanvas::VariableFlags::GetScopeToolTip(scopeType)));
QObject::connect(exposureAction, &QAction::triggered, this, [variableId, scopeType](bool)
{
ScriptCanvas::GraphVariable* variable = nullptr;
ScriptCanvas::VariableRequestBus::EventResult(variable, variableId, &ScriptCanvas::VariableRequests::GetVariable);
if (variable)
{
variable->SetScope(scopeType);
}
});
scopeSubMenu->addAction(exposureAction);
}
addMenu(scopeSubMenu);
}
///////////////////////
@@ -79,7 +79,7 @@
<enum>QAbstractItemView::SelectRows</enum>
</property>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>