Merge remote-tracking branch 'origin/stabilization/2110' into viewport/EditorModeUIBackButton
This commit is contained in:
@@ -1677,9 +1677,13 @@ namespace AZ
|
||||
// they will trigger a ReleaseAsset call sometime after the AssetManager has begun to shut down, which can lead to
|
||||
// race conditions.
|
||||
|
||||
// Make sure the streamer request is removed first before the asset is released
|
||||
// If the asset is released first it could lead to a race condition where another thread starts loading the asset
|
||||
// again and attempts to add a new streamer request with the same ID before the old one has been removed, causing
|
||||
// that load request to fail
|
||||
RemoveActiveStreamerRequest(assetId);
|
||||
weakAsset = {};
|
||||
loadingAsset.Reset();
|
||||
RemoveActiveStreamerRequest(assetId);
|
||||
};
|
||||
|
||||
auto&& [deadline, priority] = GetEffectiveDeadlineAndPriority(*handler, asset.GetType(), loadParams);
|
||||
|
||||
@@ -56,11 +56,12 @@ namespace AZ
|
||||
int numberOfWorkerThreads = m_numberOfWorkerThreads;
|
||||
if (numberOfWorkerThreads <= 0) // spawn default number of threads
|
||||
{
|
||||
#if (AZ_TRAIT_THREAD_NUM_JOB_MANAGER_WORKER_THREADS)
|
||||
numberOfWorkerThreads = AZ_TRAIT_THREAD_NUM_JOB_MANAGER_WORKER_THREADS;
|
||||
#else
|
||||
uint32_t scaledHardwareThreads = Threading::CalcNumWorkerThreads(cl_jobThreadsConcurrencyRatio, cl_jobThreadsMinNumber, cl_jobThreadsNumReserved);
|
||||
numberOfWorkerThreads = AZ::GetMin(static_cast<unsigned int>(desc.m_workerThreads.capacity()), scaledHardwareThreads);
|
||||
#if (AZ_TRAIT_MAX_JOB_MANAGER_WORKER_THREADS)
|
||||
numberOfWorkerThreads = AZ::GetMin(numberOfWorkerThreads, AZ_TRAIT_MAX_JOB_MANAGER_WORKER_THREADS);
|
||||
#endif // (AZ_TRAIT_MAX_JOB_MANAGER_WORKER_THREADS)
|
||||
#endif // (AZ_TRAIT_THREAD_NUM_JOB_MANAGER_WORKER_THREADS)
|
||||
}
|
||||
|
||||
threadDesc.m_cpuId = AFFINITY_MASK_USERTHREADS;
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace AZ
|
||||
void Set(float x, float y, float z);
|
||||
|
||||
//! Sets components from an array of 3 floats in xyz order.
|
||||
void Set(float values[]);
|
||||
void Set(const float values[]);
|
||||
|
||||
//! Indexed access using operator(), just for convenience.
|
||||
float operator()(int32_t index) const;
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace AZ
|
||||
}
|
||||
|
||||
|
||||
AZ_MATH_INLINE void Vector3::Set(float values[])
|
||||
AZ_MATH_INLINE void Vector3::Set(const float values[])
|
||||
{
|
||||
m_value = Simd::Vec3::LoadImmediate(values[0], values[1], values[2]);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,12 @@ namespace AZ
|
||||
|
||||
if (!s_instance)
|
||||
{
|
||||
s_instance = AZ::Environment::CreateVariable<NameDictionary>(NameDictionaryInstanceName);
|
||||
// Because the NameDictionary allocates memory using the AZ::Allocator and it is created
|
||||
// in the executable memory space, it's ownership cannot be transferred to other module memory spaces
|
||||
// Otherwise this could cause the the NameDictionary to be destroyed in static de-init
|
||||
// after the AZ::Allocators have been destroyed
|
||||
// Therefore we supply the isTransferOwnership value of false using CreateVariableEx
|
||||
s_instance = AZ::Environment::CreateVariableEx<NameDictionary>(NameDictionaryInstanceName, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +55,12 @@ namespace AZ
|
||||
|
||||
if (!s_instance)
|
||||
{
|
||||
s_instance = Environment::FindVariable<NameDictionary>(NameDictionaryInstanceName);
|
||||
// Because the NameDictionary allocates memory using the AZ::Allocator and it is created
|
||||
// in the executable memory space, it's ownership cannot be transferred to other module memory spaces
|
||||
// Otherwise this could cause the the NameDictionary to be destroyed in static de-init
|
||||
// after the AZ::Allocators have been destroyed
|
||||
// Therefore we supply the isTransferOwnership value of false using CreateVariableEx
|
||||
s_instance = AZ::Environment::CreateVariableEx<NameDictionary>(NameDictionaryInstanceName, true, false);
|
||||
}
|
||||
|
||||
return s_instance.IsConstructed();
|
||||
|
||||
@@ -104,6 +104,8 @@ namespace AZ
|
||||
->HandlesType<AZStd::variant>();
|
||||
jsonContext->Serializer<JsonOptionalSerializer>()
|
||||
->HandlesType<AZStd::optional>();
|
||||
jsonContext->Serializer<JsonBitsetSerializer>()
|
||||
->HandlesType<AZStd::bitset>();
|
||||
|
||||
MathReflect(jsonContext);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace AZ
|
||||
AZ_CLASS_ALLOCATOR_IMPL(JsonAnySerializer, SystemAllocator, 0);
|
||||
AZ_CLASS_ALLOCATOR_IMPL(JsonVariantSerializer, SystemAllocator, 0);
|
||||
AZ_CLASS_ALLOCATOR_IMPL(JsonOptionalSerializer, SystemAllocator, 0);
|
||||
AZ_CLASS_ALLOCATOR_IMPL(JsonBitsetSerializer, SystemAllocator, 0);
|
||||
|
||||
JsonSerializationResult::Result JsonUnsupportedTypesSerializer::Load(void*, const Uuid&, const rapidjson::Value&,
|
||||
JsonDeserializerContext& context)
|
||||
@@ -49,4 +50,10 @@ namespace AZ
|
||||
return "The Json Serialization doesn't support AZStd::optional by design. No JSON format has yet been found that wasn't deemed too "
|
||||
"complex or overly verbose.";
|
||||
}
|
||||
|
||||
AZStd::string_view JsonBitsetSerializer::GetMessage() const
|
||||
{
|
||||
return "The Json Serialization doesn't support AZStd::bitset by design. No JSON format has yet been found that is content creator "
|
||||
"friendly i.e., easy to comprehend the intent.";
|
||||
}
|
||||
} // namespace AZ
|
||||
|
||||
@@ -65,4 +65,14 @@ namespace AZ
|
||||
protected:
|
||||
AZStd::string_view GetMessage() const override;
|
||||
};
|
||||
|
||||
class JsonBitsetSerializer : public JsonUnsupportedTypesSerializer
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(JsonBitsetSerializer, "{10CE969D-D69E-4B3F-8593-069736F8F705}", JsonUnsupportedTypesSerializer);
|
||||
AZ_CLASS_ALLOCATOR_DECL;
|
||||
|
||||
protected:
|
||||
AZStd::string_view GetMessage() const override;
|
||||
};
|
||||
} // namespace AZ
|
||||
|
||||
@@ -30,8 +30,13 @@ namespace AZ
|
||||
|
||||
if (Interface<TaskGraphActiveInterface>::Get() == nullptr)
|
||||
{
|
||||
#if (AZ_TRAIT_THREAD_NUM_TASK_GRAPH_WORKER_THREADS)
|
||||
const uint32_t numberOfWorkerThreads = AZ_TRAIT_THREAD_NUM_TASK_GRAPH_WORKER_THREADS;
|
||||
#else
|
||||
const uint32_t numberOfWorkerThreads = Threading::CalcNumWorkerThreads(cl_taskGraphThreadsConcurrencyRatio, cl_taskGraphThreadsMinNumber, cl_taskGraphThreadsNumReserved);
|
||||
#endif // (AZ_TRAIT_THREAD_NUM_TASK_GRAPH_WORKER_THREADS)
|
||||
Interface<TaskGraphActiveInterface>::Register(this); // small window that another thread can try to use taskgraph between this line and the set instance.
|
||||
m_taskExecutor = aznew TaskExecutor(Threading::CalcNumWorkerThreads(cl_taskGraphThreadsConcurrencyRatio, cl_taskGraphThreadsMinNumber, cl_taskGraphThreadsNumReserved));
|
||||
m_taskExecutor = aznew TaskExecutor(numberOfWorkerThreads);
|
||||
TaskExecutor::SetInstance(m_taskExecutor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,6 @@
|
||||
#define AZ_TRAIT_HEAPSCHEMA_COMPILE_MALLINFO 0
|
||||
#define AZ_TRAIT_IS_ABS_PATH_IF_COLON_FOUND_ANYWHERE 0
|
||||
#define AZ_TRAIT_JSON_CLANG_IGNORE_UNKNOWN_WARNING 0
|
||||
#define AZ_TRAIT_MAX_JOB_MANAGER_WORKER_THREADS 0
|
||||
#define AZ_TRAIT_PERF_MEMORYBENCHMARK_IS_AVAILABLE 0
|
||||
#define AZ_TRAIT_PUMP_SYSTEM_EVENTS_WHILE_LOADING 0
|
||||
#define AZ_TRAIT_PUMP_SYSTEM_EVENTS_WHILE_LOADING_INTERVAL_MS 0
|
||||
|
||||
@@ -75,7 +75,6 @@
|
||||
#define AZ_TRAIT_HEAPSCHEMA_COMPILE_MALLINFO 1
|
||||
#define AZ_TRAIT_IS_ABS_PATH_IF_COLON_FOUND_ANYWHERE 0
|
||||
#define AZ_TRAIT_JSON_CLANG_IGNORE_UNKNOWN_WARNING 0
|
||||
#define AZ_TRAIT_MAX_JOB_MANAGER_WORKER_THREADS 0
|
||||
#define AZ_TRAIT_PERF_MEMORYBENCHMARK_IS_AVAILABLE 0
|
||||
#define AZ_TRAIT_PUMP_SYSTEM_EVENTS_WHILE_LOADING 0
|
||||
#define AZ_TRAIT_PUMP_SYSTEM_EVENTS_WHILE_LOADING_INTERVAL_MS 0
|
||||
|
||||
@@ -75,7 +75,6 @@
|
||||
#define AZ_TRAIT_HEAPSCHEMA_COMPILE_MALLINFO 1
|
||||
#define AZ_TRAIT_IS_ABS_PATH_IF_COLON_FOUND_ANYWHERE 0
|
||||
#define AZ_TRAIT_JSON_CLANG_IGNORE_UNKNOWN_WARNING 0
|
||||
#define AZ_TRAIT_MAX_JOB_MANAGER_WORKER_THREADS 0
|
||||
#define AZ_TRAIT_PERF_MEMORYBENCHMARK_IS_AVAILABLE 0
|
||||
#define AZ_TRAIT_PUMP_SYSTEM_EVENTS_WHILE_LOADING 0
|
||||
#define AZ_TRAIT_PUMP_SYSTEM_EVENTS_WHILE_LOADING_INTERVAL_MS 0
|
||||
|
||||
@@ -75,7 +75,6 @@
|
||||
#define AZ_TRAIT_HEAPSCHEMA_COMPILE_MALLINFO 1
|
||||
#define AZ_TRAIT_IS_ABS_PATH_IF_COLON_FOUND_ANYWHERE 0
|
||||
#define AZ_TRAIT_JSON_CLANG_IGNORE_UNKNOWN_WARNING 1
|
||||
#define AZ_TRAIT_MAX_JOB_MANAGER_WORKER_THREADS 0
|
||||
#define AZ_TRAIT_PERF_MEMORYBENCHMARK_IS_AVAILABLE 1
|
||||
#define AZ_TRAIT_PUMP_SYSTEM_EVENTS_WHILE_LOADING 0
|
||||
#define AZ_TRAIT_PUMP_SYSTEM_EVENTS_WHILE_LOADING_INTERVAL_MS 0
|
||||
|
||||
@@ -76,7 +76,6 @@
|
||||
#define AZ_TRAIT_HEAPSCHEMA_COMPILE_MALLINFO 1
|
||||
#define AZ_TRAIT_IS_ABS_PATH_IF_COLON_FOUND_ANYWHERE 0
|
||||
#define AZ_TRAIT_JSON_CLANG_IGNORE_UNKNOWN_WARNING 0
|
||||
#define AZ_TRAIT_MAX_JOB_MANAGER_WORKER_THREADS 0
|
||||
#define AZ_TRAIT_PERF_MEMORYBENCHMARK_IS_AVAILABLE 0
|
||||
#define AZ_TRAIT_PUMP_SYSTEM_EVENTS_WHILE_LOADING 0
|
||||
#define AZ_TRAIT_PUMP_SYSTEM_EVENTS_WHILE_LOADING_INTERVAL_MS 0
|
||||
|
||||
@@ -652,7 +652,7 @@ namespace UnitTest
|
||||
threads.emplace_back([this, &threadCount, &cv, assetUuid]() {
|
||||
bool checkLoaded = true;
|
||||
|
||||
for (int i = 0; i < 5000; i++)
|
||||
for (int i = 0; i < 1000; i++)
|
||||
{
|
||||
Asset<AssetWithAssetReference> asset1 =
|
||||
m_testAssetManager->GetAsset(assetUuid, azrtti_typeid<AssetWithAssetReference>(), AZ::Data::AssetLoadBehavior::PreLoad);
|
||||
@@ -678,7 +678,7 @@ namespace UnitTest
|
||||
while (threadCount > 0 && !timedOut)
|
||||
{
|
||||
AZStd::unique_lock<AZStd::mutex> lock(mutex);
|
||||
timedOut = (AZStd::cv_status::timeout == cv.wait_until(lock, AZStd::chrono::system_clock::now() + DefaultTimeoutSeconds * 20000));
|
||||
timedOut = (AZStd::cv_status::timeout == cv.wait_until(lock, AZStd::chrono::system_clock::now() + DefaultTimeoutSeconds));
|
||||
}
|
||||
|
||||
ASSERT_EQ(threadCount, 0) << "Thread count is non-zero, a thread has likely deadlocked. Test will not shut down cleanly.";
|
||||
@@ -1190,7 +1190,7 @@ namespace UnitTest
|
||||
#if AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS
|
||||
TEST_F(AssetJobsFloodTest, DISABLED_ContainerFilterTest_ContainersWithAndWithoutFiltering_Success)
|
||||
#else
|
||||
TEST_F(AssetJobsFloodTest, DISABLED_ContainerFilterTest_ContainersWithAndWithoutFiltering_Success)
|
||||
TEST_F(AssetJobsFloodTest, ContainerFilterTest_ContainersWithAndWithoutFiltering_Success)
|
||||
#endif // !AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS
|
||||
{
|
||||
m_assetHandlerAndCatalog->AssetCatalogRequestBus::Handler::BusConnect();
|
||||
|
||||
@@ -927,6 +927,9 @@ namespace AzToolsFramework
|
||||
/// Notify that the MainWindow has been fully initialized
|
||||
virtual void NotifyMainWindowInitialized(QMainWindow* /*mainWindow*/) {}
|
||||
|
||||
/// Notify that the Editor has been fully initialized
|
||||
virtual void NotifyEditorInitialized() {}
|
||||
|
||||
/// Signal that an asset should be highlighted / selected
|
||||
virtual void SelectAsset(const QString& /* assetPath */) {}
|
||||
};
|
||||
|
||||
@@ -214,12 +214,17 @@ namespace AzToolsFramework
|
||||
, public AZ::BehaviorEBusHandler
|
||||
{
|
||||
AZ_EBUS_BEHAVIOR_BINDER(EditorEventsBusHandler, "{352F80BB-469A-40B6-B322-FE57AB51E4DA}", AZ::SystemAllocator,
|
||||
NotifyRegisterViews);
|
||||
NotifyRegisterViews, NotifyEditorInitialized);
|
||||
|
||||
void NotifyRegisterViews() override
|
||||
{
|
||||
Call(FN_NotifyRegisterViews);
|
||||
}
|
||||
|
||||
void NotifyEditorInitialized() override
|
||||
{
|
||||
Call(FN_NotifyEditorInitialized);
|
||||
}
|
||||
};
|
||||
|
||||
} // Internal
|
||||
@@ -443,6 +448,7 @@ namespace AzToolsFramework
|
||||
->Attribute(AZ::Script::Attributes::Module, "editor")
|
||||
->Handler<Internal::EditorEventsBusHandler>()
|
||||
->Event("NotifyRegisterViews", &EditorEvents::NotifyRegisterViews)
|
||||
->Event("NotifyEditorInitialized", &EditorEvents::NotifyEditorInitialized)
|
||||
;
|
||||
|
||||
behaviorContext->EBus<ViewPaneCallbackBus>("ViewPaneCallbackBus")
|
||||
|
||||
-5
@@ -234,11 +234,6 @@ namespace AzToolsFramework
|
||||
return SourceFileDetails("Icons/AssetBrowser/Lua_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), ".mtl"))
|
||||
{
|
||||
return SourceFileDetails("Icons/AssetBrowser/Material_16.svg");
|
||||
}
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), AzToolsFramework::SliceUtilities::GetSliceFileExtension().c_str()))
|
||||
{
|
||||
return SourceFileDetails("Icons/AssetBrowser/Slice_16.svg");
|
||||
|
||||
+5
-2
@@ -31,7 +31,10 @@ AZ_POP_DISABLE_WARNING
|
||||
AZ_CVAR(
|
||||
bool, ed_hideAssetPickerPathColumn, true, nullptr, AZ::ConsoleFunctorFlags::Null,
|
||||
"Hide AssetPicker path column for a clearer view.");
|
||||
AZ_CVAR_EXTERNED(bool, ed_useNewAssetBrowserTableView);
|
||||
|
||||
AZ_CVAR(
|
||||
bool, ed_useNewAssetPickerView, false, nullptr, AZ::ConsoleFunctorFlags::Null,
|
||||
"Uses the new Asset Picker View.");
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
@@ -106,7 +109,7 @@ namespace AzToolsFramework
|
||||
m_persistentState = AZ::UserSettings::CreateFind<AzToolsFramework::QWidgetSavedState>(AZ::Crc32(("AssetBrowserTreeView_Dialog_" + name).toUtf8().data()), AZ::UserSettings::CT_GLOBAL);
|
||||
|
||||
m_ui->m_assetBrowserTableViewWidget->setVisible(false);
|
||||
if (ed_useNewAssetBrowserTableView)
|
||||
if (ed_useNewAssetPickerView)
|
||||
{
|
||||
m_ui->m_assetBrowserTreeViewWidget->setVisible(false);
|
||||
m_ui->m_assetBrowserTableViewWidget->setVisible(true);
|
||||
|
||||
+2
@@ -597,11 +597,13 @@ namespace AzToolsFramework
|
||||
pte.SetVisibleEnforcement(true);
|
||||
}
|
||||
|
||||
ScopedUndoBatch undo("Modify Entity Property");
|
||||
PropertyOutcome result = pte.SetProperty(propertyPath, value);
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
PropertyEditorEntityChangeNotificationBus::Event(componentInstance.GetEntityId(), &PropertyEditorEntityChangeNotifications::OnEntityComponentPropertyChanged, componentInstance.GetComponentId());
|
||||
}
|
||||
undo.MarkEntityDirty(componentInstance.GetEntityId());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -175,20 +175,14 @@ namespace AzToolsFramework::Prefab
|
||||
m_focusedInstance = focusedInstance;
|
||||
m_focusedTemplateId = focusedInstance->get().GetTemplateId();
|
||||
|
||||
AZ::EntityId containerEntityId;
|
||||
|
||||
if (focusedInstance->get().GetParentInstance() != AZStd::nullopt)
|
||||
{
|
||||
containerEntityId = focusedInstance->get().GetContainerEntityId();
|
||||
}
|
||||
else
|
||||
{
|
||||
containerEntityId = AZ::EntityId();
|
||||
}
|
||||
|
||||
// Focus on the descendants of the container entity in the Editor, if the interface is initialized.
|
||||
if (m_focusModeInterface)
|
||||
{
|
||||
const AZ::EntityId containerEntityId =
|
||||
(focusedInstance->get().GetParentInstance() != AZStd::nullopt)
|
||||
? focusedInstance->get().GetContainerEntityId()
|
||||
: AZ::EntityId();
|
||||
|
||||
m_focusModeInterface->SetFocusRoot(containerEntityId);
|
||||
}
|
||||
|
||||
|
||||
+3
@@ -64,6 +64,9 @@ namespace AzToolsFramework::Prefab
|
||||
);
|
||||
|
||||
m_backButton->setToolTip("Up one level (-)");
|
||||
|
||||
// Currently hide this button until we can correctly disable/enable it based on context.
|
||||
m_backButton->hide();
|
||||
}
|
||||
|
||||
void PrefabViewportFocusPathHandler::OnPrefabFocusChanged()
|
||||
|
||||
+55
-32
@@ -45,6 +45,7 @@ AZ_POP_DISABLE_WARNING
|
||||
#include <AzToolsFramework/AssetBrowser/EBusFindAssetTypeByName.h>
|
||||
#include <AzToolsFramework/ComponentMode/ComponentModeDelegate.h>
|
||||
#include <AzToolsFramework/Entity/EditorEntityHelpers.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabFocusPublicInterface.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabPublicInterface.h>
|
||||
#include <AzToolsFramework/Slice/SliceDataFlagsCommand.h>
|
||||
#include <AzToolsFramework/Slice/SliceMetadataEntityContextBus.h>
|
||||
@@ -894,25 +895,51 @@ namespace AzToolsFramework
|
||||
{
|
||||
if (!m_prefabsAreEnabled)
|
||||
{
|
||||
return m_isLevelEntityEditor ? InspectorLayout::LEVEL : InspectorLayout::ENTITY;
|
||||
return m_isLevelEntityEditor ? InspectorLayout::Level : InspectorLayout::Entity;
|
||||
}
|
||||
|
||||
// Prefabs layout logic
|
||||
|
||||
// If this is the container entity for the root instance, treat it like a level entity.
|
||||
AZ::EntityId levelContainerEntityId = m_prefabPublicInterface->GetLevelInstanceContainerEntityId();
|
||||
if (AZStd::find(m_selectedEntityIds.begin(), m_selectedEntityIds.end(), levelContainerEntityId) != m_selectedEntityIds.end())
|
||||
{
|
||||
if (m_selectedEntityIds.size() > 1)
|
||||
{
|
||||
return InspectorLayout::INVALID;
|
||||
return InspectorLayout::Invalid;
|
||||
}
|
||||
else
|
||||
{
|
||||
return InspectorLayout::LEVEL;
|
||||
return InspectorLayout::Level;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return InspectorLayout::ENTITY;
|
||||
// If this is the container entity for the currently focused prefab, utilize a separate layout.
|
||||
if (auto prefabFocusPublicInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabFocusPublicInterface>::Get())
|
||||
{
|
||||
AzFramework::EntityContextId editorEntityContextId = AzFramework::EntityContextId::CreateNull();
|
||||
EditorEntityContextRequestBus::BroadcastResult(
|
||||
editorEntityContextId, &EditorEntityContextRequests::GetEditorEntityContextId);
|
||||
|
||||
AZ::EntityId focusedPrefabContainerEntityId =
|
||||
prefabFocusPublicInterface->GetFocusedPrefabContainerEntityId(editorEntityContextId);
|
||||
if (AZStd::find(m_selectedEntityIds.begin(), m_selectedEntityIds.end(), focusedPrefabContainerEntityId) !=
|
||||
m_selectedEntityIds.end())
|
||||
{
|
||||
if (m_selectedEntityIds.size() > 1)
|
||||
{
|
||||
return InspectorLayout::Invalid;
|
||||
}
|
||||
else
|
||||
{
|
||||
return InspectorLayout::ContainerEntityOfFocusedPrefab;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return InspectorLayout::Entity;
|
||||
}
|
||||
|
||||
void EntityPropertyEditor::UpdateEntityDisplay()
|
||||
@@ -921,7 +948,7 @@ namespace AzToolsFramework
|
||||
|
||||
InspectorLayout layout = GetCurrentInspectorLayout();
|
||||
|
||||
if (layout == InspectorLayout::LEVEL)
|
||||
if (!m_prefabsAreEnabled && layout == InspectorLayout::Level)
|
||||
{
|
||||
AZStd::string levelName;
|
||||
AzToolsFramework::EditorRequestBus::BroadcastResult(levelName, &AzToolsFramework::EditorRequests::GetLevelName);
|
||||
@@ -963,14 +990,19 @@ namespace AzToolsFramework
|
||||
|
||||
InspectorLayout layout = GetCurrentInspectorLayout();
|
||||
|
||||
if (layout == InspectorLayout::LEVEL)
|
||||
if (layout == InspectorLayout::Level)
|
||||
{
|
||||
// The Level Inspector should only have a list of selectable components after the
|
||||
// level entity itself is valid (i.e. "selected").
|
||||
return selection.empty() ? SelectionEntityTypeInfo::None : SelectionEntityTypeInfo::LevelEntity;
|
||||
}
|
||||
|
||||
if (layout == InspectorLayout::INVALID)
|
||||
if (layout == InspectorLayout::ContainerEntityOfFocusedPrefab)
|
||||
{
|
||||
return selection.empty() ? SelectionEntityTypeInfo::None : SelectionEntityTypeInfo::ContainerEntityOfFocusedPrefab;
|
||||
}
|
||||
|
||||
if (layout == InspectorLayout::Invalid)
|
||||
{
|
||||
return SelectionEntityTypeInfo::Mixed;
|
||||
}
|
||||
@@ -1140,7 +1172,8 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
|
||||
bool isLevelLayout = GetCurrentInspectorLayout() == InspectorLayout::LEVEL;
|
||||
bool isLevelLayout = GetCurrentInspectorLayout() == InspectorLayout::Level;
|
||||
bool isContainerOfFocusedPrefabLayout = GetCurrentInspectorLayout() == InspectorLayout::ContainerEntityOfFocusedPrefab;
|
||||
|
||||
m_gui->m_entityDetailsLabel->setText(entityDetailsLabelText);
|
||||
m_gui->m_entityDetailsLabel->setVisible(entityDetailsVisible);
|
||||
@@ -1148,10 +1181,14 @@ namespace AzToolsFramework
|
||||
m_gui->m_entityNameLabel->setVisible(hasEntitiesDisplayed);
|
||||
m_gui->m_entityIcon->setVisible(hasEntitiesDisplayed);
|
||||
m_gui->m_pinButton->setVisible(m_overrideSelectedEntityIds.empty() && hasEntitiesDisplayed && !m_isSystemEntityEditor);
|
||||
m_gui->m_statusLabel->setVisible(hasEntitiesDisplayed && !m_isSystemEntityEditor && !isLevelLayout);
|
||||
m_gui->m_statusComboBox->setVisible(hasEntitiesDisplayed && !m_isSystemEntityEditor && !isLevelLayout);
|
||||
m_gui->m_entityIdLabel->setVisible(hasEntitiesDisplayed && !m_isSystemEntityEditor && !isLevelLayout);
|
||||
m_gui->m_entityIdText->setVisible(hasEntitiesDisplayed && !m_isSystemEntityEditor && !isLevelLayout);
|
||||
m_gui->m_statusLabel->setVisible(
|
||||
hasEntitiesDisplayed && !m_isSystemEntityEditor && !isLevelLayout);
|
||||
m_gui->m_statusComboBox->setVisible(
|
||||
hasEntitiesDisplayed && !m_isSystemEntityEditor && !isLevelLayout);
|
||||
m_gui->m_entityIdLabel->setVisible(
|
||||
hasEntitiesDisplayed && !m_isSystemEntityEditor && !isLevelLayout);
|
||||
m_gui->m_entityIdText->setVisible(
|
||||
hasEntitiesDisplayed && !m_isSystemEntityEditor && !isLevelLayout);
|
||||
|
||||
bool displayComponentSearchBox = hasEntitiesDisplayed;
|
||||
if (hasEntitiesDisplayed)
|
||||
@@ -1159,7 +1196,9 @@ namespace AzToolsFramework
|
||||
// Build up components to display
|
||||
SharedComponentArray sharedComponentArray;
|
||||
BuildSharedComponentArray(sharedComponentArray,
|
||||
!(selectionEntityTypeInfo == SelectionEntityTypeInfo::OnlyStandardEntities || selectionEntityTypeInfo == SelectionEntityTypeInfo::OnlyPrefabEntities));
|
||||
!(selectionEntityTypeInfo == SelectionEntityTypeInfo::OnlyStandardEntities ||
|
||||
selectionEntityTypeInfo == SelectionEntityTypeInfo::OnlyPrefabEntities) ||
|
||||
selectionEntityTypeInfo == SelectionEntityTypeInfo::ContainerEntityOfFocusedPrefab);
|
||||
|
||||
if (sharedComponentArray.size() == 0)
|
||||
{
|
||||
@@ -1175,7 +1214,8 @@ namespace AzToolsFramework
|
||||
UpdateEntityDisplay();
|
||||
}
|
||||
|
||||
m_gui->m_darkBox->setVisible(displayComponentSearchBox && !m_isSystemEntityEditor && !isLevelLayout);
|
||||
m_gui->m_darkBox->setVisible(
|
||||
displayComponentSearchBox && !m_isSystemEntityEditor && !isLevelLayout && !isContainerOfFocusedPrefabLayout);
|
||||
m_gui->m_entitySearchBox->setVisible(displayComponentSearchBox);
|
||||
|
||||
bool displayAddComponentMenu = CanAddComponentsToSelection(selectionEntityTypeInfo);
|
||||
@@ -4665,13 +4705,6 @@ namespace AzToolsFramework
|
||||
{
|
||||
if (mimeData->hasFormat(AssetBrowser::AssetBrowserEntry::GetMimeType()))
|
||||
{
|
||||
// extra special case: MTLs from FBX drags are ignored. are we dragging a FBX file?
|
||||
bool isDraggingFBXFile = false;
|
||||
AssetBrowser::AssetBrowserEntry::ForEachEntryInMimeData<AssetBrowser::SourceAssetBrowserEntry>(mimeData, [&](const AssetBrowser::SourceAssetBrowserEntry* source)
|
||||
{
|
||||
isDraggingFBXFile = isDraggingFBXFile || AzFramework::StringFunc::Equal(source->GetExtension().c_str(), ".fbx", false);
|
||||
});
|
||||
|
||||
// the usual case - we only allow asset browser drops of assets that have actually been associated with a kind of component.
|
||||
AssetBrowser::AssetBrowserEntry::ForEachEntryInMimeData<AssetBrowser::ProductAssetBrowserEntry>(mimeData, [&](const AssetBrowser::ProductAssetBrowserEntry* product)
|
||||
{
|
||||
@@ -4683,17 +4716,7 @@ namespace AzToolsFramework
|
||||
|
||||
if (canCreateComponent && !componentTypeId.IsNull())
|
||||
{
|
||||
// we have a component type that handles this asset.
|
||||
// but we disallow it if its a MTL file from a FBX and the FBX itself is being dragged. Its still allowed
|
||||
// to drag the actual MTL.
|
||||
EBusFindAssetTypeByName materialAssetTypeResult("Material");
|
||||
AZ::AssetTypeInfoBus::BroadcastResult(materialAssetTypeResult, &AZ::AssetTypeInfo::GetAssetType);
|
||||
AZ::Data::AssetType materialAssetType = materialAssetTypeResult.GetAssetType();
|
||||
|
||||
if ((!isDraggingFBXFile) || (product->GetAssetType() != materialAssetType))
|
||||
{
|
||||
callbackFunction(product);
|
||||
}
|
||||
callbackFunction(product);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+7
-5
@@ -354,7 +354,8 @@ namespace AzToolsFramework
|
||||
OnlyLayerEntities,
|
||||
OnlyPrefabEntities,
|
||||
Mixed,
|
||||
LevelEntity
|
||||
LevelEntity,
|
||||
ContainerEntityOfFocusedPrefab
|
||||
};
|
||||
/**
|
||||
* Returns what kinds of entities are in the current selection. This is used because mixed selection
|
||||
@@ -364,7 +365,7 @@ namespace AzToolsFramework
|
||||
SelectionEntityTypeInfo GetSelectionEntityTypeInfo(const EntityIdList& selection) const;
|
||||
|
||||
/**
|
||||
* Returns true if a selection matching the passed in selection informatation allows components to be added.
|
||||
* Returns true if a selection matching the passed in selection information allows components to be added.
|
||||
*/
|
||||
bool CanAddComponentsToSelection(const SelectionEntityTypeInfo& selectionEntityTypeInfo) const;
|
||||
|
||||
@@ -581,9 +582,10 @@ namespace AzToolsFramework
|
||||
|
||||
enum class InspectorLayout
|
||||
{
|
||||
ENTITY = 0, // All selected entities are regular entities
|
||||
LEVEL, // The selected entity is the level prefab container entity
|
||||
INVALID // Other entities are selected alongside the level prefab container entity
|
||||
Entity = 0, // All selected entities are regular entities.
|
||||
Level, // The selected entity is the prefab container entity for the level prefab, or the slice level entity.
|
||||
ContainerEntityOfFocusedPrefab, // The selected entity is the prefab container entity for the focused prefab.
|
||||
Invalid // Other entities are selected alongside the level prefab container entity.
|
||||
};
|
||||
|
||||
InspectorLayout GetCurrentInspectorLayout() const;
|
||||
|
||||
+15
-35
@@ -29,6 +29,7 @@
|
||||
#include <AzToolsFramework/Maths/TransformUtils.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabFocusPublicInterface.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabFocusInterface.h>
|
||||
#include <AzToolsFramework/Prefab/PrefabFocusPublicInterface.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorLockComponentBus.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorVisibilityBus.h>
|
||||
#include <AzToolsFramework/ToolsComponents/TransformComponent.h>
|
||||
@@ -1188,8 +1189,10 @@ namespace AzToolsFramework
|
||||
continue;
|
||||
}
|
||||
|
||||
const AZ::Aabb bound = CalculateEditorEntitySelectionBounds(entityId, viewportInfo);
|
||||
debugDisplay.DrawSolidBox(bound.GetMin(), bound.GetMax());
|
||||
if (const AZ::Aabb bound = CalculateEditorEntitySelectionBounds(entityId, viewportInfo); bound.IsValid())
|
||||
{
|
||||
debugDisplay.DrawSolidBox(bound.GetMin(), bound.GetMax());
|
||||
}
|
||||
}
|
||||
|
||||
debugDisplay.DepthTestOn();
|
||||
@@ -1345,39 +1348,6 @@ namespace AzToolsFramework
|
||||
EndRecordManipulatorCommand();
|
||||
});
|
||||
|
||||
// surface
|
||||
translationManipulators->InstallSurfaceManipulatorMouseDownCallback(
|
||||
[this, manipulatorEntityIds]([[maybe_unused]] const SurfaceManipulator::Action& action)
|
||||
{
|
||||
BuildSortedEntityIdVectorFromEntityIdMap(m_entityIdManipulators.m_lookups, manipulatorEntityIds->m_entityIds);
|
||||
|
||||
InitializeTranslationLookup(m_entityIdManipulators);
|
||||
|
||||
m_axisPreview.m_translation = m_entityIdManipulators.m_manipulators->GetLocalTransform().GetTranslation();
|
||||
m_axisPreview.m_orientation = QuaternionFromTransformNoScaling(m_entityIdManipulators.m_manipulators->GetLocalTransform());
|
||||
|
||||
// [ref 1.]
|
||||
BeginRecordManipulatorCommand();
|
||||
});
|
||||
|
||||
translationManipulators->InstallSurfaceManipulatorMouseMoveCallback(
|
||||
[this, prevModifiers, manipulatorEntityIds](const SurfaceManipulator::Action& action) mutable
|
||||
{
|
||||
UpdateTranslationManipulator(
|
||||
action, manipulatorEntityIds->m_entityIds, m_entityIdManipulators, m_pivotOverrideFrame, prevModifiers,
|
||||
m_transformChangedInternally, m_spaceCluster.m_spaceLock);
|
||||
});
|
||||
|
||||
translationManipulators->InstallSurfaceManipulatorMouseUpCallback(
|
||||
[this, manipulatorEntityIds]([[maybe_unused]] const SurfaceManipulator::Action& action)
|
||||
{
|
||||
AzToolsFramework::EditorTransformChangeNotificationBus::Broadcast(
|
||||
&AzToolsFramework::EditorTransformChangeNotificationBus::Events::OnEntityTransformChanged,
|
||||
manipulatorEntityIds->m_entityIds);
|
||||
|
||||
EndRecordManipulatorCommand();
|
||||
});
|
||||
|
||||
// transfer ownership
|
||||
m_entityIdManipulators.m_manipulators = AZStd::move(translationManipulators);
|
||||
}
|
||||
@@ -3615,6 +3585,16 @@ namespace AzToolsFramework
|
||||
m_selectedEntityIds.clear();
|
||||
m_selectedEntityIds.reserve(selectedEntityIds.size());
|
||||
AZStd::copy(selectedEntityIds.begin(), selectedEntityIds.end(), AZStd::inserter(m_selectedEntityIds, m_selectedEntityIds.end()));
|
||||
|
||||
// Do not create manipulators for the container entity of the focused prefab.
|
||||
if (auto prefabFocusPublicInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabFocusPublicInterface>::Get())
|
||||
{
|
||||
AzFramework::EntityContextId editorEntityContextId = GetEntityContextId();
|
||||
if (AZ::EntityId focusRoot = prefabFocusPublicInterface->GetFocusedPrefabContainerEntityId(editorEntityContextId); focusRoot.IsValid())
|
||||
{
|
||||
m_selectedEntityIds.erase(focusRoot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EditorTransformComponentSelection::OnTransformChanged(
|
||||
|
||||
Reference in New Issue
Block a user