fix graph tab selection:
Signed-off-by: chcurran <82187351+carlitosan@users.noreply.github.com>
This commit is contained in:
@@ -39,10 +39,19 @@ namespace ScriptCanvasBuilder
|
||||
|
||||
void BuildVariableOverrides::CopyPreviousOverriddenValues(const BuildVariableOverrides& source)
|
||||
{
|
||||
auto copyPreviousIfFound = [](ScriptCanvas::GraphVariable& overriddenValue, const AZStd::vector<ScriptCanvas::GraphVariable>& source)
|
||||
auto isEqual = [](const ScriptCanvas::GraphVariable& overrideValue, const ScriptCanvas::GraphVariable& candidate)
|
||||
{
|
||||
if (auto iter = AZStd::find_if(source.begin(), source.end(), [&overriddenValue](const auto& candidate) { return candidate.GetVariableId() == overriddenValue.GetVariableId(); });
|
||||
iter != source.end())
|
||||
return candidate.GetVariableId() == overrideValue.GetVariableId()
|
||||
|| (candidate.GetVariableName() == overrideValue.GetVariableName()
|
||||
&& candidate.GetDataType() == overrideValue.GetDataType());
|
||||
};
|
||||
|
||||
auto copyPreviousIfFound = [isEqual](ScriptCanvas::GraphVariable& overriddenValue, const AZStd::vector<ScriptCanvas::GraphVariable>& source)
|
||||
{
|
||||
auto iter = AZStd::find_if(source.begin(), source.end()
|
||||
, [&overriddenValue, isEqual](const auto& candidate) { return isEqual(candidate, overriddenValue); });
|
||||
|
||||
if (iter != source.end())
|
||||
{
|
||||
overriddenValue.DeepCopy(*iter);
|
||||
overriddenValue.SetScriptInputControlVisibility(AZ::Edit::PropertyVisibility::Hide);
|
||||
|
||||
@@ -394,7 +394,7 @@ namespace ScriptCanvasEditor
|
||||
{
|
||||
if (auto loaded = LoadFromFile(assetId.Path().c_str()); loaded.IsSuccess())
|
||||
{
|
||||
OnScriptCanvasAssetReady(loaded.GetValue());
|
||||
UpdatePropertyDisplay(loaded.GetValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,14 +421,38 @@ namespace ScriptCanvasEditor
|
||||
}
|
||||
}
|
||||
|
||||
void EditorScriptCanvasComponent::SourceFileChanged(AZStd::string /*relativePath*/, AZStd::string /*scanFolder*/, AZ::Uuid /*fileAssetId*/)
|
||||
{}
|
||||
void EditorScriptCanvasComponent::SourceFileChanged([[maybe_unused]] AZStd::string relativePath
|
||||
, [[maybe_unused]] AZStd::string scanFolder, [[maybe_unused]] AZ::Uuid fileAssetId)
|
||||
{
|
||||
if (fileAssetId == m_sourceHandle.Id())
|
||||
{
|
||||
if (auto handle = CompleteDescription(SourceHandle(nullptr, fileAssetId, {})))
|
||||
{
|
||||
// consider queueing on tick bus
|
||||
OnScriptCanvasAssetChanged(*handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EditorScriptCanvasComponent::SourceFileRemoved(AZStd::string /*relativePath*/, AZStd::string /*scanFolder*/, AZ::Uuid /*fileAssetId*/)
|
||||
{}
|
||||
void EditorScriptCanvasComponent::SourceFileRemoved([[maybe_unused]] AZStd::string relativePath
|
||||
, [[maybe_unused]] AZStd::string scanFolder, [[maybe_unused]] AZ::Uuid fileAssetId)
|
||||
{
|
||||
if (fileAssetId == m_sourceHandle.Id())
|
||||
{
|
||||
m_removedHandle = m_sourceHandle;
|
||||
OnScriptCanvasAssetChanged(m_removedHandle);
|
||||
}
|
||||
}
|
||||
|
||||
void EditorScriptCanvasComponent::SourceFileFailed(AZStd::string /*relativePath*/, AZStd::string /*scanFolder*/, AZ::Uuid /*fileAssetId*/)
|
||||
{}
|
||||
void EditorScriptCanvasComponent::SourceFileFailed([[maybe_unused]] AZStd::string relativePath
|
||||
, [[maybe_unused]] AZStd::string scanFolder, [[maybe_unused]] AZ::Uuid fileAssetId)
|
||||
{
|
||||
if (fileAssetId == m_sourceHandle.Id())
|
||||
{
|
||||
m_removedHandle = m_sourceHandle;
|
||||
OnScriptCanvasAssetChanged(m_removedHandle);
|
||||
}
|
||||
}
|
||||
|
||||
bool EditorScriptCanvasComponent::HasAssetId() const
|
||||
{
|
||||
@@ -442,7 +466,7 @@ namespace ScriptCanvasEditor
|
||||
return ScriptCanvas::GraphIdentifier(m_sourceHandle.Id(), 0);
|
||||
}
|
||||
|
||||
void EditorScriptCanvasComponent::OnScriptCanvasAssetReady(const SourceHandle& sourceHandle)
|
||||
void EditorScriptCanvasComponent::UpdatePropertyDisplay(const SourceHandle& sourceHandle)
|
||||
{
|
||||
if (sourceHandle.IsValid())
|
||||
{
|
||||
|
||||
+1
-2
@@ -45,7 +45,6 @@ namespace ScriptCanvasEditor
|
||||
AZ_COMPONENT(EditorScriptCanvasComponent, "{C28E2D29-0746-451D-A639-7F113ECF5D72}", AzToolsFramework::Components::EditorComponentBase);
|
||||
|
||||
EditorScriptCanvasComponent();
|
||||
// EditorScriptCanvasComponent(AZ::Data::Asset<ScriptCanvasAsset> asset);
|
||||
EditorScriptCanvasComponent(const SourceHandle& sourceHandle);
|
||||
~EditorScriptCanvasComponent() override;
|
||||
|
||||
@@ -130,7 +129,7 @@ namespace ScriptCanvasEditor
|
||||
void UpdateName();
|
||||
|
||||
//=====================================================================
|
||||
void OnScriptCanvasAssetReady(const SourceHandle& sourceHandle);
|
||||
void UpdatePropertyDisplay(const SourceHandle& sourceHandle);
|
||||
//=====================================================================
|
||||
|
||||
void BuildGameEntityData();
|
||||
|
||||
@@ -181,11 +181,6 @@ namespace ScriptCanvasEditor
|
||||
return false;
|
||||
}
|
||||
|
||||
// void GraphTabBar::ConfigureTab(int /*tabIndex*/, ScriptCanvasEditor::SourceHandle fileAssetId, const AZStd::string& tabName)
|
||||
// {
|
||||
//
|
||||
// }
|
||||
|
||||
int GraphTabBar::FindTab(ScriptCanvasEditor::SourceHandle assetId) const
|
||||
{
|
||||
for (int tabIndex = 0; tabIndex < count(); ++tabIndex)
|
||||
@@ -451,10 +446,9 @@ namespace ScriptCanvasEditor
|
||||
return;
|
||||
}
|
||||
|
||||
auto assetId = tabdata.value<GraphTabMetadata>();
|
||||
auto assetId = tabdata.value<GraphTabMetadata>().m_assetId;
|
||||
|
||||
// #sc_editor_asset
|
||||
// ScriptCanvasEditor::GeneralRequestBus::Broadcast(&ScriptCanvasEditor::GeneralRequests::OnChangeActiveGraphTab, assetId);
|
||||
ScriptCanvasEditor::GeneralRequestBus::Broadcast(&ScriptCanvasEditor::GeneralRequests::OnChangeActiveGraphTab, assetId);
|
||||
|
||||
if (m_signalSaveOnChangeTo >= 0 && m_signalSaveOnChangeTo == index)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user