Integrating github/staging through commit ab87ed9
This commit is contained in:
@@ -255,10 +255,8 @@ namespace AzToolsFramework::AssetUtils
|
||||
return configFiles;
|
||||
}
|
||||
|
||||
bool UpdateFilePathToCorrectCase(const QString& root, QString& relativePathFromRoot)
|
||||
bool UpdateFilePathToCorrectCase(AZStd::string_view rootPath, AZStd::string& relPathFromRoot)
|
||||
{
|
||||
AZStd::string rootPath(root.toUtf8().data());
|
||||
AZStd::string relPathFromRoot(relativePathFromRoot.toUtf8().data());
|
||||
AZ::StringFunc::Path::Normalize(relPathFromRoot);
|
||||
AZStd::vector<AZStd::string> tokens;
|
||||
AZ::StringFunc::Tokenize(relPathFromRoot.c_str(), tokens, AZ_CORRECT_FILESYSTEM_SEPARATOR_STRING);
|
||||
@@ -321,7 +319,6 @@ namespace AzToolsFramework::AssetUtils
|
||||
{
|
||||
relPathFromRoot.clear();
|
||||
AZ::StringFunc::Join(relPathFromRoot, tokens.begin(), tokens.end(), AZ_CORRECT_FILESYSTEM_SEPARATOR_STRING);
|
||||
relativePathFromRoot = relPathFromRoot.c_str();
|
||||
}
|
||||
|
||||
return success;
|
||||
|
||||
@@ -52,5 +52,5 @@ namespace AzToolsFramework::AssetUtils
|
||||
//! which will be normalized and updated to be correct casing.
|
||||
//! @return if such a file does NOT exist, it returns FALSE, else returns TRUE.
|
||||
//! @note A very expensive function! Call sparingly.
|
||||
bool UpdateFilePathToCorrectCase(const QString& root, QString& relativePathFromRoot);
|
||||
bool UpdateFilePathToCorrectCase(AZStd::string_view root, AZStd::string& relativePathFromRoot);
|
||||
} //namespace AzToolsFramework::AssetUtils
|
||||
|
||||
+10
-3
@@ -191,10 +191,17 @@ namespace AzToolsFramework
|
||||
{
|
||||
if (componentClass->m_editData->m_name == componentTypeNames[i])
|
||||
{
|
||||
// Although it is rare, it can happen that two (or more) components can have the same name.
|
||||
// We should only count the first occurrence, so that none of the names in componentTypeNames
|
||||
// get skipped, but whichever component type that is encountered last will be the one
|
||||
// that is captured in order to preserve the pre-existing behavior.
|
||||
if (foundTypeIds[i].IsNull())
|
||||
{
|
||||
++counter;
|
||||
}
|
||||
|
||||
foundTypeIds[i] = componentClass->m_typeId;
|
||||
++counter;
|
||||
//Although it is rare, it can happen that two components can have the same name.
|
||||
//We will capture only the first occurrence.
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ namespace AzToolsFramework
|
||||
int written = uuid.ToString(buffer, aznumeric_caster(bufferSize), false);
|
||||
if (written > 0)
|
||||
{
|
||||
if (bufferSize - written > 0)
|
||||
if (bufferSize > written)
|
||||
{
|
||||
buffer[written - 1] = '\n';
|
||||
buffer[written] = 0;
|
||||
|
||||
+1
@@ -453,6 +453,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
loadedSuccessfully = static_cast<PrefabEditorEntityOwnershipService*>(m_entityOwnershipService.get())->LoadFromStream(
|
||||
stream, AZStd::string_view(levelPakFile.toUtf8(), levelPakFile.size()) );
|
||||
|
||||
}
|
||||
|
||||
LoadFromStreamComplete(loadedSuccessfully);
|
||||
|
||||
+39
@@ -11,8 +11,10 @@
|
||||
*/
|
||||
|
||||
#include <AzCore/Component/Entity.h>
|
||||
#include <AzCore/Component/TransformBus.h>
|
||||
#include <AzCore/Script/ScriptSystemBus.h>
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
#include <AzFramework/Entity/GameEntityContextBus.h>
|
||||
#include <AzFramework/Spawnable/RootSpawnableInterface.h>
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
#include <AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.h>
|
||||
@@ -21,6 +23,7 @@
|
||||
#include <AzToolsFramework/Prefab/PrefabDomUtils.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabLoader.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabSystemComponentInterface.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabUndoHelpers.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
@@ -91,23 +94,47 @@ namespace AzToolsFramework
|
||||
m_prefabSystemComponent->RemoveTemplate(templateId);
|
||||
}
|
||||
m_rootInstance->Reset();
|
||||
|
||||
AzFramework::EntityOwnershipServiceNotificationBus::Event(
|
||||
m_entityContextId, &AzFramework::EntityOwnershipServiceNotificationBus::Events::OnEntityOwnershipServiceReset);
|
||||
}
|
||||
|
||||
void PrefabEditorEntityOwnershipService::AddEntity(AZ::Entity* entity)
|
||||
{
|
||||
AZ_Assert(IsInitialized(), "Tried to add an entity without initializing the Entity Ownership Service");
|
||||
ScopedUndoBatch undoBatch("Undo adding entity");
|
||||
Prefab::PrefabDom instanceDomBeforeUpdate;
|
||||
Prefab::PrefabDomUtils::StoreInstanceInPrefabDom(*m_rootInstance, instanceDomBeforeUpdate);
|
||||
|
||||
m_rootInstance->AddEntity(*entity);
|
||||
HandleEntitiesAdded({ entity });
|
||||
AZ::TransformBus::Event(entity->GetId(), &AZ::TransformInterface::SetParent, m_rootInstance->m_containerEntity->GetId());
|
||||
|
||||
Prefab::PrefabUndoHelpers::UpdatePrefabInstance(
|
||||
*m_rootInstance, "Undo adding entity", instanceDomBeforeUpdate, undoBatch.GetUndoBatch());
|
||||
}
|
||||
|
||||
void PrefabEditorEntityOwnershipService::AddEntities(const EntityList& entities)
|
||||
{
|
||||
AZ_Assert(IsInitialized(), "Tried to add entities without initializing the Entity Ownership Service");
|
||||
ScopedUndoBatch undoBatch("Undo adding entities");
|
||||
Prefab::PrefabDom instanceDomBeforeUpdate;
|
||||
Prefab::PrefabDomUtils::StoreInstanceInPrefabDom(*m_rootInstance, instanceDomBeforeUpdate);
|
||||
|
||||
for (AZ::Entity* entity : entities)
|
||||
{
|
||||
m_rootInstance->AddEntity(*entity);
|
||||
}
|
||||
|
||||
HandleEntitiesAdded(entities);
|
||||
|
||||
for (AZ::Entity* entity : entities)
|
||||
{
|
||||
AZ::TransformBus::Event(entity->GetId(), &AZ::TransformInterface::SetParent, m_rootInstance->m_containerEntity->GetId());
|
||||
}
|
||||
|
||||
Prefab::PrefabUndoHelpers::UpdatePrefabInstance(
|
||||
*m_rootInstance, "Undo adding entities", instanceDomBeforeUpdate, undoBatch.GetUndoBatch());
|
||||
}
|
||||
|
||||
bool PrefabEditorEntityOwnershipService::DestroyEntity(AZ::Entity* entity)
|
||||
@@ -172,6 +199,7 @@ namespace AzToolsFramework
|
||||
m_rootInstance->SetTemplateId(templateId);
|
||||
m_rootInstance->SetTemplateSourcePath(m_loaderInterface->GetRelativePathToProject(filename));
|
||||
m_prefabSystemComponent->PropagateTemplateChanges(templateId);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -295,6 +323,9 @@ namespace AzToolsFramework
|
||||
|
||||
void PrefabEditorEntityOwnershipService::StartPlayInEditor()
|
||||
{
|
||||
// This is a workaround until the replacement for GameEntityContext is done
|
||||
AzFramework::GameEntityContextEventBus::Broadcast(&AzFramework::GameEntityContextEventBus::Events::OnPreGameEntitiesStarted);
|
||||
|
||||
if (m_rootInstance && !m_playInEditorData.m_isEnabled)
|
||||
{
|
||||
// Construct the runtime entities and products
|
||||
@@ -339,11 +370,16 @@ namespace AzToolsFramework
|
||||
m_playInEditorData.m_assets.emplace_back(product.ReleaseAsset().release(), AZ::Data::AssetLoadBehavior::Default);
|
||||
}
|
||||
|
||||
|
||||
if (rootSpawnableIndex != NoRootSpawnable)
|
||||
{
|
||||
m_playInEditorData.m_entities.Reset(m_playInEditorData.m_assets[rootSpawnableIndex]);
|
||||
m_playInEditorData.m_entities.SpawnAllEntities();
|
||||
}
|
||||
|
||||
// This is a workaround until the replacement for GameEntityContext is done
|
||||
AzFramework::GameEntityContextEventBus::Broadcast(
|
||||
&AzFramework::GameEntityContextEventBus::Events::OnGameEntitiesStarted);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -402,6 +438,9 @@ namespace AzToolsFramework
|
||||
AZ::ScriptSystemRequestBus::Broadcast(&AZ::ScriptSystemRequests::GarbageCollect);
|
||||
});
|
||||
m_playInEditorData.m_entities.Clear();
|
||||
|
||||
// This is a workaround until the replacement for GameEntityContext is done
|
||||
AzFramework::GameEntityContextEventBus::Broadcast(&AzFramework::GameEntityContextEventBus::Events::OnGameEntitiesReset);
|
||||
}
|
||||
|
||||
m_playInEditorData.m_isEnabled = false;
|
||||
|
||||
@@ -56,16 +56,6 @@ namespace AzToolsFramework
|
||||
|
||||
void EditorPrefabComponent::Activate()
|
||||
{
|
||||
PrefabPublicInterface* prefabPublicInterface = AZ::Interface<PrefabPublicInterface>::Get();
|
||||
if (prefabPublicInterface && prefabPublicInterface->IsLevelInstanceContainerEntity(GetEntityId()))
|
||||
{
|
||||
EntityOutlinerWidgetInterface* entityOutlinerWidgetInterface = AZ::Interface<EntityOutlinerWidgetInterface>::Get();
|
||||
if (entityOutlinerWidgetInterface)
|
||||
{
|
||||
entityOutlinerWidgetInterface->SetRootEntity(GetEntityId());
|
||||
}
|
||||
}
|
||||
|
||||
PrefabInstanceContainerNotificationBus::Broadcast(
|
||||
&PrefabInstanceContainerNotifications::OnPrefabComponentActivate, GetEntityId());
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ namespace AzToolsFramework
|
||||
if (instanceToTemplateEntityIdIterator != m_instanceToTemplateEntityIdMap.end())
|
||||
{
|
||||
entityAliasToRemove = instanceToTemplateEntityIdIterator->second;
|
||||
bool isEntityRemoved = m_instanceEntityMapper->UnregisterEntity(entityId) &&
|
||||
[[maybe_unused]] bool isEntityRemoved = m_instanceEntityMapper->UnregisterEntity(entityId) &&
|
||||
m_templateToInstanceEntityIdMap.erase(entityAliasToRemove) && m_instanceToTemplateEntityIdMap.erase(entityId);
|
||||
AZ_Assert(isEntityRemoved,
|
||||
"Prefab - Failed to remove entity with id %s with a Prefab Instance derived from source asset %s "
|
||||
|
||||
+1
-1
@@ -209,7 +209,7 @@ namespace AzToolsFramework
|
||||
EntityList entitiesInInstance;
|
||||
entitiesInInstance.reserve(instance->m_entities.size() + 1);
|
||||
|
||||
if (instance->m_containerEntity->GetId().IsValid())
|
||||
if (instance->m_containerEntity && instance->m_containerEntity->GetId().IsValid())
|
||||
{
|
||||
entitiesInInstance.emplace_back(instance->m_containerEntity.get());
|
||||
}
|
||||
|
||||
-2
@@ -132,7 +132,6 @@ namespace AzToolsFramework
|
||||
return false;
|
||||
}
|
||||
|
||||
PrefabDom& templateDomReference = m_prefabSystemComponentInterface->FindTemplateDom(templateId);
|
||||
|
||||
return PatchEntityInTemplate(providedPatch, entityAlias.value(), templateId);
|
||||
}
|
||||
@@ -314,7 +313,6 @@ namespace AzToolsFramework
|
||||
PrefabDom& linkDom = link.GetLinkDom();
|
||||
PrefabDomValueReference linkPatchesReference =
|
||||
PrefabDomUtils::FindPrefabDomValue(linkDom, PrefabDomUtils::PatchesName);
|
||||
PrefabDom& templateDomReference = m_prefabSystemComponentInterface->FindTemplateDom(link.GetTargetTemplateId());
|
||||
|
||||
// This logic only covers addition of patches. If patches already exists, the given list of patches must be appended to them.
|
||||
if (!linkPatchesReference.has_value())
|
||||
|
||||
+16
-8
@@ -19,6 +19,7 @@
|
||||
#include <AzToolsFramework/Prefab/Instance/Instance.h>
|
||||
#include <AzToolsFramework/Prefab/Instance/TemplateInstanceMapperInterface.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabDomUtils.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabPublicInterface.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabSystemComponentInterface.h>
|
||||
#include <AzToolsFramework/Prefab/Template/Template.h>
|
||||
#include <AzToolsFramework/UI/Outliner/EntityOutlinerWidgetInterface.h>
|
||||
@@ -121,8 +122,12 @@ namespace AzToolsFramework
|
||||
|
||||
Template& currentTemplate = currentTemplateReference->get();
|
||||
Instance::EntityList newEntities;
|
||||
if (!PrefabDomUtils::LoadInstanceFromPrefabDom(
|
||||
*instanceToUpdate, newEntities, currentTemplate.GetPrefabDom()))
|
||||
if (PrefabDomUtils::LoadInstanceFromPrefabDom(*instanceToUpdate, newEntities, currentTemplate.GetPrefabDom()))
|
||||
{
|
||||
AzToolsFramework::EditorEntityContextRequestBus::Broadcast(
|
||||
&AzToolsFramework::EditorEntityContextRequests::HandleEntitiesAdded, newEntities);
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_Error(
|
||||
"Prefab", false,
|
||||
@@ -132,8 +137,6 @@ namespace AzToolsFramework
|
||||
|
||||
isUpdateSuccessful = false;
|
||||
}
|
||||
AzToolsFramework::EditorEntityContextRequestBus::Broadcast(
|
||||
&AzToolsFramework::EditorEntityContextRequests::HandleEntitiesAdded, newEntities);
|
||||
|
||||
m_instancesUpdateQueue.pop();
|
||||
|
||||
@@ -142,12 +145,17 @@ namespace AzToolsFramework
|
||||
ToolsApplicationRequestBus::Broadcast(&ToolsApplicationRequests::SetSelectedEntities, selectedEntityIds);
|
||||
|
||||
// Enable the Outliner
|
||||
AZ::SystemTickBus::QueueFunction([entityOutlinerWidgetInterface]() {
|
||||
if (entityOutlinerWidgetInterface)
|
||||
if (entityOutlinerWidgetInterface)
|
||||
{
|
||||
entityOutlinerWidgetInterface->SetUpdatesEnabled(true);
|
||||
|
||||
auto prefabPublicInterface = AZ::Interface<PrefabPublicInterface>::Get();
|
||||
if (prefabPublicInterface)
|
||||
{
|
||||
entityOutlinerWidgetInterface->SetUpdatesEnabled(true);
|
||||
AZ::EntityId rootEntityId = prefabPublicInterface->GetLevelInstanceContainerEntityId();
|
||||
entityOutlinerWidgetInterface->ExpandEntityChildren(rootEntityId);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
m_updatingTemplateInstancesInQueue = false;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace AzToolsFramework
|
||||
auto settingsRegistry = AZ::SettingsRegistry::Get();
|
||||
AZ_Assert(settingsRegistry, "Settings registry is not set");
|
||||
|
||||
bool result =
|
||||
[[maybe_unused]] bool result =
|
||||
settingsRegistry->Get(m_projectPathWithOsSeparator.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_ProjectPath);
|
||||
AZ_Assert(result, "Couldn't retrieve project root path");
|
||||
m_projectPathWithSlashSeparator = AZ::IO::Path(m_projectPathWithOsSeparator.Native(), '/').MakePreferred();
|
||||
@@ -182,7 +182,6 @@ namespace AzToolsFramework
|
||||
for (PrefabDomValue::MemberIterator instanceIterator = instances.MemberBegin(); instanceIterator != instances.MemberEnd();
|
||||
++instanceIterator)
|
||||
{
|
||||
const PrefabDomValue& instance = instanceIterator->value;
|
||||
if (!LoadNestedInstance(instanceIterator, newTemplateId, progressedFilePathsSet))
|
||||
{
|
||||
isLoadedWithErrors = true;
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <AzToolsFramework/Prefab/PrefabLoaderInterface.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabSystemComponentInterface.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabUndo.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabUndoHelpers.h>
|
||||
#include <AzToolsFramework/ToolsComponents/TransformComponent.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
@@ -247,23 +248,8 @@ namespace AzToolsFramework
|
||||
|
||||
ToolsApplicationRequests::Bus::Broadcast(&ToolsApplicationRequests::SetSelectedEntities, selection);
|
||||
|
||||
PrefabDom instanceDomAfterUpdate;
|
||||
m_instanceToTemplateInterface->GenerateDomForInstance(instanceDomAfterUpdate, entityOwningInstance);
|
||||
|
||||
// Generate the patch comparing the instance before and after the entity addition.
|
||||
PrefabDom patch;
|
||||
if (!m_instanceToTemplateInterface->GeneratePatch(patch, instanceDomBeforeUpdate, instanceDomAfterUpdate))
|
||||
{
|
||||
return AZ::Failure(AZStd::string::format(
|
||||
"A valid patch couldn't be created for adding an entity with id '%llu'", static_cast<AZ::u64>(entityId)));
|
||||
}
|
||||
|
||||
// create undo node
|
||||
PrefabUndoInstance* state = aznew PrefabUndoInstance(AZStd::string::format("%llu", static_cast<AZ::u64>(entityId)));
|
||||
state->Capture(instanceDomBeforeUpdate, instanceDomAfterUpdate, entityOwningInstance.GetTemplateId());
|
||||
state->SetParent(undoBatch.GetUndoBatch());
|
||||
|
||||
state->Redo();
|
||||
PrefabUndoHelpers::UpdatePrefabInstance(
|
||||
entityOwningInstance, "Undo adding entity", instanceDomBeforeUpdate, undoBatch.GetUndoBatch());
|
||||
|
||||
return AZ::Success(entityId);
|
||||
}
|
||||
@@ -643,14 +629,17 @@ namespace AzToolsFramework
|
||||
}
|
||||
|
||||
bool PrefabPublicHandler::RetrieveAndSortPrefabEntitiesAndInstances(
|
||||
const EntityList& inputEntities, const Instance& commonRootEntityOwningInstance,
|
||||
const EntityList& inputEntities, Instance& commonRootEntityOwningInstance,
|
||||
EntityList& outEntities, AZStd::vector<AZStd::unique_ptr<Instance>>& outInstances) const
|
||||
{
|
||||
AZStd::queue<AZ::Entity*> entityQueue;
|
||||
|
||||
for (auto inputEntity : inputEntities)
|
||||
{
|
||||
entityQueue.push(inputEntity);
|
||||
if (inputEntity && !IsLevelInstanceContainerEntity(inputEntity->GetId()))
|
||||
{
|
||||
entityQueue.push(inputEntity);
|
||||
}
|
||||
}
|
||||
|
||||
// Support sets to easily identify if we're processing the same entity multiple times.
|
||||
@@ -664,17 +653,19 @@ namespace AzToolsFramework
|
||||
|
||||
// Get this entity's owning instance.
|
||||
InstanceOptionalReference owningInstance = m_instanceEntityMapperInterface->FindOwningInstance(entity->GetId());
|
||||
AZ_Assert(owningInstance.has_value(), "An error occored while retrieving entities and prefab instances : "
|
||||
"Owning instance of entity with id '%llu' couldn't be found", entity->GetId());
|
||||
AZ_Assert(
|
||||
owningInstance.has_value(),
|
||||
"An error occored while retrieving entities and prefab instances : "
|
||||
"Owning instance of entity with id '%llu' couldn't be found",
|
||||
entity->GetId());
|
||||
|
||||
// Check if this entity is owned by the same instance owning the root.
|
||||
if (&owningInstance->get() == &commonRootEntityOwningInstance)
|
||||
{
|
||||
AZStd::unique_ptr<AZ::Entity> detachedEntity = owningInstance->get().DetachEntity(entity->GetId());
|
||||
// If it's the same instance, we can add this entity to the new instance entities.
|
||||
int priorEntitiesSize = entities.size();
|
||||
|
||||
entities.insert(detachedEntity.release());
|
||||
entities.insert(entity);
|
||||
|
||||
// If the size of entities increased, then it wasn't added before.
|
||||
// In that case, add the children of this entity to the queue.
|
||||
@@ -714,20 +705,18 @@ namespace AzToolsFramework
|
||||
|
||||
// Store results
|
||||
outEntities.clear();
|
||||
outEntities.resize(entities.size());
|
||||
AZStd::copy(entities.begin(), entities.end(), outEntities.begin());
|
||||
outEntities.reserve(entities.size());
|
||||
|
||||
for (AZ::Entity* entity : entities)
|
||||
{
|
||||
outEntities.emplace_back(commonRootEntityOwningInstance.DetachEntity(entity->GetId()).release());
|
||||
}
|
||||
|
||||
outInstances.clear();
|
||||
outInstances.reserve(instances.size());
|
||||
for (Instance* instancePtr : instances)
|
||||
{
|
||||
auto parentInstance = instancePtr->GetParentInstance();
|
||||
|
||||
if (parentInstance.has_value())
|
||||
{
|
||||
auto uniquePtr = parentInstance->get().DetachNestedInstance(instancePtr->GetInstanceAlias());
|
||||
outInstances.push_back(AZStd::move(uniquePtr));
|
||||
}
|
||||
outInstances.push_back(AZStd::move(commonRootEntityOwningInstance.DetachNestedInstance(instancePtr->GetInstanceAlias())));
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -745,8 +734,20 @@ namespace AzToolsFramework
|
||||
for (AZ::EntityId entityId : entityIds)
|
||||
{
|
||||
InstanceOptionalReference owningInstance = m_instanceEntityMapperInterface->FindOwningInstance(entityId);
|
||||
// If this is the container entity, it actually represents the instance so get its owner
|
||||
if (owningInstance->get().GetContainerEntityId() == entityId)
|
||||
|
||||
if (!owningInstance.has_value())
|
||||
{
|
||||
AZ_Assert(
|
||||
false,
|
||||
"An error occored in function EntitiesBelongToSameInstance: "
|
||||
"Owning instance of entity with id '%llu' couldn't be found",
|
||||
entityId);
|
||||
return false;
|
||||
}
|
||||
|
||||
// If this is a container entity, it actually represents a child instance so get its owner.
|
||||
// The only exception in the level root instance. We leave it as is to streamline operations.
|
||||
if (owningInstance->get().GetContainerEntityId() == entityId && !IsLevelInstanceContainerEntity(entityId))
|
||||
{
|
||||
owningInstance = owningInstance->get().GetParentInstance();
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace AzToolsFramework
|
||||
|
||||
private:
|
||||
PrefabOperationResult DeleteFromInstance(const EntityIdList& entityIds, bool deleteDescendants);
|
||||
bool RetrieveAndSortPrefabEntitiesAndInstances(const EntityList& inputEntities, const Instance& commonRootEntityOwningInstance,
|
||||
bool RetrieveAndSortPrefabEntitiesAndInstances(const EntityList& inputEntities, Instance& commonRootEntityOwningInstance,
|
||||
EntityList& outEntities, AZStd::vector<AZStd::unique_ptr<Instance>>& outInstances) const;
|
||||
|
||||
InstanceOptionalReference GetOwnerInstanceByEntityId(AZ::EntityId entityId) const;
|
||||
|
||||
@@ -498,12 +498,14 @@ namespace AzToolsFramework
|
||||
return false;
|
||||
}
|
||||
|
||||
Template& sourceTemplate = sourceTemplateReference->get();
|
||||
Template& targetTemplate = targetTemplateReference->get();
|
||||
|
||||
#if defined(AZ_ENABLE_TRACING)
|
||||
Template& sourceTemplate = sourceTemplateReference->get();
|
||||
AZStd::string_view instanceName(instanceIterator->name.GetString(), instanceIterator->name.GetStringLength());
|
||||
const AZStd::string& targetTemplateFilePath = targetTemplate.GetFilePath().Native();
|
||||
const AZStd::string& sourceTemplateFilePath = sourceTemplate.GetFilePath().Native();
|
||||
#endif
|
||||
|
||||
LinkId newLinkId = CreateUniqueLinkId();
|
||||
Link newLink(newLinkId);
|
||||
@@ -731,10 +733,11 @@ namespace AzToolsFramework
|
||||
}
|
||||
|
||||
Template& sourceTemplate = sourceTemplateReference->get();
|
||||
#if defined(AZ_ENABLE_TRACING)
|
||||
Template& targetTemplate = targetTemplateReference->get();
|
||||
#endif
|
||||
|
||||
AZStd::string_view instanceName(instanceIterator->name.GetString(), instanceIterator->name.GetStringLength());
|
||||
const AZStd::string& targetTemplateFilePath = targetTemplate.GetFilePath().Native();
|
||||
|
||||
link.SetSourceTemplateId(sourceTemplateId);
|
||||
link.SetTargetTemplateId(targetTemplateId);
|
||||
|
||||
@@ -35,8 +35,8 @@ namespace AzToolsFramework
|
||||
}
|
||||
|
||||
void PrefabUndoInstance::Capture(
|
||||
PrefabDom& initialState,
|
||||
PrefabDom& endState,
|
||||
const PrefabDom& initialState,
|
||||
const PrefabDom& endState,
|
||||
const TemplateId& templateId)
|
||||
{
|
||||
m_templateId = templateId;
|
||||
@@ -84,7 +84,7 @@ namespace AzToolsFramework
|
||||
|
||||
void PrefabUndoEntityUpdate::Undo()
|
||||
{
|
||||
bool isPatchApplicationSuccessful =
|
||||
[[maybe_unused]] bool isPatchApplicationSuccessful =
|
||||
m_instanceToTemplateInterface->PatchEntityInTemplate(m_undoPatch, m_entityAlias, m_templateId);
|
||||
AZ_Error(
|
||||
"Prefab", isPatchApplicationSuccessful,
|
||||
@@ -94,7 +94,7 @@ namespace AzToolsFramework
|
||||
|
||||
void PrefabUndoEntityUpdate::Redo()
|
||||
{
|
||||
bool isPatchApplicationSuccessful =
|
||||
[[maybe_unused]] bool isPatchApplicationSuccessful =
|
||||
m_instanceToTemplateInterface->PatchEntityInTemplate(m_redoPatch, m_entityAlias, m_templateId);
|
||||
AZ_Error(
|
||||
"Prefab", isPatchApplicationSuccessful,
|
||||
|
||||
@@ -51,8 +51,8 @@ namespace AzToolsFramework
|
||||
explicit PrefabUndoInstance(const AZStd::string& undoOperationName);
|
||||
|
||||
void Capture(
|
||||
PrefabDom& initialState,
|
||||
PrefabDom& endState,
|
||||
const PrefabDom& initialState,
|
||||
const PrefabDom& endState,
|
||||
const TemplateId& templateId);
|
||||
|
||||
void Undo() override;
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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 <AzToolsFramework/Prefab/PrefabDomUtils.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabUndo.h>
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace Prefab
|
||||
{
|
||||
namespace PrefabUndoHelpers
|
||||
{
|
||||
void UpdatePrefabInstance(
|
||||
const Instance& instance, AZStd::string_view undoMessage, const PrefabDom& instanceDomBeforeUpdate,
|
||||
UndoSystem::URSequencePoint* undoBatch)
|
||||
{
|
||||
PrefabDom instanceDomAfterUpdate;
|
||||
PrefabDomUtils::StoreInstanceInPrefabDom(instance, instanceDomAfterUpdate);
|
||||
|
||||
PrefabUndoInstance* state = aznew Prefab::PrefabUndoInstance(undoMessage);
|
||||
state->Capture(instanceDomBeforeUpdate, instanceDomAfterUpdate, instance.GetTemplateId());
|
||||
state->SetParent(undoBatch);
|
||||
state->Redo();
|
||||
}
|
||||
}
|
||||
} // namespace Prefab
|
||||
} // namespace AzToolsFramework
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace Prefab
|
||||
{
|
||||
namespace PrefabUndoHelpers
|
||||
{
|
||||
void UpdatePrefabInstance(
|
||||
const Instance& instance, AZStd::string_view undoMessage, const PrefabDom& instanceDomBeforeUpdate,
|
||||
UndoSystem::URSequencePoint* undoBatch);
|
||||
}
|
||||
} // namespace Prefab
|
||||
} // namespace AzToolsFramework
|
||||
+1
-1
@@ -41,7 +41,7 @@ namespace AzToolsFramework::Prefab::PrefabConversionUtils
|
||||
}
|
||||
|
||||
prefabProcessorContext.ListPrefabs(
|
||||
[this, &serializeContext, &prefabProcessorContext](AZStd::string_view prefabName, PrefabDom& prefab)
|
||||
[this, &serializeContext, &prefabProcessorContext]([[maybe_unused]] AZStd::string_view prefabName, PrefabDom& prefab)
|
||||
{
|
||||
auto result = RemoveEditorInfo(prefab, serializeContext, prefabProcessorContext);
|
||||
if (!result)
|
||||
|
||||
@@ -163,7 +163,8 @@ namespace AzToolsFramework
|
||||
QMainWindow* mainWindow = nullptr;
|
||||
for (QWidget* w : qApp->topLevelWidgets())
|
||||
{
|
||||
if (mainWindow = qobject_cast<QMainWindow*>(w))
|
||||
mainWindow = qobject_cast<QMainWindow*>(w);
|
||||
if (mainWindow)
|
||||
{
|
||||
return mainWindow;
|
||||
}
|
||||
|
||||
+5
@@ -56,6 +56,11 @@ namespace AzToolsFramework
|
||||
return QPixmap();
|
||||
}
|
||||
|
||||
bool EditorEntityUiHandlerBase::CanToggleLockVisibility(AZ::EntityId /*entityId*/) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void EditorEntityUiHandlerBase::PaintItemBackground(QPainter* /*painter*/, const QStyleOptionViewItem& /*option*/, const QModelIndex& /*index*/) const
|
||||
{
|
||||
}
|
||||
|
||||
+2
@@ -45,6 +45,8 @@ namespace AzToolsFramework
|
||||
virtual QString GenerateItemTooltip(AZ::EntityId entityId) const;
|
||||
//! Returns the item icon pixmap to display in the Outliner.
|
||||
virtual QPixmap GenerateItemIcon(AZ::EntityId entityId) const;
|
||||
//! Returns whether the element's lock and visibility state should be accessible in the Outliner
|
||||
virtual bool CanToggleLockVisibility(AZ::EntityId entityId) const;
|
||||
|
||||
//! Paints the background of the item in the Outliner.
|
||||
virtual void PaintItemBackground(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
|
||||
|
||||
@@ -97,8 +97,6 @@ namespace AzToolsFramework
|
||||
AzToolsFramework::Layers::EditorLayerComponentRequestBus::EventResult(
|
||||
layerColor, entityId, &AzToolsFramework::Layers::EditorLayerComponentRequestBus::Events::GetLayerColor);
|
||||
|
||||
const QTreeView* outlinerTreeView(qobject_cast<const QTreeView*>(option.widget));
|
||||
int indentation = outlinerTreeView->indentation();
|
||||
|
||||
bool isFirstColumn = index.column() == EntityOutlinerListModel::ColumnName;
|
||||
bool hasVisibleChildren = index.data(EntityOutlinerListModel::ExpandedRole).value<bool>() && index.model()->hasChildren(index);
|
||||
|
||||
+1
-9
@@ -490,15 +490,7 @@ namespace LegacyFramework
|
||||
|
||||
AZ_Assert(!m_desc.m_enableProjectManager || m_desc.m_enableGUI, "Enabling the project manager in the application settings requires enabling the GUI as well.");
|
||||
|
||||
// if we're a GUI APP we need the UI Framework component:
|
||||
if (m_desc.m_enableGUI)
|
||||
{
|
||||
EnsureComponentCreated(AzToolsFramework::Framework::RTTI_Type());
|
||||
}
|
||||
else
|
||||
{
|
||||
EnsureComponentCreated(AzToolsFramework::Framework::RTTI_Type());
|
||||
}
|
||||
EnsureComponentCreated(AzToolsFramework::Framework::RTTI_Type());
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
|
||||
+54
-37
@@ -351,58 +351,68 @@ namespace AzToolsFramework
|
||||
|
||||
QVariant EntityOutlinerListModel::dataForVisibility(const QModelIndex& index, int role) const
|
||||
{
|
||||
auto id = GetEntityFromIndex(index);
|
||||
auto entityId = GetEntityFromIndex(index);
|
||||
auto entityUiHandler = m_editorEntityFrameworkInterface->GetHandler(entityId);
|
||||
|
||||
switch (role)
|
||||
if (!entityUiHandler || entityUiHandler->CanToggleLockVisibility(entityId))
|
||||
{
|
||||
switch (role)
|
||||
{
|
||||
case Qt::CheckStateRole:
|
||||
{
|
||||
return IsEntitySetToBeVisible(id) ? Qt::Checked : Qt::Unchecked;
|
||||
}
|
||||
{
|
||||
return IsEntitySetToBeVisible(entityId) ? Qt::Checked : Qt::Unchecked;
|
||||
}
|
||||
case Qt::ToolTipRole:
|
||||
{
|
||||
return QString("Show/Hide Entity");
|
||||
}
|
||||
{
|
||||
return QString("Show/Hide Entity");
|
||||
}
|
||||
case Qt::SizeHintRole:
|
||||
{
|
||||
return QSize(20, 20);
|
||||
{
|
||||
return QSize(20, 20);
|
||||
}
|
||||
}
|
||||
return dataForAll(index, role);
|
||||
}
|
||||
|
||||
return dataForAll(index, role);
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QVariant EntityOutlinerListModel::dataForLock(const QModelIndex& index, int role) const
|
||||
{
|
||||
auto id = GetEntityFromIndex(index);
|
||||
auto entityId = GetEntityFromIndex(index);
|
||||
auto entityUiHandler = m_editorEntityFrameworkInterface->GetHandler(entityId);
|
||||
|
||||
switch (role)
|
||||
if (!entityUiHandler || entityUiHandler->CanToggleLockVisibility(entityId))
|
||||
{
|
||||
switch (role)
|
||||
{
|
||||
case Qt::CheckStateRole:
|
||||
{
|
||||
bool isLocked = false;
|
||||
// Lock state is tracked in 3 places:
|
||||
// EditorLockComponent, EditorEntityModel, and ComponentEntityObject.
|
||||
// In addition to that, entities that are in layers can have the layer's lock state override their own.
|
||||
// Retrieving the lock state from the lock component is ideal for drawing the lock icon in the outliner because
|
||||
// the outliner needs to show that specific entity's lock state, and not the actual final lock state including the layer behavior.
|
||||
// The EditorLockComponent only knows about the specific entity's lock state and not the hierarchy.
|
||||
EditorLockComponentRequestBus::EventResult(
|
||||
isLocked, id, &EditorLockComponentRequests::GetLocked);
|
||||
{
|
||||
bool isLocked = false;
|
||||
// Lock state is tracked in 3 places:
|
||||
// EditorLockComponent, EditorEntityModel, and ComponentEntityObject.
|
||||
// In addition to that, entities that are in layers can have the layer's lock state override their own.
|
||||
// Retrieving the lock state from the lock component is ideal for drawing the lock icon in the outliner because
|
||||
// the outliner needs to show that specific entity's lock state, and not the actual final lock state including the layer
|
||||
// behavior. The EditorLockComponent only knows about the specific entity's lock state and not the hierarchy.
|
||||
EditorLockComponentRequestBus::EventResult(isLocked, entityId, &EditorLockComponentRequests::GetLocked);
|
||||
|
||||
return isLocked ? Qt::Checked : Qt::Unchecked;
|
||||
}
|
||||
return isLocked ? Qt::Checked : Qt::Unchecked;
|
||||
}
|
||||
case Qt::ToolTipRole:
|
||||
{
|
||||
return QString("Lock/Unlock Entity (Locked means the entity cannot be moved in the viewport)");
|
||||
}
|
||||
{
|
||||
return QString("Lock/Unlock Entity (Locked means the entity cannot be moved in the viewport)");
|
||||
}
|
||||
case Qt::SizeHintRole:
|
||||
{
|
||||
return QSize(20, 20);
|
||||
{
|
||||
return QSize(20, 20);
|
||||
}
|
||||
}
|
||||
|
||||
return dataForAll(index, role);
|
||||
}
|
||||
|
||||
return dataForAll(index, role);
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QVariant EntityOutlinerListModel::dataForSortIndex(const QModelIndex& index, int role) const
|
||||
@@ -429,8 +439,12 @@ namespace AzToolsFramework
|
||||
if (value.canConvert<Qt::CheckState>())
|
||||
{
|
||||
const auto entityId = GetEntityFromIndex(index);
|
||||
switch (index.column())
|
||||
auto entityUiHandler = m_editorEntityFrameworkInterface->GetHandler(entityId);
|
||||
|
||||
if (!entityUiHandler || entityUiHandler->CanToggleLockVisibility(entityId))
|
||||
{
|
||||
switch (index.column())
|
||||
{
|
||||
case ColumnVisibilityToggle:
|
||||
ToggleEntityVisibility(entityId);
|
||||
break;
|
||||
@@ -438,6 +452,7 @@ namespace AzToolsFramework
|
||||
case ColumnLockToggle:
|
||||
ToggleEntityLockState(entityId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -826,7 +841,6 @@ namespace AzToolsFramework
|
||||
for (const ComponentAssetPair& pair : componentAssetPairs)
|
||||
{
|
||||
const AZ::TypeId& componentType = pair.first;
|
||||
const AZ::Data::AssetId& assetId = pair.second;
|
||||
|
||||
componentsToAdd.push_back(componentType);
|
||||
}
|
||||
@@ -853,7 +867,6 @@ namespace AzToolsFramework
|
||||
}
|
||||
|
||||
// Assign asset associated with each created component.
|
||||
const AZ::Entity::ComponentArrayType& componentsAdded = addComponentsOutcome.GetValue()[targetEntityId].m_componentsAdded;
|
||||
for (const ComponentAssetPair& pair : componentAssetPairs)
|
||||
{
|
||||
const AZ::TypeId& componentType = pair.first;
|
||||
@@ -1978,7 +1991,8 @@ namespace AzToolsFramework
|
||||
}
|
||||
|
||||
// Retrieve the Entity UI Handler
|
||||
AZ::EntityId entityId(index.data(EntityOutlinerListModel::EntityIdRole).value<AZ::u64>());
|
||||
auto firstColumnIndex = index.siblingAtColumn(0);
|
||||
AZ::EntityId entityId(firstColumnIndex.data(EntityOutlinerListModel::EntityIdRole).value<AZ::u64>());
|
||||
auto entityUiHandler = m_editorEntityFrameworkInterface->GetHandler(entityId);
|
||||
|
||||
const bool isSelected = (option.state & QStyle::State_Selected);
|
||||
@@ -2001,8 +2015,11 @@ namespace AzToolsFramework
|
||||
case EntityOutlinerListModel::ColumnVisibilityToggle:
|
||||
case EntityOutlinerListModel::ColumnLockToggle:
|
||||
{
|
||||
// Paint the Visibility and Lock state checkboxes
|
||||
PaintCheckboxes(painter, option, index, isHovered);
|
||||
if (!entityUiHandler || entityUiHandler->CanToggleLockVisibility(entityId))
|
||||
{
|
||||
// Paint the Visibility and Lock state checkboxes
|
||||
PaintCheckboxes(painter, option, index, isHovered);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EntityOutlinerListModel::ColumnName:
|
||||
|
||||
+9
-12
@@ -184,6 +184,7 @@ namespace AzToolsFramework
|
||||
m_gui->m_objectTree->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_gui->m_objectTree->setAutoScrollMargin(20);
|
||||
m_gui->m_objectTree->setIndentation(24);
|
||||
m_gui->m_objectTree->setRootIsDecorated(false);
|
||||
connect(m_gui->m_objectTree, &QTreeView::customContextMenuRequested, this, &EntityOutlinerWidget::OnOpenTreeContextMenu);
|
||||
|
||||
// custom item delegate
|
||||
@@ -804,10 +805,10 @@ namespace AzToolsFramework
|
||||
addAction(m_actionToDeleteSelectionAndDescendants);
|
||||
|
||||
m_actionToRenameSelection = new QAction(tr("Rename"), this);
|
||||
#ifdef Q_OS_MAC
|
||||
#if defined(Q_OS_MAC)
|
||||
// "Alt+Return" translates to Option+Return on macOS
|
||||
m_actionToRenameSelection->setShortcut(tr("Alt+Return"));
|
||||
#elseif Q_OS_WIN
|
||||
#elif defined(Q_OS_WIN)
|
||||
m_actionToRenameSelection->setShortcut(tr("F2"));
|
||||
#endif
|
||||
m_actionToRenameSelection->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||
@@ -1089,16 +1090,6 @@ namespace AzToolsFramework
|
||||
setEnabled(true);
|
||||
SetEntityOutlinerState(m_gui, true);
|
||||
}
|
||||
|
||||
void EntityOutlinerWidget::SetRootEntity(AZ::EntityId rootEntityId)
|
||||
{
|
||||
// The proxy model needs a tick to initialize, else it will return an invalid index in mapFromSource.
|
||||
QTimer::singleShot(0, this, [rootEntityId, this]() {
|
||||
QModelIndex rootIndex = m_listModel->GetIndexFromEntity(rootEntityId);
|
||||
QModelIndex proxyIndex = m_proxyModel->mapFromSource(rootIndex);
|
||||
m_gui->m_objectTree->setRootIndex(proxyIndex);
|
||||
});
|
||||
}
|
||||
|
||||
void EntityOutlinerWidget::SetUpdatesEnabled(bool enable)
|
||||
{
|
||||
@@ -1114,6 +1105,12 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
|
||||
void EntityOutlinerWidget::ExpandEntityChildren(AZ::EntityId entityId)
|
||||
{
|
||||
QModelIndex index = GetIndexFromEntityId(entityId);
|
||||
m_gui->m_objectTree->expand(index);
|
||||
}
|
||||
|
||||
void EntityOutlinerWidget::OnEntityInfoUpdatedAddChildEnd(AZ::EntityId /*parentId*/, AZ::EntityId childId)
|
||||
{
|
||||
QueueContentUpdateSort(childId);
|
||||
|
||||
+1
-1
@@ -106,8 +106,8 @@ namespace AzToolsFramework
|
||||
void LeftComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
|
||||
|
||||
// EntityOutlinerWidgetInterface
|
||||
void SetRootEntity(AZ::EntityId rootEntityId) override;
|
||||
void SetUpdatesEnabled(bool enable) override;
|
||||
void ExpandEntityChildren(AZ::EntityId entityId) override;
|
||||
|
||||
// Build a selection object from the given entities. Entities already in the Widget's selection buffers are ignored.
|
||||
template <class EntityIdCollection>
|
||||
|
||||
+1
-1
@@ -22,8 +22,8 @@ namespace AzToolsFramework
|
||||
public:
|
||||
AZ_RTTI(EntityOutlinerWidgetInterface, "{30C0F252-EC84-4196-BF59-EB9E73B8ADCB}");
|
||||
|
||||
virtual void SetRootEntity(AZ::EntityId rootEntityId) = 0;
|
||||
virtual void SetUpdatesEnabled(bool enable) = 0;
|
||||
virtual void ExpandEntityChildren(AZ::EntityId entityId) = 0;
|
||||
};
|
||||
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* 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 <AzToolsFramework/UI/Prefab/LevelRootUiHandler.h>
|
||||
|
||||
#include <AzToolsFramework/UI/Prefab/PrefabEditInterface.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabPublicInterface.h>
|
||||
#include <AzToolsFramework/UI/Outliner/EntityOutlinerListModel.hxx>
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QPainter>
|
||||
#include <QPainterPath>
|
||||
#include <QTreeView>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
const QColor LevelRootUiHandler::m_levelRootBorderColor = QColor("#656565");
|
||||
const QString LevelRootUiHandler::m_levelRootIconPath = QString(":/Level/level.svg");
|
||||
|
||||
LevelRootUiHandler::LevelRootUiHandler()
|
||||
{
|
||||
m_prefabEditInterface = AZ::Interface<Prefab::PrefabEditInterface>::Get();
|
||||
|
||||
if (m_prefabEditInterface == nullptr)
|
||||
{
|
||||
AZ_Assert(false, "LevelRootUiHandler - could not get PrefabEditInterface on LevelRootUiHandler construction.");
|
||||
return;
|
||||
}
|
||||
|
||||
m_prefabPublicInterface = AZ::Interface<Prefab::PrefabPublicInterface>::Get();
|
||||
|
||||
if (m_prefabPublicInterface == nullptr)
|
||||
{
|
||||
AZ_Assert(false, "LevelRootUiHandler - could not get PrefabPublicInterface on LevelRootUiHandler construction.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QPixmap LevelRootUiHandler::GenerateItemIcon(AZ::EntityId /*entityId*/) const
|
||||
{
|
||||
return QPixmap(m_levelRootIconPath);
|
||||
}
|
||||
|
||||
bool LevelRootUiHandler::CanToggleLockVisibility(AZ::EntityId /*entityId*/) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void LevelRootUiHandler::PaintItemBackground(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& /*index*/) const
|
||||
{
|
||||
if (!painter)
|
||||
{
|
||||
AZ_Warning("LevelRootUiHandler", false, "LevelRootUiHandler - painter is nullptr, can't draw Prefab outliner background.");
|
||||
return;
|
||||
}
|
||||
|
||||
QPen borderLinePen(m_levelRootBorderColor, m_levelRootBorderThickness);
|
||||
|
||||
QRect rect = option.rect;
|
||||
rect.setLeft(rect.left() + (m_levelRootBorderThickness / 2));
|
||||
|
||||
painter->save();
|
||||
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||
painter->setPen(borderLinePen);
|
||||
|
||||
// Draw border at the bottom
|
||||
painter->drawLine(rect.bottomLeft(), rect.bottomRight());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
#include <AzToolsFramework/UI/EditorEntityUi/EditorEntityUiHandlerBase.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace Prefab
|
||||
{
|
||||
class PrefabEditInterface;
|
||||
class PrefabPublicInterface;
|
||||
};
|
||||
|
||||
class LevelRootUiHandler
|
||||
: public EditorEntityUiHandlerBase
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(LevelRootUiHandler, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(AzToolsFramework::LevelRootUiHandler, "{B1D3B270-CD29-4033-873A-D78E76AB24A4}", EditorEntityUiHandlerBase);
|
||||
|
||||
LevelRootUiHandler();
|
||||
~LevelRootUiHandler() override = default;
|
||||
|
||||
// EditorEntityUiHandler...
|
||||
QPixmap GenerateItemIcon(AZ::EntityId entityId) const override;
|
||||
bool CanToggleLockVisibility(AZ::EntityId entityId) const override;
|
||||
void PaintItemBackground(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
|
||||
|
||||
private:
|
||||
Prefab::PrefabEditInterface* m_prefabEditInterface = nullptr;
|
||||
Prefab::PrefabPublicInterface* m_prefabPublicInterface = nullptr;
|
||||
|
||||
static constexpr int m_levelRootBorderThickness = 1;
|
||||
static const QColor m_levelRootBorderColor;
|
||||
static const QString m_levelRootIconPath;
|
||||
|
||||
};
|
||||
} // namespace AzToolsFramework
|
||||
+30
-9
@@ -130,14 +130,14 @@ namespace AzToolsFramework
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
prefabWipFeaturesEnabled, &AzFramework::ApplicationRequests::ArePrefabWipFeaturesEnabled);
|
||||
|
||||
AzToolsFramework::EntityIdList selectedEntities;
|
||||
AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(
|
||||
selectedEntities, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
|
||||
|
||||
if (prefabWipFeaturesEnabled)
|
||||
{
|
||||
// Create Prefab
|
||||
{
|
||||
AzToolsFramework::EntityIdList selectedEntities;
|
||||
AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(
|
||||
selectedEntities, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
|
||||
|
||||
if (!selectedEntities.empty())
|
||||
{
|
||||
bool layerInSelection = false;
|
||||
@@ -186,10 +186,6 @@ namespace AzToolsFramework
|
||||
|
||||
// Edit/Save Prefab
|
||||
{
|
||||
AzToolsFramework::EntityIdList selectedEntities;
|
||||
AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(
|
||||
selectedEntities, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
|
||||
|
||||
if (selectedEntities.size() == 1)
|
||||
{
|
||||
AZ::EntityId selectedEntity = selectedEntities[0];
|
||||
@@ -237,6 +233,14 @@ namespace AzToolsFramework
|
||||
{
|
||||
menu->addSeparator();
|
||||
}
|
||||
|
||||
QAction* deleteAction = menu->addAction(QObject::tr("Delete"));
|
||||
QObject::connect(deleteAction, &QAction::triggered, deleteAction, [this] { ContextMenu_DeleteSelected(); });
|
||||
if (selectedEntities.size() == 0 ||
|
||||
(selectedEntities.size() == 1 && s_prefabPublicInterface->IsLevelInstanceContainerEntity(selectedEntities[0])))
|
||||
{
|
||||
deleteAction->setDisabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void PrefabIntegrationManager::HandleSourceFileType(AZStd::string_view sourceFilePath, AZ::EntityId parentId, AZ::Vector3 position) const
|
||||
@@ -369,6 +373,16 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
|
||||
void PrefabIntegrationManager::ContextMenu_DeleteSelected()
|
||||
{
|
||||
AzToolsFramework::EntityIdList selectedEntityIds;
|
||||
AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(
|
||||
selectedEntityIds, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
|
||||
|
||||
AzToolsFramework::ToolsApplicationRequestBus::Broadcast(
|
||||
&AzToolsFramework::ToolsApplicationRequests::DeleteEntitiesAndAllDescendants, selectedEntityIds);
|
||||
}
|
||||
|
||||
void PrefabIntegrationManager::GenerateSuggestedFilenameFromEntities(const EntityIdList& entityIds, AZStd::string& outName)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
@@ -972,7 +986,14 @@ namespace AzToolsFramework
|
||||
|
||||
void PrefabIntegrationManager::OnPrefabComponentActivate(AZ::EntityId entityId)
|
||||
{
|
||||
s_editorEntityUiInterface->RegisterEntity(entityId, m_prefabUiHandler.GetHandlerId());
|
||||
if (s_prefabPublicInterface->IsLevelInstanceContainerEntity(entityId))
|
||||
{
|
||||
s_editorEntityUiInterface->RegisterEntity(entityId, m_levelRootUiHandler.GetHandlerId());
|
||||
}
|
||||
else
|
||||
{
|
||||
s_editorEntityUiInterface->RegisterEntity(entityId, m_prefabUiHandler.GetHandlerId());
|
||||
}
|
||||
}
|
||||
|
||||
void PrefabIntegrationManager::OnPrefabComponentDeactivate(AZ::EntityId entityId)
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserSourceDropBus.h>
|
||||
#include <AzToolsFramework/Editor/EditorContextMenuBus.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabPublicInterface.h>
|
||||
#include <AzToolsFramework/UI/Prefab/LevelRootUiHandler.h>
|
||||
#include <AzToolsFramework/UI/Prefab/PrefabEditManager.h>
|
||||
#include <AzToolsFramework/UI/Prefab/PrefabIntegrationBus.h>
|
||||
#include <AzToolsFramework/UI/Prefab/PrefabIntegrationInterface.h>
|
||||
@@ -77,6 +78,9 @@ namespace AzToolsFramework
|
||||
// Manages the Edit Mode UI for prefabs
|
||||
PrefabEditManager m_prefabEditManager;
|
||||
|
||||
// Used to handle the UI for the level root
|
||||
LevelRootUiHandler m_levelRootUiHandler;
|
||||
|
||||
// Used to handle the UI for prefab entities
|
||||
PrefabUiHandler m_prefabUiHandler;
|
||||
|
||||
@@ -85,6 +89,7 @@ namespace AzToolsFramework
|
||||
static void ContextMenu_InstantiatePrefab();
|
||||
static void ContextMenu_EditPrefab(AZ::EntityId containerEntity);
|
||||
static void ContextMenu_SavePrefab(AZ::EntityId containerEntity);
|
||||
static void ContextMenu_DeleteSelected();
|
||||
|
||||
// Prompt and resolve dialogs
|
||||
static bool QueryUserForPrefabSaveLocation(
|
||||
|
||||
+43
-3
@@ -62,6 +62,7 @@ AZ_POP_DISABLE_WARNING
|
||||
|
||||
#include <UI/PropertyEditor/Model/AssetCompleterModel.h>
|
||||
#include <UI/PropertyEditor/View/AssetCompleterListView.h>
|
||||
#include <UI/PropertyEditor/ThumbnailDropDown.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
@@ -95,6 +96,12 @@ namespace AzToolsFramework
|
||||
m_thumbnail->setFixedSize(QSize(24, 24));
|
||||
m_thumbnail->setVisible(false);
|
||||
|
||||
m_thumbnailDropDown = new ThumbnailDropDown(this);
|
||||
m_thumbnailDropDown->setFixedSize(QSize(40, 24));
|
||||
m_thumbnailDropDown->setVisible(false);
|
||||
|
||||
connect(m_thumbnailDropDown, &ThumbnailDropDown::clicked, this, &PropertyAssetCtrl::OnEditButtonClicked);
|
||||
|
||||
m_editButton = new QToolButton(this);
|
||||
m_editButton->setAutoRaise(true);
|
||||
m_editButton->setIcon(QIcon(":/stylesheet/img/UI20/open-in-internal-app.svg"));
|
||||
@@ -104,6 +111,7 @@ namespace AzToolsFramework
|
||||
connect(m_editButton, &QToolButton::clicked, this, &PropertyAssetCtrl::OnEditButtonClicked);
|
||||
|
||||
pLayout->addWidget(m_thumbnail);
|
||||
pLayout->addWidget(m_thumbnailDropDown);
|
||||
pLayout->addWidget(m_browseEdit);
|
||||
pLayout->addWidget(m_editButton);
|
||||
|
||||
@@ -1082,8 +1090,9 @@ namespace AzToolsFramework
|
||||
void PropertyAssetCtrl::UpdateThumbnail()
|
||||
{
|
||||
m_thumbnail->setVisible(m_showThumbnail);
|
||||
m_thumbnailDropDown->setVisible(m_showThumbnailDropDown);
|
||||
|
||||
if (m_showThumbnail)
|
||||
if (m_showThumbnail || m_showThumbnailDropDown)
|
||||
{
|
||||
const AZ::Data::AssetId assetID = GetCurrentAssetID();
|
||||
if (assetID.IsValid())
|
||||
@@ -1098,13 +1107,21 @@ namespace AzToolsFramework
|
||||
if (result)
|
||||
{
|
||||
SharedThumbnailKey thumbnailKey = MAKE_TKEY(AzToolsFramework::AssetBrowser::ProductThumbnailKey, assetID);
|
||||
m_thumbnail->SetThumbnailKey(thumbnailKey, Thumbnailer::ThumbnailContext::DefaultContext);
|
||||
if (m_showThumbnail)
|
||||
{
|
||||
m_thumbnail->SetThumbnailKey(thumbnailKey, Thumbnailer::ThumbnailContext::DefaultContext);
|
||||
}
|
||||
if (m_showThumbnailDropDown)
|
||||
{
|
||||
m_thumbnailDropDown->SetThumbnailKey(thumbnailKey, Thumbnailer::ThumbnailContext::DefaultContext);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_thumbnail->ClearThumbnail();
|
||||
m_thumbnailDropDown->ClearThumbnail();
|
||||
}
|
||||
|
||||
void PropertyAssetCtrl::SetClearButtonEnabled(bool enable)
|
||||
@@ -1138,6 +1155,16 @@ namespace AzToolsFramework
|
||||
return m_showThumbnail;
|
||||
}
|
||||
|
||||
void PropertyAssetCtrl::SetShowThumbnailDropDown(bool enable)
|
||||
{
|
||||
m_showThumbnailDropDown = enable;
|
||||
}
|
||||
|
||||
bool PropertyAssetCtrl::GetShowThumbnailDropDown() const
|
||||
{
|
||||
return m_showThumbnailDropDown;
|
||||
}
|
||||
|
||||
const AZ::Uuid& AssetPropertyHandlerDefault::GetHandledType() const
|
||||
{
|
||||
return AZ::GetAssetClassId();
|
||||
@@ -1248,7 +1275,7 @@ namespace AzToolsFramework
|
||||
GUI->SetBrowseButtonIcon(QIcon(iconPath.c_str()));
|
||||
}
|
||||
}
|
||||
else if (attrib == AZ_CRC_CE("ShowThumbnail"))
|
||||
else if (attrib == AZ_CRC_CE("Thumbnail"))
|
||||
{
|
||||
bool showThumbnail = false;
|
||||
if (attrValue->Read<bool>(showThumbnail))
|
||||
@@ -1256,6 +1283,19 @@ namespace AzToolsFramework
|
||||
GUI->SetShowThumbnail(showThumbnail);
|
||||
}
|
||||
}
|
||||
else if (attrib == AZ_CRC_CE("ThumbnailWithDropDown"))
|
||||
{
|
||||
PropertyAssetCtrl::EditCallbackType* func = azdynamic_cast<PropertyAssetCtrl::EditCallbackType*>(attrValue->GetAttribute());
|
||||
if (func)
|
||||
{
|
||||
GUI->SetShowThumbnailDropDown(true);
|
||||
GUI->SetEditNotifyCallback(func);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI->SetEditNotifyCallback(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AssetPropertyHandlerDefault::WriteGUIValuesIntoProperty(size_t index, PropertyAssetCtrl* GUI, property_t& instance, InstanceDataNode* node)
|
||||
|
||||
+6
@@ -45,6 +45,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
class AssetCompleterModel;
|
||||
class AssetCompleterListView;
|
||||
class ThumbnailDropDown;
|
||||
|
||||
namespace Thumbnailer
|
||||
{
|
||||
@@ -94,6 +95,7 @@ namespace AzToolsFramework
|
||||
void OnAssetIDChanged(AZ::Data::AssetId newAssetID);
|
||||
|
||||
protected:
|
||||
ThumbnailDropDown* m_thumbnailDropDown = nullptr;
|
||||
Thumbnailer::ThumbnailWidget* m_thumbnail = nullptr;
|
||||
QPushButton* m_errorButton = nullptr;
|
||||
QToolButton* m_editButton = nullptr;
|
||||
@@ -156,6 +158,8 @@ namespace AzToolsFramework
|
||||
|
||||
bool m_showThumbnail = false;
|
||||
|
||||
bool m_showThumbnailDropDown = false;
|
||||
|
||||
// ! Default suffix used in the field's placeholder text when a default value is set.
|
||||
const char* m_DefaultSuffix = " (default)";
|
||||
|
||||
@@ -205,6 +209,8 @@ namespace AzToolsFramework
|
||||
|
||||
void SetShowThumbnail(bool enable);
|
||||
bool GetShowThumbnail() const;
|
||||
void SetShowThumbnailDropDown(bool enable);
|
||||
bool GetShowThumbnailDropDown() const;
|
||||
|
||||
void SetSelectedAssetID(const AZ::Data::AssetId& newID);
|
||||
void SetCurrentAssetType(const AZ::Data::AssetType& newType);
|
||||
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* 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 <AzToolsFramework/Debug/TraceContext.h>
|
||||
AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // 4251: 'QRawFont::d': class 'QExplicitlySharedDataPointer<QRawFontPrivate>' needs to have dll-interface to be used by clients of class 'QRawFont'
|
||||
// 4800: 'QTextEngine *const ': forcing value to bool 'true' or 'false' (performance warning)
|
||||
#include <QLabel>
|
||||
#include <QHBoxLayout>
|
||||
#include <QEvent>
|
||||
#include <QPainter>
|
||||
#include <UI/UICore/AspectRatioAwarePixmapWidget.hxx>
|
||||
#include <Thumbnails/ThumbnailWidget.h>
|
||||
AZ_POP_DISABLE_WARNING
|
||||
#include "ThumbnailDropDown.h"
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
ThumbnailDropDown::ThumbnailDropDown(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
QHBoxLayout* pLayout = new QHBoxLayout();
|
||||
pLayout->setContentsMargins(0, 0, 0, 0);
|
||||
pLayout->setSpacing(0);
|
||||
|
||||
m_thumbnail = new Thumbnailer::ThumbnailWidget(this);
|
||||
m_thumbnail->setFixedSize(QSize(24, 24));
|
||||
|
||||
m_dropDownArrow = new AspectRatioAwarePixmapWidget(this);
|
||||
m_dropDownArrow->setPixmap(QPixmap(":/stylesheet/img/triangle0.png"));
|
||||
m_dropDownArrow->setFixedSize(QSize(8, 24));
|
||||
|
||||
m_emptyThumbnail = new QLabel(this);
|
||||
m_emptyThumbnail->setPixmap(QPixmap(":/stylesheet/img/line.png"));
|
||||
m_emptyThumbnail->setFixedSize(QSize(24, 24));
|
||||
|
||||
pLayout->addWidget(m_emptyThumbnail);
|
||||
pLayout->addWidget(m_thumbnail);
|
||||
pLayout->addSpacing(4);
|
||||
pLayout->addWidget(m_dropDownArrow);
|
||||
pLayout->addSpacing(4);
|
||||
|
||||
setLayout(pLayout);
|
||||
}
|
||||
|
||||
void ThumbnailDropDown::SetThumbnailKey(Thumbnailer::SharedThumbnailKey key, const char* contextName)
|
||||
{
|
||||
m_emptyThumbnail->setVisible(false);
|
||||
m_thumbnail->SetThumbnailKey(key, contextName);
|
||||
}
|
||||
|
||||
void ThumbnailDropDown::ClearThumbnail()
|
||||
{
|
||||
m_emptyThumbnail->setVisible(true);
|
||||
m_thumbnail->ClearThumbnail();
|
||||
}
|
||||
|
||||
bool ThumbnailDropDown::event(QEvent* e)
|
||||
{
|
||||
if (isEnabled())
|
||||
{
|
||||
if (e->type() == QEvent::MouseButtonPress)
|
||||
{
|
||||
emit clicked();
|
||||
return true; //ignore
|
||||
}
|
||||
}
|
||||
|
||||
return QWidget::event(e);
|
||||
}
|
||||
|
||||
void ThumbnailDropDown::paintEvent(QPaintEvent* e)
|
||||
{
|
||||
QPainter p(this);
|
||||
QRect targetRect(QPoint(), QSize(40, 24));
|
||||
p.fillRect(targetRect, QColor(17, 17, 17)); // #111111
|
||||
QWidget::paintEvent(e);
|
||||
}
|
||||
|
||||
void ThumbnailDropDown::enterEvent(QEvent* e)
|
||||
{
|
||||
m_dropDownArrow->setPixmap(QPixmap(":/stylesheet/img/triangle0_highlighted.png"));
|
||||
QWidget::enterEvent(e);
|
||||
}
|
||||
|
||||
void ThumbnailDropDown::leaveEvent(QEvent* e)
|
||||
{
|
||||
m_dropDownArrow->setPixmap(QPixmap(":/stylesheet/img/triangle0.png"));
|
||||
QWidget::leaveEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
#include "UI/PropertyEditor/moc_ThumbnailDropDown.cpp"
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
#pragma once
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <AzCore/PlatformDef.h>
|
||||
#include <AzToolsFramework/Thumbnails/Thumbnail.h>
|
||||
AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // 4251: class '...' needs to have dll-interface to be used by clients of class '...'
|
||||
// 4800: 'uint': forcing value to bool 'true' or 'false' (performance warning)
|
||||
#include <QWidget>
|
||||
AZ_POP_DISABLE_WARNING
|
||||
#endif
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
class AspectRatioAwarePixmapWidget;
|
||||
|
||||
namespace Thumbnailer
|
||||
{
|
||||
class ThumbnailWidget;
|
||||
}
|
||||
|
||||
class ThumbnailDropDown : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ThumbnailDropDown(QWidget* parent = nullptr);
|
||||
|
||||
//! Call this to set what thumbnail widget will display
|
||||
void SetThumbnailKey(Thumbnailer::SharedThumbnailKey key, const char* contextName = "Default");
|
||||
//! Remove current thumbnail
|
||||
void ClearThumbnail();
|
||||
|
||||
bool event(QEvent* e) override;
|
||||
|
||||
Q_SIGNALS:
|
||||
void clicked();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* e) override;
|
||||
void enterEvent(QEvent* e) override;
|
||||
void leaveEvent(QEvent* e) override;
|
||||
|
||||
private:
|
||||
Thumbnailer::ThumbnailWidget* m_thumbnail = nullptr;
|
||||
QLabel* m_emptyThumbnail = nullptr;
|
||||
AspectRatioAwarePixmapWidget* m_dropDownArrow = nullptr;
|
||||
};
|
||||
}
|
||||
@@ -417,6 +417,8 @@ set(FILES
|
||||
UI/PropertyEditor/GrowTextEdit.cpp
|
||||
UI/PropertyEditor/MultiLineTextEditHandler.h
|
||||
UI/PropertyEditor/MultiLineTextEditHandler.cpp
|
||||
UI/PropertyEditor/ThumbnailDropDown.h
|
||||
UI/PropertyEditor/ThumbnailDropDown.cpp
|
||||
UI/Slice/SlicePushWidget.cpp
|
||||
UI/Slice/SlicePushWidget.hxx
|
||||
UI/Slice/SliceOverridesNotificationWindow.cpp
|
||||
@@ -647,6 +649,15 @@ set(FILES
|
||||
Prefab/Instance/TemplateInstanceMapperInterface.h
|
||||
Prefab/Link/Link.h
|
||||
Prefab/Link/Link.cpp
|
||||
Prefab/PrefabPublicHandler.h
|
||||
Prefab/PrefabPublicHandler.cpp
|
||||
Prefab/PrefabPublicInterface.h
|
||||
Prefab/PrefabUndo.h
|
||||
Prefab/PrefabUndo.cpp
|
||||
Prefab/PrefabUndoCache.cpp
|
||||
Prefab/PrefabUndoCache.h
|
||||
Prefab/PrefabUndoHelpers.cpp
|
||||
Prefab/PrefabUndoHelpers.h
|
||||
Prefab/Spawnable/ComponentRequirementsValidator.h
|
||||
Prefab/Spawnable/ComponentRequirementsValidator.cpp
|
||||
Prefab/Spawnable/EditorInfoRemover.h
|
||||
@@ -672,13 +683,6 @@ set(FILES
|
||||
Prefab/Spawnable/SpawnableUtils.cpp
|
||||
Prefab/Template/Template.h
|
||||
Prefab/Template/Template.cpp
|
||||
Prefab/PrefabUndo.h
|
||||
Prefab/PrefabUndo.cpp
|
||||
Prefab/PrefabUndoCache.cpp
|
||||
Prefab/PrefabUndoCache.h
|
||||
Prefab/PrefabPublicHandler.h
|
||||
Prefab/PrefabPublicHandler.cpp
|
||||
Prefab/PrefabPublicInterface.h
|
||||
UI/Outliner/EntityOutlinerDisplayOptionsMenu.h
|
||||
UI/Outliner/EntityOutlinerDisplayOptionsMenu.cpp
|
||||
UI/Outliner/EntityOutlinerTreeView.hxx
|
||||
@@ -703,6 +707,8 @@ set(FILES
|
||||
UI/EditorEntityUi/EditorEntityUiSystemComponent.cpp
|
||||
UI/Layer/LayerUiHandler.h
|
||||
UI/Layer/LayerUiHandler.cpp
|
||||
UI/Prefab/LevelRootUiHandler.h
|
||||
UI/Prefab/LevelRootUiHandler.cpp
|
||||
UI/Prefab/PrefabEditInterface.h
|
||||
UI/Prefab/PrefabEditManager.h
|
||||
UI/Prefab/PrefabEditManager.cpp
|
||||
|
||||
@@ -196,8 +196,7 @@ namespace UnitTest
|
||||
fileIO->Remove(s_catalogFile);
|
||||
}
|
||||
|
||||
int platformCount = 0;
|
||||
for (auto thisPlatform : m_testPlatforms)
|
||||
for (size_t platformCount = 0; platformCount < s_totalTestPlatforms; ++platformCount)
|
||||
{
|
||||
// Deleting all the temporary files
|
||||
for (int idx = 0; idx < s_totalAssets; idx++)
|
||||
@@ -208,7 +207,6 @@ namespace UnitTest
|
||||
fileIO->Remove(m_assetsPathFull[platformCount][idx].c_str());
|
||||
}
|
||||
}
|
||||
++platformCount;
|
||||
}
|
||||
|
||||
if (fileIO->Exists(TestSliceAssetPath))
|
||||
|
||||
@@ -448,7 +448,7 @@ namespace UnitTest
|
||||
entity->Deactivate();
|
||||
|
||||
// Add placeholder component which implements component mode.
|
||||
const AZ::Component* placeholder1 = entity->CreateComponent<OverrideMouseInteractionComponent>();
|
||||
entity->CreateComponent<OverrideMouseInteractionComponent>();
|
||||
|
||||
entity->Activate();
|
||||
|
||||
|
||||
@@ -200,7 +200,6 @@ namespace UnitTest
|
||||
PrefabTestComponent* prefabTestComponent = aznew PrefabTestComponent(true);
|
||||
entity->Deactivate();
|
||||
entity->AddComponent(prefabTestComponent);
|
||||
auto expectedComponentId = prefabTestComponent->GetId();
|
||||
PrefabDom updatedDom;
|
||||
ASSERT_TRUE(PrefabDomUtils::StoreInstanceInPrefabDom(*newInstance, updatedDom));
|
||||
newTemplateDom.CopyFrom(updatedDom, newTemplateDom.GetAllocator());
|
||||
|
||||
@@ -136,7 +136,6 @@ namespace UnitTest
|
||||
builder.Add("RandomKey", this->GetValue());
|
||||
|
||||
AzFramework::SpawnableMetaData metaData(builder.BuildMetaData());
|
||||
GetType stored{};
|
||||
EXPECT_EQ(this->GetValueType(), metaData.GetType("RandomKey"));
|
||||
}
|
||||
|
||||
|
||||
@@ -570,7 +570,7 @@ namespace UnitTest
|
||||
|
||||
TestComponentD_V1::Reflect(m_serializeContext.get());
|
||||
AZ::Entity* entity = aznew AZ::Entity();
|
||||
TestComponentD_V1* component = entity->CreateComponent<TestComponentD_V1>();
|
||||
entity->CreateComponent<TestComponentD_V1>();
|
||||
// Supply a specific Asset Guid to help with debugging
|
||||
AZ::Data::AssetId sliceAssetId = SaveAsSlice(entity, "{10000000-0000-0000-0000-000000000000}", "datapatch_base.slice");
|
||||
entity = nullptr;
|
||||
|
||||
@@ -149,7 +149,6 @@ namespace UnitTest
|
||||
});
|
||||
|
||||
auto clusterEntry = m_viewportManagerWrapper.GetViewportManager()->GetClusterMap().find(clusterId);
|
||||
auto button = clusterEntry->second->GetButton(buttonId);
|
||||
|
||||
// trigger the cluster
|
||||
m_viewportManagerWrapper.GetViewportManager()->RegisterClusterEventHandler(clusterId, handler);
|
||||
|
||||
Reference in New Issue
Block a user