Reparenting - introduce loop detection on instance reparenting (DCO fix) (#1752)

* Detect loops in reparenting code and assert.

Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>

* Add warning when detecting a cyclical dependancy. Revert reparenting on loop.

Signed-off-by: daimini <82231674+AMZN-daimini@users.noreply.github.com>
Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>

* Use GetActiveWindow helper to handle window edge cases

Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>
This commit is contained in:
Danilo Aimini
2021-07-02 08:24:58 -07:00
committed by GitHub
parent d365ff51d6
commit 3c959832a3
4 changed files with 51 additions and 6 deletions
@@ -45,6 +45,7 @@
#include <AzToolsFramework/UI/UICore/QTreeViewStateSaver.hxx>
#include <AzToolsFramework/UI/UICore/QWidgetSavedState.h>
#include <AzToolsFramework/UI/UICore/ProgressShield.hxx>
#include <AzToolsFramework/UI/UICore/WidgetHelpers.h>
#include <AzToolsFramework/Slice/SliceUtilities.h>
#include <AzToolsFramework/ToolsComponents/EditorInspectorComponent.h>
#include <AzToolsFramework/API/ComponentEntityObjectBus.h>
@@ -1589,7 +1590,13 @@ namespace AzToolsFramework
// Multiple changes to the same entity are just split between different undo nodes.
for (AZ::EntityId entityId : m_dirtyEntities)
{
prefabPublicInterface->GenerateUndoNodesForEntityChangeAndUpdateCache(entityId, m_currentBatchUndo);
auto outcome = prefabPublicInterface->GenerateUndoNodesForEntityChangeAndUpdateCache(entityId, m_currentBatchUndo);
if (!outcome.IsSuccess())
{
QMessageBox::warning(
AzToolsFramework::GetActiveWindow(), QString("Error"), QString(outcome.GetError().c_str()), QMessageBox::Ok, QMessageBox::Ok);
}
}
}
}