Merge branch 'development' into Atom/guthadam/material_editor_replace_modified_color_with_indicator

This commit is contained in:
Guthrie Adams
2021-09-28 17:33:04 -05:00
30 changed files with 950 additions and 627 deletions
@@ -381,12 +381,22 @@ namespace AzToolsFramework
return;
}
//orphan any children that remain attached to the entity
auto children = entityInfo.GetChildren();
for (auto childId : children)
bool isPrefabSystemEnabled = false;
AzFramework::ApplicationRequests::Bus::BroadcastResult(
isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
// For slices, orphan any children that remain attached to the entity
// For prefabs, this is an unneeded operation because the prefab system handles the orphans
// and the extra reparenting operation can be problematic for consumers subscribed to entity
// events, such as the entity outliner.
if (!isPrefabSystemEnabled)
{
ReparentChild(childId, AZ::EntityId(), entityId);
m_entityOrphanTable[entityId].insert(childId);
auto children = entityInfo.GetChildren();
for (auto childId : children)
{
ReparentChild(childId, AZ::EntityId(), entityId);
m_entityOrphanTable[entityId].insert(childId);
}
}
m_savedOrderInfo[entityId] = AZStd::make_pair(entityInfo.GetParent(), entityInfo.GetIndexForSorting());
@@ -56,5 +56,7 @@ namespace AzToolsFramework
virtual void StopPlayInEditor() = 0;
virtual void CreateNewLevelPrefab(AZStd::string_view filename, const AZStd::string& templateFilename) = 0;
virtual bool IsRootPrefabAssigned() const = 0;
};
}
@@ -79,6 +79,8 @@ namespace AzToolsFramework
void PrefabEditorEntityOwnershipService::Reset()
{
m_isRootPrefabAssigned = false;
if (m_rootInstance)
{
AzToolsFramework::ToolsApplicationRequestBus::Broadcast(
@@ -203,6 +205,7 @@ namespace AzToolsFramework
m_rootInstance->SetTemplateSourcePath(m_loaderInterface->GenerateRelativePath(filename));
m_rootInstance->SetContainerEntityName("Level");
m_prefabSystemComponent->PropagateTemplateChanges(templateId);
m_isRootPrefabAssigned = true;
return true;
}
@@ -302,6 +305,12 @@ namespace AzToolsFramework
}
m_prefabSystemComponent->PropagateTemplateChanges(templateId);
m_isRootPrefabAssigned = true;
}
bool PrefabEditorEntityOwnershipService::IsRootPrefabAssigned() const
{
return m_isRootPrefabAssigned;
}
Prefab::InstanceOptionalReference PrefabEditorEntityOwnershipService::CreatePrefab(
@@ -167,6 +167,7 @@ namespace AzToolsFramework
void StopPlayInEditor() override;
void CreateNewLevelPrefab(AZStd::string_view filename, const AZStd::string& templateFilename) override;
bool IsRootPrefabAssigned() const override;
protected:
@@ -215,5 +216,6 @@ namespace AzToolsFramework
Prefab::PrefabLoaderInterface* m_loaderInterface;
AzFramework::EntityContextId m_entityContextId;
AZ::SerializeContext m_serializeContext;
bool m_isRootPrefabAssigned = false;
};
}
@@ -329,6 +329,11 @@ namespace AzToolsFramework
return AZ::Failure(AZStd::string("Could not instantiate prefab - internal error "
"(PrefabEditorEntityOwnershipInterface unavailable)."));
}
if (!prefabEditorEntityOwnershipInterface->IsRootPrefabAssigned())
{
return AZ::Failure(AZStd::string("Could not instantiate prefab - no root prefab assigned. "
"Currently, prefabs can only be instantiated inside a level"));
}
InstanceOptionalReference instanceToParentUnder;
@@ -82,6 +82,8 @@ namespace AzToolsFramework
, m_entityExpansionState()
, m_entityFilteredState()
{
m_focusModeInterface = AZ::Interface<FocusModeInterface>::Get();
AZ_Assert(m_focusModeInterface != nullptr, "EntityOutlinerListModel requires a FocusModeInterface instance on construction.");
}
EntityOutlinerListModel::~EntityOutlinerListModel()
@@ -106,11 +108,6 @@ namespace AzToolsFramework
m_editorEntityUiInterface = AZ::Interface<AzToolsFramework::EditorEntityUiInterface>::Get();
AZ_Assert(m_editorEntityUiInterface != nullptr,
"EntityOutlinerListModel requires a EditorEntityUiInterface instance on Initialize.");
m_focusModeInterface = AZ::Interface<FocusModeInterface>::Get();
AZ_Assert(
m_focusModeInterface != nullptr,
"EntityOutlinerListModel requires a FocusModeInterface instance on Initialize.");
}
int EntityOutlinerListModel::rowCount(const QModelIndex& parent) const
@@ -1347,7 +1344,10 @@ namespace AzToolsFramework
//add/remove operations trigger selection change signals which assert and break undo/redo operations in progress in inspector etc.
//so disallow selection updates until change is complete
emit EnableSelectionUpdates(false);
beginResetModel();
auto parentIndex = GetIndexFromEntity(parentId);
auto childIndex = GetIndexFromEntity(childId);
beginRemoveRows(parentIndex, childIndex.row(), childIndex.row());
}
void EntityOutlinerListModel::OnEntityInfoUpdatedRemoveChildEnd(AZ::EntityId parentId, AZ::EntityId childId)
@@ -1355,7 +1355,7 @@ namespace AzToolsFramework
(void)childId;
AZ_PROFILE_FUNCTION(AzToolsFramework);
endResetModel();
endRemoveRows();
//must refresh partial lock/visibility of parents
m_isFilterDirty = true;
@@ -232,6 +232,9 @@ namespace AzToolsFramework
m_gui->m_objectTree->header()->setSortIndicatorShown(false);
m_gui->m_objectTree->header()->setStretchLastSection(false);
// Always expand root entity (level entity) - needed if the widget is re-created while a level is already open.
m_gui->m_objectTree->expand(m_proxyModel->index(0, 0));
// resize the icon columns so that the Visibility and Lock toggle icon columns stay right-justified
m_gui->m_objectTree->header()->setStretchLastSection(false);
m_gui->m_objectTree->header()->setMinimumSectionSize(0);
@@ -358,8 +358,9 @@ namespace O3DE::ProjectManager
painter.drawPixmap(backgroundRect, m_background);
// Draw a semi-transparent overlay to darken down the colors.
painter.setCompositionMode (QPainter::CompositionMode_DestinationIn);
const float overlayTransparency = 0.7f;
// Use SourceOver, DestinationIn will make background transparent on Mac
painter.setCompositionMode (QPainter::CompositionMode_SourceOver);
const float overlayTransparency = 0.3f;
painter.fillRect(backgroundRect, QColor(0, 0, 0, static_cast<int>(255.0f * overlayTransparency)));
}