Editor Script Component simplified and working

Signed-off-by: chcurran <82187351+carlitosan@users.noreply.github.com>
This commit is contained in:
chcurran
2021-11-23 10:31:26 -08:00
parent 24b3167d48
commit cdb858e8af
6 changed files with 74 additions and 56 deletions
@@ -30,11 +30,10 @@ namespace ScriptCanvasBuilder
void BuildVariableOverrides::CopyPreviousOverriddenValues(const BuildVariableOverrides& source)
{
auto isEqual = [](const ScriptCanvas::GraphVariable& overrideValue, const ScriptCanvas::GraphVariable& candidate)
auto isEqual = [](const ScriptCanvas::GraphVariable& lhs, const ScriptCanvas::GraphVariable& rhs)
{
return candidate.GetVariableId() == overrideValue.GetVariableId()
|| (candidate.GetVariableName() == overrideValue.GetVariableName()
&& candidate.GetDataType() == overrideValue.GetDataType());
return (lhs.GetVariableId() == rhs.GetVariableId() && lhs.GetDataType() == rhs.GetDataType())
|| (lhs.GetVariableName() == rhs.GetVariableName() && lhs.GetDataType() == rhs.GetDataType());
};
auto copyPreviousIfFound = [isEqual](ScriptCanvas::GraphVariable& overriddenValue, const AZStd::vector<ScriptCanvas::GraphVariable>& source)
@@ -44,7 +43,7 @@ namespace ScriptCanvasBuilder
if (iter != source.end())
{
overriddenValue.DeepCopy(*iter);
overriddenValue.ModDatum().DeepCopyDatum(*iter->GetDatum());
overriddenValue.SetScriptInputControlVisibility(AZ::Edit::PropertyVisibility::Hide);
overriddenValue.SetAllowSignalOnChange(false);
return true;
@@ -64,6 +63,15 @@ namespace ScriptCanvasBuilder
}
}
for (auto& overriddenValue : m_overridesUnused)
{
if (!copyPreviousIfFound(overriddenValue, source.m_overridesUnused))
{
// the variable in question may have been previously used, and is now unused, so copy the previous value over
copyPreviousIfFound(overriddenValue, source.m_overrides);
}
}
//////////////////////////////////////////////////////////////////////////
// #functions2 provide an identifier for the node/variable in the source that caused the dependency. the root will not have one.
// the above will provide the data to handle the cases where only certain dependency nodes were removed