Merge branch 'main' into hultonha_LYN-2315_camera-phase-2

This commit is contained in:
hultonha
2021-04-28 15:03:05 +01:00
646 changed files with 42606 additions and 60008 deletions
@@ -118,6 +118,7 @@ namespace AZ
const static AZ::Crc32 StringLineEditingCompleteNotify = AZ_CRC("StringLineEditingCompleteNotify", 0x139e5fa9);
const static AZ::Crc32 NameLabelOverride = AZ_CRC("NameLabelOverride", 0x9ff79cab);
const static AZ::Crc32 AssetPickerTitle = AZ_CRC_CE("AssetPickerTitle");
const static AZ::Crc32 ChildNameLabelOverride = AZ_CRC("ChildNameLabelOverride", 0x73dd2909);
//! Container attribute that is used to override labels for its elements given the index of the element
const static AZ::Crc32 IndexedChildNameLabelOverride = AZ_CRC("IndexedChildNameLabelOverride", 0x5f313ac2);
@@ -78,7 +78,7 @@ namespace Physics
float m_minimumMovementDistance = 0.001f; //!< To avoid jittering, the controller will not attempt to move distances below this.
float m_maximumSpeed = 100.0f; //!< If the accumulated requested velocity for a tick exceeds this magnitude, it will be clamped.
AZStd::string m_colliderTag; //!< Used to identify the collider associated with the character controller.
AZStd::shared_ptr<Physics::ShapeConfiguration> m_shapeConfig = nullptr; //!< The shape to use when creating the character controller.
AZStd::shared_ptr<Physics::ShapeConfiguration> m_shapeConfig; //!< The shape to use when creating the character controller.
AZStd::vector<AZStd::shared_ptr<Physics::Shape>> m_colliders; //!< The list of colliders to attach to the character controller.
};
@@ -55,7 +55,7 @@ namespace AzPhysics
//! Flag to determine if the body is part of the simulation.
//! When true the body will be affected by any forces, collisions, and found with scene queries.
bool m_simulating = true;
bool m_simulating = false;
//! Helper functions for setting user data.
//! @param userData Can be a pointer to any type as internally will be cast to a void*. Object lifetime not managed by the SimulatedBody.
@@ -46,6 +46,7 @@ namespace AzPhysics
->Field("orientation", &SimulatedBodyConfiguration::m_orientation)
->Field("scale", &SimulatedBodyConfiguration::m_scale)
->Field("entityId", &SimulatedBodyConfiguration::m_entityId)
->Field("startSimulationEnabled", &SimulatedBodyConfiguration::m_startSimulationEnabled)
;
}
}
@@ -39,6 +39,7 @@ namespace AzPhysics
AZ::Vector3 m_position = AZ::Vector3::CreateZero();
AZ::Quaternion m_orientation = AZ::Quaternion::CreateIdentity();
AZ::Vector3 m_scale = AZ::Vector3::CreateOne();
bool m_startSimulationEnabled = true;
// Entity/object association.
AZ::EntityId m_entityId = AZ::EntityId(AZ::EntityId::InvalidEntityId);
@@ -52,6 +52,11 @@ namespace Physics
}
}
RagdollConfiguration::RagdollConfiguration()
{
m_startSimulationEnabled = false; //ragdolls do not start enabled.
}
void RagdollConfiguration::Reflect(AZ::ReflectContext* context)
{
AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context);
@@ -24,6 +24,8 @@
namespace Physics
{
using ParentIndices = AZStd::vector<size_t>;
class RagdollNodeConfiguration
: public AzPhysics::RigidBodyConfiguration
{
@@ -46,7 +48,7 @@ namespace Physics
AZ_RTTI(RagdollConfiguration, "{7C96D332-61D8-4C58-A2BF-707716D38D14}", AzPhysics::SimulatedBodyConfiguration);
static void Reflect(AZ::ReflectContext* context);
RagdollConfiguration() = default;
RagdollConfiguration();
explicit RagdollConfiguration(const RagdollConfiguration& settings) = default;
RagdollNodeConfiguration* FindNodeConfigByName(const AZStd::string& nodeName) const;
@@ -56,6 +58,8 @@ namespace Physics
AZStd::vector<RagdollNodeConfiguration> m_nodes;
CharacterColliderConfiguration m_colliders;
RagdollState m_initialState;
ParentIndices m_parentIndices;
};
/// Represents a single rigid part of a ragdoll.
@@ -79,7 +83,7 @@ namespace Physics
{
public:
AZ_CLASS_ALLOCATOR(Ragdoll, AZ::SystemAllocator, 0);
AZ_RTTI(Ragdoll, "{01F09602-80EC-4693-A0E7-C2719239044B}", AzPhysics::SimulatedBody);
AZ_RTTI(Physics::Ragdoll, "{01F09602-80EC-4693-A0E7-C2719239044B}", AzPhysics::SimulatedBody);
virtual ~Ragdoll() = default;
/// Inserts the ragdoll into the physics simulation.
@@ -16,7 +16,6 @@
#include <AzCore/Serialization/EditContext.h>
#include <AzToolsFramework/Prefab/PrefabPublicInterface.h>
#include <AzToolsFramework/UI/EditorEntityUi/EditorEntityUiInterface.h>
#include <AzToolsFramework/UI/Outliner/EntityOutlinerWidgetInterface.h>
#include <AzToolsFramework/UI/Prefab/PrefabIntegrationBus.h>
namespace AzToolsFramework
@@ -21,9 +21,9 @@
#include <AzToolsFramework/Prefab/Instance/TemplateInstanceMapperInterface.h>
#include <AzToolsFramework/Prefab/PrefabDomUtils.h>
#include <AzToolsFramework/Prefab/PrefabPublicInterface.h>
#include <AzToolsFramework/Prefab/PrefabPublicNotificationBus.h>
#include <AzToolsFramework/Prefab/PrefabSystemComponentInterface.h>
#include <AzToolsFramework/Prefab/Template/Template.h>
#include <AzToolsFramework/UI/Outliner/EntityOutlinerWidgetInterface.h>
namespace AzToolsFramework
{
@@ -90,17 +90,13 @@ namespace AzToolsFramework
if (instanceCountToUpdateInBatch > 0)
{
// Notify Propagation has begun
PrefabPublicNotificationBus::Broadcast(&PrefabPublicNotifications::OnPrefabInstancePropagationBegin);
EntityIdList selectedEntityIds;
ToolsApplicationRequestBus::BroadcastResult(selectedEntityIds, &ToolsApplicationRequests::GetSelectedEntities);
ToolsApplicationRequestBus::Broadcast(&ToolsApplicationRequests::SetSelectedEntities, EntityIdList());
// Disable the Outliner to avoid showing the propagation steps
EntityOutlinerWidgetInterface* entityOutlinerWidgetInterface = AZ::Interface<EntityOutlinerWidgetInterface>::Get();
if (entityOutlinerWidgetInterface)
{
entityOutlinerWidgetInterface->SetUpdatesEnabled(false);
}
for (int i = 0; i < instanceCountToUpdateInBatch; ++i)
{
Instance* instanceToUpdate = m_instancesUpdateQueue.front();
@@ -168,18 +164,8 @@ namespace AzToolsFramework
}
ToolsApplicationRequestBus::Broadcast(&ToolsApplicationRequests::SetSelectedEntities, selectedEntityIds);
// Enable the Outliner
if (entityOutlinerWidgetInterface)
{
entityOutlinerWidgetInterface->SetUpdatesEnabled(true);
auto prefabPublicInterface = AZ::Interface<PrefabPublicInterface>::Get();
if (prefabPublicInterface)
{
AZ::EntityId rootEntityId = prefabPublicInterface->GetLevelInstanceContainerEntityId();
entityOutlinerWidgetInterface->ExpandEntityChildren(rootEntityId);
}
}
// Notify Propagation has ended
PrefabPublicNotificationBus::Broadcast(&PrefabPublicNotifications::OnPrefabInstancePropagationEnd);
}
m_updatingTemplateInstancesInQueue = false;
@@ -0,0 +1,34 @@
/*
* 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 <AzCore/EBus/EBus.h>
namespace AzToolsFramework
{
namespace Prefab
{
class PrefabPublicNotifications
: public AZ::EBusTraits
{
public:
virtual ~PrefabPublicNotifications() = default;
virtual void OnPrefabInstancePropagationBegin() {}
virtual void OnPrefabInstancePropagationEnd() {}
};
using PrefabPublicNotificationBus = AZ::EBus<PrefabPublicNotifications>;
} // namespace Prefab
} // namespace AzToolsFramework
@@ -286,12 +286,12 @@ namespace AzToolsFramework
ComponentModeFramework::EditorComponentModeNotificationBus::Handler::BusConnect(
GetEntityContextId());
EditorEntityInfoNotificationBus::Handler::BusConnect();
AZ::Interface<EntityOutlinerWidgetInterface>::Register(this);
Prefab::PrefabPublicNotificationBus::Handler::BusConnect();
}
EntityOutlinerWidget::~EntityOutlinerWidget()
{
AZ::Interface<EntityOutlinerWidgetInterface>::Unregister(this);
Prefab::PrefabPublicNotificationBus::Handler::BusDisconnect();
ComponentModeFramework::EditorComponentModeNotificationBus::Handler::BusDisconnect();
EditorEntityInfoNotificationBus::Handler::BusDisconnect();
EditorPickModeNotificationBus::Handler::BusDisconnect();
@@ -1109,25 +1109,18 @@ namespace AzToolsFramework
setEnabled(true);
SetEntityOutlinerState(m_gui, true);
}
void EntityOutlinerWidget::SetUpdatesEnabled(bool enable)
void EntityOutlinerWidget::OnPrefabInstancePropagationBegin()
{
if (enable)
{
QTimer::singleShot(1, this, [this]() {
m_gui->m_objectTree->setUpdatesEnabled(true);
});
}
else
{
m_gui->m_objectTree->setUpdatesEnabled(false);
}
m_gui->m_objectTree->setUpdatesEnabled(false);
}
void EntityOutlinerWidget::ExpandEntityChildren(AZ::EntityId entityId)
void EntityOutlinerWidget::OnPrefabInstancePropagationEnd()
{
QModelIndex index = GetIndexFromEntityId(entityId);
m_gui->m_objectTree->expand(index);
QTimer::singleShot(1, this, [this]() {
m_gui->m_objectTree->setUpdatesEnabled(true);
m_gui->m_objectTree->expand(m_proxyModel->index(0,0));
});
}
void EntityOutlinerWidget::OnEntityInfoUpdatedAddChildEnd(AZ::EntityId /*parentId*/, AZ::EntityId childId)
@@ -20,10 +20,10 @@
#include <AzToolsFramework/ComponentMode/EditorComponentModeBus.h>
#include <AzToolsFramework/Entity/EditorEntityInfoBus.h>
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
#include <AzToolsFramework/Prefab/PrefabPublicNotificationBus.h>
#include <AzToolsFramework/ToolsMessaging/EntityHighlightBus.h>
#include <AzToolsFramework/UI/Outliner/EntityOutlinerCacheBus.h>
#include <AzToolsFramework/UI/Outliner/EntityOutlinerSearchWidget.h>
#include <AzToolsFramework/UI/Outliner/EntityOutlinerWidgetInterface.h>
#include <AzToolsFramework/UI/SearchWidget/SearchWidgetTypes.hxx>
#include <QIcon>
@@ -62,7 +62,7 @@ namespace AzToolsFramework
, private EditorEntityContextNotificationBus::Handler
, private EditorEntityInfoNotificationBus::Handler
, private ComponentModeFramework::EditorComponentModeNotificationBus::Handler
, private EntityOutlinerWidgetInterface
, private Prefab::PrefabPublicNotificationBus::Handler
{
Q_OBJECT;
public:
@@ -106,9 +106,9 @@ namespace AzToolsFramework
void EnteredComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
void LeftComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
// EntityOutlinerWidgetInterface
void SetUpdatesEnabled(bool enable) override;
void ExpandEntityChildren(AZ::EntityId entityId) override;
// PrefabPublicNotificationBus
void OnPrefabInstancePropagationBegin() override;
void OnPrefabInstancePropagationEnd() override;
// Build a selection object from the given entities. Entities already in the Widget's selection buffers are ignored.
template <class EntityIdCollection>
@@ -1,30 +0,0 @@
/*
* 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 <AzCore/Interface/Interface.h>
#include <AzCore/Serialization/SerializeContext.h>
namespace AzToolsFramework
{
class EntityOutlinerWidgetInterface
{
public:
AZ_RTTI(EntityOutlinerWidgetInterface, "{30C0F252-EC84-4196-BF59-EB9E73B8ADCB}");
virtual void SetUpdatesEnabled(bool enable) = 0;
virtual void ExpandEntityChildren(AZ::EntityId entityId) = 0;
};
} // namespace AzToolsFramework
@@ -63,7 +63,7 @@ AZ_POP_DISABLE_WARNING
#include <UI/PropertyEditor/Model/AssetCompleterModel.h>
#include <UI/PropertyEditor/View/AssetCompleterListView.h>
#include <UI/PropertyEditor/ThumbnailDropDown.h>
#include <UI/PropertyEditor/ThumbnailPropertyCtrl.h>
namespace AzToolsFramework
{
@@ -93,15 +93,11 @@ namespace AzToolsFramework
setAcceptDrops(true);
m_thumbnail = new Thumbnailer::ThumbnailWidget(this);
m_thumbnail->setFixedSize(QSize(24, 24));
m_thumbnail = new ThumbnailPropertyCtrl(this);
m_thumbnail->setFixedSize(QSize(40, 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);
connect(m_thumbnail, &ThumbnailPropertyCtrl::clicked, this, &PropertyAssetCtrl::OnThumbnailClicked);
m_editButton = new QToolButton(this);
m_editButton->setAutoRaise(true);
@@ -112,7 +108,6 @@ 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);
@@ -188,6 +183,17 @@ namespace AzToolsFramework
}
}
void PropertyAssetCtrl::OnThumbnailClicked()
{
const AZ::Data::AssetId assetID = GetCurrentAssetID();
if (m_thumbnailCallback)
{
AZ_Error("Asset Property", m_editNotifyTarget, "No notification target set for edit callback.");
m_thumbnailCallback->Invoke(m_editNotifyTarget, assetID, GetCurrentAssetType());
return;
}
}
void PropertyAssetCtrl::OnCompletionModelReset()
{
if (!m_completerIsActive)
@@ -674,6 +680,13 @@ namespace AzToolsFramework
AzQtComponents::BrowseEdit::removeDropTargetStyle(m_browseEdit);
}
AssetSelectionModel PropertyAssetCtrl::GetAssetSelectionModel()
{
auto selectionModel = AssetSelectionModel::AssetTypeSelection(GetCurrentAssetType());
selectionModel.SetTitle(m_title);
return selectionModel;
}
void PropertyAssetCtrl::UpdateTabOrder()
{
setTabOrder(m_browseEdit, m_editButton);
@@ -1052,6 +1065,11 @@ namespace AzToolsFramework
m_editButton->setIcon(icon);
}
void PropertyAssetCtrl::SetTitle(const QString& title)
{
m_title = title;
}
void PropertyAssetCtrl::SetEditNotifyTarget(void* editNotifyTarget)
{
m_editNotifyTarget = editNotifyTarget;
@@ -1091,10 +1109,10 @@ namespace AzToolsFramework
void PropertyAssetCtrl::UpdateThumbnail()
{
m_thumbnail->setVisible(m_showThumbnail);
m_thumbnailDropDown->setVisible(m_showThumbnailDropDown);
if (m_showThumbnail || m_showThumbnailDropDown)
if (m_showThumbnail)
{
m_thumbnail->ShowDropDownArrow(m_showThumbnailDropDownButton);
const AZ::Data::AssetId assetID = GetCurrentAssetID();
if (assetID.IsValid())
{
@@ -1112,17 +1130,12 @@ namespace AzToolsFramework
{
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)
@@ -1156,14 +1169,19 @@ namespace AzToolsFramework
return m_showThumbnail;
}
void PropertyAssetCtrl::SetShowThumbnailDropDown(bool enable)
void PropertyAssetCtrl::SetShowThumbnailDropDownButton(bool enable)
{
m_showThumbnailDropDown = enable;
m_showThumbnailDropDownButton = enable;
}
bool PropertyAssetCtrl::GetShowThumbnailDropDown() const
bool PropertyAssetCtrl::GetShowThumbnailDropDownButton() const
{
return m_showThumbnailDropDown;
return m_showThumbnailDropDownButton;
}
void PropertyAssetCtrl::SetThumbnailCallback(EditCallbackType* editNotifyCallback)
{
m_thumbnailCallback = editNotifyCallback;
}
const AZ::Uuid& AssetPropertyHandlerDefault::GetHandledType() const
@@ -1187,7 +1205,16 @@ namespace AzToolsFramework
{
(void)debugName;
if (attrib == AZ_CRC("EditCallback", 0xb74f2ee1))
if (attrib == AZ_CRC_CE("AssetPickerTitle"))
{
AZStd::string title;
attrValue->Read<AZStd::string>(title);
if (!title.empty())
{
GUI->SetTitle(title.c_str());
}
}
else if (attrib == AZ_CRC("EditCallback", 0xb74f2ee1))
{
PropertyAssetCtrl::EditCallbackType* func = azdynamic_cast<PropertyAssetCtrl::EditCallbackType*>(attrValue->GetAttribute());
if (func)
@@ -1277,23 +1304,21 @@ namespace AzToolsFramework
}
else if (attrib == AZ_CRC_CE("Thumbnail"))
{
bool showThumbnail = false;
if (attrValue->Read<bool>(showThumbnail))
{
GUI->SetShowThumbnail(showThumbnail);
}
GUI->SetShowThumbnail(true);
}
else if (attrib == AZ_CRC_CE("ThumbnailWithDropDown"))
else if (attrib == AZ_CRC_CE("ThumbnailCallback"))
{
PropertyAssetCtrl::EditCallbackType* func = azdynamic_cast<PropertyAssetCtrl::EditCallbackType*>(attrValue->GetAttribute());
if (func)
{
GUI->SetShowThumbnailDropDown(true);
GUI->SetEditNotifyCallback(func);
GUI->SetShowThumbnail(true);
GUI->SetShowThumbnailDropDownButton(true);
GUI->SetThumbnailCallback(func);
}
else
{
GUI->SetEditNotifyCallback(nullptr);
GUI->SetShowThumbnailDropDownButton(false);
GUI->SetThumbnailCallback(nullptr);
}
}
}
@@ -45,7 +45,7 @@ namespace AzToolsFramework
{
class AssetCompleterModel;
class AssetCompleterListView;
class ThumbnailDropDown;
class ThumbnailPropertyCtrl;
namespace Thumbnailer
{
@@ -89,14 +89,14 @@ namespace AzToolsFramework
void dragLeaveEvent(QDragLeaveEvent* event) override;
void dropEvent(QDropEvent* event) override;
virtual AssetSelectionModel GetAssetSelectionModel() { return AssetSelectionModel::AssetTypeSelection(GetCurrentAssetType()); }
virtual AssetSelectionModel GetAssetSelectionModel();
signals:
void OnAssetIDChanged(AZ::Data::AssetId newAssetID);
protected:
ThumbnailDropDown* m_thumbnailDropDown = nullptr;
Thumbnailer::ThumbnailWidget* m_thumbnail = nullptr;
QString m_title;
ThumbnailPropertyCtrl* m_thumbnail = nullptr;
QPushButton* m_errorButton = nullptr;
QToolButton* m_editButton = nullptr;
@@ -157,8 +157,8 @@ namespace AzToolsFramework
bool m_showProductAssetName = true;
bool m_showThumbnail = false;
bool m_showThumbnailDropDown = false;
bool m_showThumbnailDropDownButton = false;
EditCallbackType* m_thumbnailCallback = nullptr;
// ! Default suffix used in the field's placeholder text when a default value is set.
const char* m_DefaultSuffix = " (default)";
@@ -192,6 +192,7 @@ namespace AzToolsFramework
//////////////////////////////////////////////////////////////////////////
public slots:
void SetTitle(const QString& title);
void SetEditNotifyTarget(void* editNotifyTarget);
void SetEditNotifyCallback(EditCallbackType* editNotifyCallback); // This is meant to be used with the "EditCallback" Attribute
void SetClearNotifyCallback(ClearCallbackType* clearNotifyCallback); // This is meant to be used with the "ClearNotify" Attribute
@@ -209,8 +210,9 @@ namespace AzToolsFramework
void SetShowThumbnail(bool enable);
bool GetShowThumbnail() const;
void SetShowThumbnailDropDown(bool enable);
bool GetShowThumbnailDropDown() const;
void SetShowThumbnailDropDownButton(bool enable);
bool GetShowThumbnailDropDownButton() const;
void SetThumbnailCallback(EditCallbackType* editNotifyCallback);
void SetSelectedAssetID(const AZ::Data::AssetId& newID);
void SetCurrentAssetType(const AZ::Data::AssetType& newType);
@@ -222,6 +224,7 @@ namespace AzToolsFramework
void UpdateAssetDisplay();
void OnLineEditFocus(bool focus);
virtual void OnEditButtonClicked();
void OnThumbnailClicked();
void OnCompletionModelReset();
void OnAutocomplete(const QModelIndex& index);
void OnTextChange(const QString& text);
@@ -19,12 +19,14 @@ AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // 4251: 'QRawFon
#include <QPainter>
#include <UI/UICore/AspectRatioAwarePixmapWidget.hxx>
#include <Thumbnails/ThumbnailWidget.h>
#include <QApplication>
AZ_POP_DISABLE_WARNING
#include "ThumbnailDropDown.h"
#include "ThumbnailPropertyCtrl.h"
namespace AzToolsFramework
{
ThumbnailDropDown::ThumbnailDropDown(QWidget* parent)
ThumbnailPropertyCtrl::ThumbnailPropertyCtrl(QWidget* parent)
: QWidget(parent)
{
QHBoxLayout* pLayout = new QHBoxLayout();
@@ -37,6 +39,7 @@ namespace AzToolsFramework
m_dropDownArrow = new AspectRatioAwarePixmapWidget(this);
m_dropDownArrow->setPixmap(QPixmap(":/stylesheet/img/triangle0.png"));
m_dropDownArrow->setFixedSize(QSize(8, 24));
ShowDropDownArrow(false);
m_emptyThumbnail = new QLabel(this);
m_emptyThumbnail->setPixmap(QPixmap(":/stylesheet/img/line.png"));
@@ -51,19 +54,33 @@ namespace AzToolsFramework
setLayout(pLayout);
}
void ThumbnailDropDown::SetThumbnailKey(Thumbnailer::SharedThumbnailKey key, const char* contextName)
void ThumbnailPropertyCtrl::SetThumbnailKey(Thumbnailer::SharedThumbnailKey key, const char* contextName)
{
m_key = key;
m_emptyThumbnail->setVisible(false);
m_thumbnail->SetThumbnailKey(key, contextName);
}
void ThumbnailDropDown::ClearThumbnail()
void ThumbnailPropertyCtrl::ClearThumbnail()
{
m_emptyThumbnail->setVisible(true);
m_thumbnail->ClearThumbnail();
}
bool ThumbnailDropDown::event(QEvent* e)
void ThumbnailPropertyCtrl::ShowDropDownArrow(bool visible)
{
if (visible)
{
setFixedSize(QSize(40, 24));
}
else
{
setFixedSize(QSize(24, 24));
}
m_dropDownArrow->setVisible(visible);
}
bool ThumbnailPropertyCtrl::event(QEvent* e)
{
if (isEnabled())
{
@@ -77,7 +94,7 @@ namespace AzToolsFramework
return QWidget::event(e);
}
void ThumbnailDropDown::paintEvent(QPaintEvent* e)
void ThumbnailPropertyCtrl::paintEvent(QPaintEvent* e)
{
QPainter p(this);
QRect targetRect(QPoint(), QSize(40, 24));
@@ -85,17 +102,32 @@ namespace AzToolsFramework
QWidget::paintEvent(e);
}
void ThumbnailDropDown::enterEvent(QEvent* e)
void ThumbnailPropertyCtrl::enterEvent(QEvent* e)
{
m_dropDownArrow->setPixmap(QPixmap(":/stylesheet/img/triangle0_highlighted.png"));
if (!m_thumbnailEnlarged && m_key)
{
QPoint position = mapToGlobal(pos() - QPoint(185, 0));
QSize size(180, 180);
m_thumbnailEnlarged.reset(new Thumbnailer::ThumbnailWidget());
m_thumbnailEnlarged->setFixedSize(size);
m_thumbnailEnlarged->move(position);
m_thumbnailEnlarged->setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
m_thumbnailEnlarged->SetThumbnailKey(m_key);
m_thumbnailEnlarged->show();
}
QWidget::enterEvent(e);
}
void ThumbnailDropDown::leaveEvent(QEvent* e)
void ThumbnailPropertyCtrl::leaveEvent(QEvent* e)
{
m_dropDownArrow->setPixmap(QPixmap(":/stylesheet/img/triangle0.png"));
if (m_thumbnailEnlarged)
{
m_thumbnailEnlarged.reset();
}
QWidget::leaveEvent(e);
}
}
#include "UI/PropertyEditor/moc_ThumbnailDropDown.cpp"
#include "UI/PropertyEditor/moc_ThumbnailPropertyCtrl.cpp"
@@ -30,17 +30,20 @@ namespace AzToolsFramework
class ThumbnailWidget;
}
class ThumbnailDropDown : public QWidget
//! Used by PropertyAssetCtrl to display thumbnail preview of the asset as well as additional drop-down actions
class ThumbnailPropertyCtrl : public QWidget
{
Q_OBJECT
public:
explicit ThumbnailDropDown(QWidget* parent = nullptr);
explicit ThumbnailPropertyCtrl(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();
void ShowDropDownArrow(bool visible);
bool event(QEvent* e) override;
Q_SIGNALS:
@@ -52,7 +55,9 @@ namespace AzToolsFramework
void leaveEvent(QEvent* e) override;
private:
Thumbnailer::SharedThumbnailKey m_key;
Thumbnailer::ThumbnailWidget* m_thumbnail = nullptr;
QScopedPointer<Thumbnailer::ThumbnailWidget> m_thumbnailEnlarged;
QLabel* m_emptyThumbnail = nullptr;
AspectRatioAwarePixmapWidget* m_dropDownArrow = nullptr;
};
@@ -417,8 +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/PropertyEditor/ThumbnailPropertyCtrl.h
UI/PropertyEditor/ThumbnailPropertyCtrl.cpp
UI/Slice/SlicePushWidget.cpp
UI/Slice/SlicePushWidget.hxx
UI/Slice/SliceOverridesNotificationWindow.cpp
@@ -652,6 +652,7 @@ set(FILES
Prefab/PrefabPublicHandler.h
Prefab/PrefabPublicHandler.cpp
Prefab/PrefabPublicInterface.h
Prefab/PrefabPublicNotificationBus.h
Prefab/PrefabUndo.h
Prefab/PrefabUndo.cpp
Prefab/PrefabUndoCache.cpp
@@ -687,7 +688,6 @@ set(FILES
UI/Outliner/EntityOutlinerDisplayOptionsMenu.cpp
UI/Outliner/EntityOutlinerTreeView.hxx
UI/Outliner/EntityOutlinerTreeView.cpp
UI/Outliner/EntityOutlinerWidgetInterface.h
UI/Outliner/EntityOutlinerWidget.hxx
UI/Outliner/EntityOutlinerWidget.cpp
UI/Outliner/EntityOutlinerCacheBus.h
-11
View File
@@ -33,7 +33,6 @@
#include "Util/CryMemFile.h"
#include "Objects/ObjectManager.h"
#include "Objects/ObjectPhysicsManager.h"
#include "Objects/EntityObject.h"
#include "LensFlareEditor/LensFlareManager.h"
#include "LensFlareEditor/LensFlareLibrary.h"
@@ -192,14 +191,6 @@ bool CGameExporter::Export(unsigned int flags, [[maybe_unused]] EEndian eExportE
}
}
////////////////////////////////////////////////////////////////////////
// Inform all objects that an export is about to begin
////////////////////////////////////////////////////////////////////////
if (exportSuccessful)
{
GetIEditor()->GetObjectManager()->GetPhysicsManager()->PrepareForExport();
}
////////////////////////////////////////////////////////////////////////
// Export all data to the game
////////////////////////////////////////////////////////////////////////
@@ -519,8 +510,6 @@ void CGameExporter::ExportMapInfo(XmlNodeRef& node)
CXmlArchive xmlAr;
xmlAr.bLoading = false;
xmlAr.root = node;
GetIEditor()->GetObjectManager()->GetPhysicsManager()->SerializeCollisionClasses(xmlAr);
}
//////////////////////////////////////////////////////////////////////////
@@ -24,7 +24,6 @@ class CUsedResources;
class CSelectionGroup;
class CObjectClassDesc;
class CObjectArchive;
class CObjectPhysicsManager;
class CViewport;
struct HitContext;
enum class ImageRotationDegrees;
@@ -247,10 +246,6 @@ public:
virtual IGizmoManager* GetGizmoManager() = 0;
//////////////////////////////////////////////////////////////////////////
//! Get acess to object physics manager
virtual CObjectPhysicsManager* GetPhysicsManager() = 0;
//////////////////////////////////////////////////////////////////////////
//! Invalidate visibily settings of objects.
virtual void InvalidateVisibleList() = 0;
@@ -25,7 +25,6 @@
#include "Viewport.h"
#include "GizmoManager.h"
#include "AxisGizmo.h"
#include "ObjectPhysicsManager.h"
#include "GameEngine.h"
#include "WaitProgress.h"
#include "Util/Image.h"
@@ -109,7 +108,6 @@ CObjectManager::CObjectManager()
, m_pLoadProgress(nullptr)
, m_loadedObjects(0)
, m_totalObjectsToLoad(0)
, m_pPhysicsManager(new CObjectPhysicsManager())
, m_bExiting(false)
, m_isUpdateVisibilityList(false)
, m_currentHideCount(CBaseObject::s_invalidHiddenID)
@@ -138,7 +136,6 @@ CObjectManager::~CObjectManager()
DeleteAllObjects();
delete m_gizmoManager;
delete m_pPhysicsManager;
}
//////////////////////////////////////////////////////////////////////////
@@ -841,8 +838,6 @@ void CObjectManager::Update()
{
prevActiveWindow->setFocus();
}
m_pPhysicsManager->Update();
}
//////////////////////////////////////////////////////////////////////////
@@ -334,9 +334,6 @@ public:
virtual void FindAndRenameProperty2(const char* property2Name, const QString& oldValue, const QString& newValue);
virtual void FindAndRenameProperty2If(const char* property2Name, const QString& oldValue, const QString& newValue, const char* otherProperty2Name, const QString& otherValue);
class CObjectPhysicsManager* GetPhysicsManager()
{ return m_pPhysicsManager; }
bool IsReloading() const { return m_bInReloading; }
void SetSkipUpdate(bool bSkipUpdate) override { m_bSkipObjectUpdate = bSkipUpdate; }
@@ -433,8 +430,6 @@ private:
int m_totalObjectsToLoad;
//////////////////////////////////////////////////////////////////////////
class CObjectPhysicsManager* m_pPhysicsManager;
//////////////////////////////////////////////////////////////////////////
// Numbering for names.
//////////////////////////////////////////////////////////////////////////
@@ -1,191 +0,0 @@
/*
* 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.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#include "EditorDefs.h"
#include "ObjectPhysicsManager.h"
// Editor
#include "GameEngine.h"
#include "Commands/CommandManager.h"
#include "Objects/SelectionGroup.h"
#include "Include/IObjectManager.h"
#include "CryPhysicsDeprecation.h"
#define MAX_OBJECTS_PHYS_SIMULATION_TIME (5)
//////////////////////////////////////////////////////////////////////////
CObjectPhysicsManager::CObjectPhysicsManager()
{
CommandManagerHelper::RegisterCommand(GetIEditor()->GetCommandManager(),
"physics", "simulate_objects", "", "",
AZStd::bind(&CObjectPhysicsManager::Command_SimulateObjects, this));
CommandManagerHelper::RegisterCommand(GetIEditor()->GetCommandManager(),
"physics", "reset_objects_state", "", "",
AZStd::bind(&CObjectPhysicsManager::Command_ResetPhysicsState, this));
CommandManagerHelper::RegisterCommand(GetIEditor()->GetCommandManager(),
"physics", "get_objects_state", "", "",
AZStd::bind(&CObjectPhysicsManager::Command_GetPhysicsState, this));
m_fStartObjectSimulationTime = 0;
m_bSimulatingObjects = false;
m_wasSimObjects = 0;
}
//////////////////////////////////////////////////////////////////////////
CObjectPhysicsManager::~CObjectPhysicsManager()
{
}
//////////////////////////////////////////////////////////////////////////
void CObjectPhysicsManager::Command_SimulateObjects()
{
SimulateSelectedObjectsPositions();
}
/////////////////////////////////////////////////////////////////////////
void CObjectPhysicsManager::Command_ResetPhysicsState()
{
CSelectionGroup* pSelection = GetIEditor()->GetSelection();
for (int i = 0; i < pSelection->GetCount(); i++)
{
pSelection->GetObject(i)->OnEvent(EVENT_PHYSICS_RESETSTATE);
}
}
/////////////////////////////////////////////////////////////////////////
void CObjectPhysicsManager::Command_GetPhysicsState()
{
CSelectionGroup* pSelection = GetIEditor()->GetSelection();
for (int i = 0; i < pSelection->GetCount(); i++)
{
pSelection->GetObject(i)->OnEvent(EVENT_PHYSICS_GETSTATE);
}
}
//////////////////////////////////////////////////////////////////////////
void CObjectPhysicsManager::Update()
{
if (m_bSimulatingObjects)
{
UpdateSimulatingObjects();
}
}
//////////////////////////////////////////////////////////////////////////
void CObjectPhysicsManager::SimulateSelectedObjectsPositions()
{
CSelectionGroup* pSel = GetIEditor()->GetObjectManager()->GetSelection();
if (pSel->IsEmpty())
{
return;
}
if (GetIEditor()->GetGameEngine()->GetSimulationMode())
{
return;
}
GetIEditor()->GetGameEngine()->SetSimulationMode(true, true);
m_simObjects.clear();
CRY_PHYSICS_REPLACEMENT_ASSERT();
m_wasSimObjects = m_simObjects.size();
m_fStartObjectSimulationTime = GetISystem()->GetITimer()->GetAsyncCurTime();
m_bSimulatingObjects = true;
}
//////////////////////////////////////////////////////////////////////////
void CObjectPhysicsManager::UpdateSimulatingObjects()
{
{
CUndo undo("Simulate");
CRY_PHYSICS_REPLACEMENT_ASSERT();
}
float curTime = GetISystem()->GetITimer()->GetAsyncCurTime();
float runningTime = (curTime - m_fStartObjectSimulationTime);
if (m_simObjects.empty() || (runningTime > MAX_OBJECTS_PHYS_SIMULATION_TIME))
{
m_fStartObjectSimulationTime = 0;
m_bSimulatingObjects = false;
GetIEditor()->GetGameEngine()->SetSimulationMode(false, true);
}
}
//////////////////////////////////////////////////////////////////////////
void CObjectPhysicsManager::PrepareForExport()
{
// Clear the collision class set, ready for objects to register
// their collision classes
m_collisionClasses.clear();
m_collisionClassExportId = 0;
// First collision-class IS always the default one
RegisterCollisionClass(SCollisionClass(0, 0));
}
//////////////////////////////////////////////////////////////////////////
bool operator == (const SCollisionClass& lhs, const SCollisionClass& rhs)
{
return lhs.type == rhs.type && lhs.ignore == rhs.ignore;
}
//////////////////////////////////////////////////////////////////////////
int CObjectPhysicsManager::RegisterCollisionClass(const SCollisionClass& collclass)
{
TCollisionClassVector::iterator it = std::find(m_collisionClasses.begin(), m_collisionClasses.end(), collclass);
if (it == m_collisionClasses.end())
{
m_collisionClasses.push_back(collclass);
return m_collisionClasses.size() - 1;
}
return it - m_collisionClasses.begin();
}
//////////////////////////////////////////////////////////////////////////
int CObjectPhysicsManager::GetCollisionClassId(const SCollisionClass& collclass)
{
TCollisionClassVector::iterator it = std::find(m_collisionClasses.begin(), m_collisionClasses.end(), collclass);
if (it == m_collisionClasses.end())
{
return 0;
}
return it - m_collisionClasses.begin();
}
//////////////////////////////////////////////////////////////////////////
void CObjectPhysicsManager::SerializeCollisionClasses(CXmlArchive& xmlAr)
{
if (!xmlAr.bLoading)
{
// Storing
CLogFile::WriteLine("Storing Collision Classes ...");
XmlNodeRef root = xmlAr.root->newChild("CollisionClasses");
int count = m_collisionClasses.size();
for (int i = 0; i < count; i++)
{
SCollisionClass& cc = m_collisionClasses[i];
XmlNodeRef xmlCC = root->newChild("CollisionClass");
xmlCC->setAttr("type", cc.type);
xmlCC->setAttr("ignore", cc.ignore);
}
}
}
@@ -1,56 +0,0 @@
/*
* 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.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#ifndef CRYINCLUDE_EDITOR_OBJECTS_OBJECTPHYSICSMANAGER_H
#define CRYINCLUDE_EDITOR_OBJECTS_OBJECTPHYSICSMANAGER_H
#pragma once
//////////////////////////////////////////////////////////////////////////
class CObjectPhysicsManager
{
public:
CObjectPhysicsManager();
~CObjectPhysicsManager();
void SimulateSelectedObjectsPositions();
void Update();
//////////////////////////////////////////////////////////////////////////
/// Collision Classes
//////////////////////////////////////////////////////////////////////////
int RegisterCollisionClass(const SCollisionClass& collclass);
int GetCollisionClassId(const SCollisionClass& collclass);
void SerializeCollisionClasses(CXmlArchive& xmlAr);
void PrepareForExport();
private:
void Command_SimulateObjects();
void Command_GetPhysicsState();
void Command_ResetPhysicsState();
void UpdateSimulatingObjects();
bool m_bSimulatingObjects;
float m_fStartObjectSimulationTime;
int m_wasSimObjects;
std::vector<_smart_ptr<CBaseObject> > m_simObjects;
typedef std::vector<SCollisionClass> TCollisionClassVector;
int m_collisionClassExportId;
TCollisionClassVector m_collisionClasses;
};
#endif // CRYINCLUDE_EDITOR_OBJECTS_OBJECTPHYSICSMANAGER_H
@@ -638,8 +638,6 @@ set(FILES
Objects/ObjectManager.h
Objects/ObjectManagerLegacyUndo.cpp
Objects/ObjectManagerLegacyUndo.h
Objects/ObjectPhysicsManager.cpp
Objects/ObjectPhysicsManager.h
Objects/DisplayContext.cpp
Objects/DisplayContext.h
Objects/EntityObject.cpp
+1 -1
View File
@@ -13,6 +13,7 @@ add_subdirectory(SceneAPI) # Needs to go before AssetProcessor since it provides
add_subdirectory(AssetProcessor)
add_subdirectory(AWSNativeSDKInit)
add_subdirectory(AzTestRunner)
add_subdirectory(CrashHandler)
add_subdirectory(CryCommonTools)
add_subdirectory(CryXML)
add_subdirectory(HLSLCrossCompiler)
@@ -21,7 +22,6 @@ add_subdirectory(News)
add_subdirectory(PythonBindingsExample)
add_subdirectory(RC)
add_subdirectory(RemoteConsole)
add_subdirectory(CrashHandler)
add_subdirectory(ShaderCacheGen)
add_subdirectory(DeltaCataloger)
add_subdirectory(SerializeContextTools)
+3 -5
View File
@@ -32,11 +32,11 @@ ly_add_target(
PRIVATE
${pal_dir}
BUILD_DEPENDENCIES
PUBLIC
AZ::CrashSupport
PRIVATE
3rdParty::Crashpad
AZ::AzCore
AZ::AzFramework
AZ::CrashSupport
)
string(REPLACE "." ";" version_list "${LY_VERSION_STRING}")
@@ -67,11 +67,9 @@ ly_add_target(
PRIVATE
Uploader/include/Uploader
BUILD_DEPENDENCIES
PRIVATE
AZ::AzCore
AZ::CrashSupport
PUBLIC
3rdParty::Crashpad::Handler
AZ::CrashSupport
)
add_subdirectory(Tools)
@@ -19,6 +19,6 @@ ly_add_target(
PUBLIC
include
BUILD_DEPENDENCIES
PRIVATE
PUBLIC
AZ::AzCore
)
+3 -7
View File
@@ -21,13 +21,13 @@ ly_add_target(
tools_crash_handler_files.cmake
Platform/${PAL_PLATFORM_NAME}/tools_crash_handler_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
INCLUDE_DIRECTORIES
PRIVATE
PUBLIC
.
BUILD_DEPENDENCIES
PUBLIC
AZ::CrashHandler
PRIVATE
3rdParty::Qt::Core
AZ::CrashHandler
AZ::CrashSupport
AZ::AzToolsFramework
)
@@ -41,18 +41,14 @@ ly_add_target(
Platform/${PAL_PLATFORM_NAME}/tools_crash_uploader_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
INCLUDE_DIRECTORIES
PRIVATE
.
Uploader
BUILD_DEPENDENCIES
PRIVATE
3rdParty::Qt::Core
3rdParty::Qt::Gui
3rdParty::Qt::Widgets
3rdParty::Crashpad
3rdParty::Crashpad::Handler
AZ::CrashUploaderSupport
AZ::AzQtComponents
AZ::CrashSupport
TARGET_PROPERTIES
Qt5_NO_LINK_QTMAIN TRUE
)
@@ -138,7 +138,7 @@ namespace O3de
if (!logFileReader->Open(thisFile))
{
#if defined(AZ_PLATFORM_WINDOWS)
LOG(ERROR) << "Failed to open " << base::UTF16ToUTF8(thisFile.BaseName().value());
LOG(ERROR) << "Failed to open " << base::WideToUTF8(thisFile.BaseName().value());
#else
LOG(ERROR) << "Failed to open " << thisFile.BaseName().value();
#endif
@@ -149,7 +149,7 @@ namespace O3de
if (start_offset < 0)
{
#if defined(AZ_PLATFORM_WINDOWS)
LOG(ERROR) << "Failed to get offset for " << base::UTF16ToUTF8(thisFile.BaseName().value());
LOG(ERROR) << "Failed to get offset for " << base::WideToUTF8(thisFile.BaseName().value());
#else
LOG(ERROR) << "Failed to get offset for " << thisFile.BaseName().value();
#endif
@@ -162,7 +162,7 @@ namespace O3de
std::string fileNameKey{ "attachment_" };
#if defined(AZ_PLATFORM_WINDOWS)
fileNameKey += base::UTF16ToUTF8(thisFile.BaseName().value());
fileNameKey += base::WideToUTF8(thisFile.BaseName().value());
#else
fileNameKey += thisFile.BaseName().value();
#endif