Merge branch 'stabilization/2106' into Helios_TransformImporterFixV2_stabilization_2106

This commit is contained in:
amzn-mike
2021-06-21 11:50:17 -05:00
21 changed files with 243 additions and 70 deletions
@@ -14679,6 +14679,25 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro
<translation></translation>
</message>
</context>
<context>
<name>Method: NetBindComponent</name>
<message id="NETBINDCOMPONENT_ISNETENTITYROLEAUTHORITY_TOOLTIP">
<source>NETBINDCOMPONENT_ISNETENTITYROLEAUTHORITY_TOOLTIP</source>
<translation>Returns true if this network entity is an authoritative proxy on a server (full authority); otherwise false.</translation>
</message>
<message id="NETBINDCOMPONENT_ISNETENTITYROLEAUTONOMOUS_TOOLTIP">
<source>NETBINDCOMPONENT_ISNETENTITYROLEAUTONOMOUS_TOOLTIP</source>
<translation>Returns true if this network entity is an autonomous proxy on a client (can execute local prediction) or if this network entity is an authoritative proxy on a server but has autonomous privileges (ie: a host who is also a player); otherwise false.</translation>
</message>
<message id="NETBINDCOMPONENT_ISNETENTITYROLECLIENT_TOOLTIP">
<source>NETBINDCOMPONENT_ISNETENTITYROLECLIENT_TOOLTIP</source>
<translation>Returns true if this network entity is a simulated proxy on a client; otherwise false.</translation>
</message>
<message id="NETBINDCOMPONENT_ISNETENTITYROLESERVER_TOOLTIP">
<source>NETBINDCOMPONENT_ISNETENTITYROLESERVER_TOOLTIP</source>
<translation>Returns true if this network entity is a simulated proxy on a server (ie: a different server may own this entity, but the entity has been replicated to this server; otherwise false.</translation>
</message>
</context>
<context>
<name>Method: Math</name>
<message id="MATH_NAME">
@@ -493,7 +493,30 @@ namespace AzQtComponents
}
}
break;
}
case CE_MenuItem:
{
const QMenu* menu = qobject_cast<const QMenu*>(widget);
QAction* action = menu->activeAction();
if (action)
{
QMenu* subMenu = action->menu();
if (subMenu)
{
QVariant noHover = subMenu->property("noHover");
if (noHover.isValid() && noHover.toBool())
{
// First draw as standard to get the correct hover background for the complete control.
QProxyStyle::drawControl(element, option, painter, widget);
// Now draw the icon as non-hovered so control behaves as designed.
QStyleOptionMenuItem myOpt = *qstyleoption_cast<const QStyleOptionMenuItem*>(option);
myOpt.state &= ~QStyle::State_Selected;
return QProxyStyle::drawControl(element, &myOpt, painter, widget);
}
}
}
}
break;
}
return QProxyStyle::drawControl(element, option, painter, widget);
}
@@ -1,4 +1,4 @@
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M11.0708 0.87087L11.0708 0.87074C10.4286 0.371024 9.61107 0.13517 8.79265 0.213464C7.97422 0.291757 7.21961 0.678004 6.6897 1.28985L5.76756 2.36366C5.63378 2.51944 5.56909 2.72055 5.58771 2.92273C5.60634 3.12492 5.70675 3.31163 5.86686 3.44178C6.02698 3.57194 6.23368 3.63488 6.44149 3.61676C6.6493 3.59864 6.8412 3.50094 6.97498 3.34516L7.89716 2.27122C8.03184 2.11488 8.19736 1.98639 8.38395 1.89334C8.57053 1.8003 8.7744 1.74459 8.98349 1.7295C9.19258 1.71442 9.40266 1.74027 9.60131 1.80552C9.79996 1.87078 9.98315 1.97411 10.1401 2.10942C10.4422 2.38256 10.6244 2.75851 10.6488 3.15904C10.6732 3.55957 10.5379 3.95383 10.2711 4.25978L8.35381 6.49309L8.33616 6.51209C8.23375 6.62767 8.11374 6.72729 7.98031 6.80749C7.67189 6.99364 7.30661 7.06983 6.94686 7.02305C6.58711 6.97626 6.25522 6.8094 6.00789 6.55097C5.86556 6.40288 5.66865 6.31578 5.46039 6.30879C5.25213 6.30179 5.04952 6.37546 4.89703 6.51365C4.74453 6.65183 4.65462 6.84323 4.64701 7.04584C4.6394 7.24845 4.71472 7.44572 4.85645 7.59436C5.21222 7.96578 5.65746 8.24515 6.15198 8.40726C6.6465 8.56937 7.17473 8.60911 7.68898 8.52289C7.84983 8.49539 8.00828 8.45599 8.16298 8.40505C8.70939 8.22568 9.19408 7.90261 9.56335 7.47165L11.4758 5.24457C11.7478 4.92529 11.9523 4.55683 12.0773 4.16038C12.2024 3.76394 12.2457 3.34735 12.2046 2.93457C12.1671 2.53429 12.0475 2.1454 11.8527 1.79092C11.658 1.43644 11.3921 1.12358 11.0708 0.87087Z" fill="white"/>
<path d="M5.40958 9.14055L4.58546 10.1003C4.32342 10.4101 3.94867 10.6097 3.53919 10.6576C3.12972 10.7054 2.71706 10.5977 2.3871 10.357C2.22234 10.2309 2.08525 10.0738 1.98392 9.89526C1.8826 9.71668 1.81911 9.52014 1.79719 9.31727C1.77528 9.1144 1.79539 8.90932 1.85634 8.71414C1.91729 8.51896 2.01784 8.33765 2.15204 8.18093L4.10231 5.90975L4.11666 5.89415C4.21908 5.77861 4.3391 5.67903 4.47254 5.59887C4.75216 5.42921 5.07976 5.34988 5.4085 5.37222C5.73725 5.39457 6.05033 5.51745 6.30299 5.72329C6.3635 5.77246 6.42015 5.82595 6.47246 5.88333C6.54738 5.9658 6.63971 6.03156 6.74316 6.07611C6.84661 6.12066 6.95872 6.14295 7.07184 6.14146C7.18361 6.13992 7.29372 6.11492 7.39465 6.06817C7.49558 6.02143 7.58495 5.95403 7.65666 5.8706L7.66607 5.85958C7.78641 5.72083 7.85132 5.54454 7.8489 5.36301C7.84647 5.18148 7.77687 5.00689 7.65286 4.87124C7.35341 4.54132 6.98422 4.27825 6.57057 4.10003C6.15692 3.92182 5.70858 3.83266 5.25623 3.83866C4.80388 3.84467 4.35821 3.94569 3.94971 4.13482C3.54122 4.32395 3.17954 4.59672 2.88945 4.93446L0.944626 7.19943C0.420065 7.81564 0.163643 8.60683 0.230025 9.40433C0.296406 10.2018 0.68034 10.9426 1.29998 11.4686C1.61272 11.7312 1.97644 11.9301 2.3696 12.0535C2.76277 12.1769 3.17738 12.2223 3.5889 12.187C3.687 12.1793 3.78434 12.1672 3.88093 12.1507C4.62877 12.0232 5.30663 11.6437 5.79562 11.0786L6.617 10.1221C6.75077 9.96628 6.81547 9.76517 6.79684 9.56299C6.77822 9.3608 6.6778 9.17409 6.51769 9.04394C6.35758 8.91378 6.15088 8.85084 5.94306 8.86896C5.73525 8.88708 5.54335 8.98477 5.40957 9.14055H5.40958Z" fill="white"/>
<path d="M11.0708 0.87087L11.0708 0.87074C10.4286 0.371024 9.61107 0.13517 8.79265 0.213464C7.97422 0.291757 7.21961 0.678004 6.6897 1.28985L5.76756 2.36366C5.63378 2.51944 5.56909 2.72055 5.58771 2.92273C5.60634 3.12492 5.70675 3.31163 5.86686 3.44178C6.02698 3.57194 6.23368 3.63488 6.44149 3.61676C6.6493 3.59864 6.8412 3.50094 6.97498 3.34516L7.89716 2.27122C8.03184 2.11488 8.19736 1.98639 8.38395 1.89334C8.57053 1.8003 8.7744 1.74459 8.98349 1.7295C9.19258 1.71442 9.40266 1.74027 9.60131 1.80552C9.79996 1.87078 9.98315 1.97411 10.1401 2.10942C10.4422 2.38256 10.6244 2.75851 10.6488 3.15904C10.6732 3.55957 10.5379 3.95383 10.2711 4.25978L8.35381 6.49309L8.33616 6.51209C8.23375 6.62767 8.11374 6.72729 7.98031 6.80749C7.67189 6.99364 7.30661 7.06983 6.94686 7.02305C6.58711 6.97626 6.25522 6.8094 6.00789 6.55097C5.86556 6.40288 5.66865 6.31578 5.46039 6.30879C5.25213 6.30179 5.04952 6.37546 4.89703 6.51365C4.74453 6.65183 4.65462 6.84323 4.64701 7.04584C4.6394 7.24845 4.71472 7.44572 4.85645 7.59436C5.21222 7.96578 5.65746 8.24515 6.15198 8.40726C6.6465 8.56937 7.17473 8.60911 7.68898 8.52289C7.84983 8.49539 8.00828 8.45599 8.16298 8.40505C8.70939 8.22568 9.19408 7.90261 9.56335 7.47165L11.4758 5.24457C11.7478 4.92529 11.9523 4.55683 12.0773 4.16038C12.2024 3.76394 12.2457 3.34735 12.2046 2.93457C12.1671 2.53429 12.0475 2.1454 11.8527 1.79092C11.658 1.43644 11.3921 1.12358 11.0708 0.87087Z" fill="#3F3F3F"/>
<path d="M5.40958 9.14055L4.58546 10.1003C4.32342 10.4101 3.94867 10.6097 3.53919 10.6576C3.12972 10.7054 2.71706 10.5977 2.3871 10.357C2.22234 10.2309 2.08525 10.0738 1.98392 9.89526C1.8826 9.71668 1.81911 9.52014 1.79719 9.31727C1.77528 9.1144 1.79539 8.90932 1.85634 8.71414C1.91729 8.51896 2.01784 8.33765 2.15204 8.18093L4.10231 5.90975L4.11666 5.89415C4.21908 5.77861 4.3391 5.67903 4.47254 5.59887C4.75216 5.42921 5.07976 5.34988 5.4085 5.37222C5.73725 5.39457 6.05033 5.51745 6.30299 5.72329C6.3635 5.77246 6.42015 5.82595 6.47246 5.88333C6.54738 5.9658 6.63971 6.03156 6.74316 6.07611C6.84661 6.12066 6.95872 6.14295 7.07184 6.14146C7.18361 6.13992 7.29372 6.11492 7.39465 6.06817C7.49558 6.02143 7.58495 5.95403 7.65666 5.8706L7.66607 5.85958C7.78641 5.72083 7.85132 5.54454 7.8489 5.36301C7.84647 5.18148 7.77687 5.00689 7.65286 4.87124C7.35341 4.54132 6.98422 4.27825 6.57057 4.10003C6.15692 3.92182 5.70858 3.83266 5.25623 3.83866C4.80388 3.84467 4.35821 3.94569 3.94971 4.13482C3.54122 4.32395 3.17954 4.59672 2.88945 4.93446L0.944626 7.19943C0.420065 7.81564 0.163643 8.60683 0.230025 9.40433C0.296406 10.2018 0.68034 10.9426 1.29998 11.4686C1.61272 11.7312 1.97644 11.9301 2.3696 12.0535C2.76277 12.1769 3.17738 12.2223 3.5889 12.187C3.687 12.1793 3.78434 12.1672 3.88093 12.1507C4.62877 12.0232 5.30663 11.6437 5.79562 11.0786L6.617 10.1221C6.75077 9.96628 6.81547 9.76517 6.79684 9.56299C6.77822 9.3608 6.6778 9.17409 6.51769 9.04394C6.35758 8.91378 6.15088 8.85084 5.94306 8.86896C5.73525 8.88708 5.54335 8.98477 5.40957 9.14055H5.40958Z" fill="#3F3F3F"/>
</svg>

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

@@ -13,6 +13,7 @@
#include <AzCore/Math/ToString.h>
#include <AzCore/Math/Transform.h>
#include <AzCore/Serialization/EditContext.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzFramework/Components/NonUniformScaleComponent.h>
#include <AzToolsFramework/ToolsComponents/EditorNonUniformScaleComponent.h>
@@ -57,6 +58,13 @@ namespace AzToolsFramework
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly);
}
}
if (auto behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
{
behaviorContext->ConstantProperty("EditorNonUniformScaleComponentTypeId", BehaviorConstant(EditorNonUniformScaleComponent::RTTI_Type()))
->Attribute(AZ::Script::Attributes::Module, "editor")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
}
}
void EditorNonUniformScaleComponent::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent)
@@ -210,6 +210,19 @@ namespace AzToolsFramework
//! Type to inherit to implement ViewportInteractionRequests.
using ViewportInteractionRequestBus = AZ::EBus<ViewportInteractionRequests, ViewportEBusTraits>;
//! An interface to notify when changes to viewport settings have happened.
class ViewportSettingNotifications
{
public:
virtual void OnGridSnappingChanged([[maybe_unused]] bool enabled) {}
virtual void OnDrawHelpersChanged([[maybe_unused]] bool enabled) {}
protected:
ViewportSettingNotifications() = default;
};
using ViewportSettingsNotificationBus = AZ::EBus<ViewportSettingNotifications, ViewportEBusTraits>;
//! Requests to freeze the Viewport Input
//! Added to prevent a bug with the legacy CryEngine Viewport code that would
//! keep doing raycast tests even when no level is loaded, causing a crash.
+6 -2
View File
@@ -45,6 +45,7 @@
#include <AzCore/std/algorithm.h>
#include <AzCore/Casting/numeric_cast.h>
#include <AzToolsFramework/Viewport/ViewportMessages.h>
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
#include "ui_ViewportTitleDlg.h"
@@ -57,13 +58,16 @@ inline namespace Helpers
{
void ToggleHelpers()
{
GetIEditor()->GetDisplaySettings()->DisplayHelpers(!GetIEditor()->GetDisplaySettings()->IsDisplayHelpers());
const bool newValue = !GetIEditor()->GetDisplaySettings()->IsDisplayHelpers();
GetIEditor()->GetDisplaySettings()->DisplayHelpers(newValue);
GetIEditor()->Notify(eNotify_OnDisplayRenderUpdate);
if (GetIEditor()->GetDisplaySettings()->IsDisplayHelpers() == false)
if (newValue == false)
{
GetIEditor()->GetObjectManager()->SendEvent(EVENT_HIDE_HELPER);
}
AzToolsFramework::ViewportInteraction::ViewportSettingsNotificationBus::Broadcast(
&AzToolsFramework::ViewportInteraction::ViewportSettingNotifications::OnDrawHelpersChanged, newValue);
}
bool IsHelpersShown()
@@ -46,6 +46,7 @@ namespace AWSCore
void InitializeAWSDocActions();
void InitializeAWSGlobalDocsSubMenu();
void InitializeAWSFeatureGemActions();
void AddSpaceForIcon(QMenu* menu);
// AWSCoreEditorRequestBus interface implementation
void SetAWSClientAuthEnabled() override;
@@ -35,6 +35,8 @@
namespace AWSCore
{
static constexpr int IconSize = 16;
AWSCoreEditorMenu::AWSCoreEditorMenu(const QString& text)
: QMenu(text)
, m_resourceMappingToolWatcher(nullptr)
@@ -43,6 +45,7 @@ namespace AWSCore
InitializeResourceMappingToolAction();
this->addSeparator();
InitializeAWSFeatureGemActions();
AddSpaceForIcon(this);
AWSCoreEditorRequestBus::Handler::BusConnect();
}
@@ -136,6 +139,8 @@ namespace AWSCore
globalDocsMenu->addAction(AddExternalLinkAction(AWSAndScriptCanvasActionText, AWSAndScriptCanvasUrl, ":/Notifications/link.svg"));
globalDocsMenu->addAction(AddExternalLinkAction(AWSAndComponentsActionText, AWSAndComponentsUrl, ":/Notifications/link.svg"));
globalDocsMenu->addAction(AddExternalLinkAction(CallAWSResourcesActionText, CallAWSResourcesUrl, ":/Notifications/link.svg"));
AddSpaceForIcon(globalDocsMenu);
}
void AWSCoreEditorMenu::InitializeAWSFeatureGemActions()
@@ -170,6 +175,8 @@ namespace AWSCore
AWSClientAuthPlatformSpecificActionText, AWSClientAuthPlatformSpecificUrl, ":/Notifications/link.svg"));
subMenu->addAction(AddExternalLinkAction(
AWSClientAuthAPIReferenceActionText, AWSClientAuthAPIReferenceUrl, ":/Notifications/link.svg"));
AddSpaceForIcon(subMenu);
}
void AWSCoreEditorMenu::SetAWSMetricsEnabled()
@@ -198,6 +205,7 @@ namespace AWSCore
QDesktopServices::openUrl(QUrl::fromLocalFile(configFilePath.c_str()));
});
subMenu->addAction(settingsAction);
AddSpaceForIcon(subMenu);
}
QMenu* AWSCoreEditorMenu::SetAWSFeatureSubMenu(const AZStd::string& menuText)
@@ -209,6 +217,7 @@ namespace AWSCore
{
QMenu* subMenu = new QMenu(QObject::tr(menuText.c_str()));
subMenu->setIcon(QIcon(QString(":/Notifications/checkmark.svg")));
subMenu->setProperty("noHover", true);
this->insertMenu(*itr, subMenu);
this->removeAction(*itr);
return subMenu;
@@ -216,4 +225,11 @@ namespace AWSCore
}
return nullptr;
}
void AWSCoreEditorMenu::AddSpaceForIcon(QMenu* menu)
{
QSize size = menu->sizeHint();
size.setWidth(size.width() + IconSize);
menu->setFixedSize(size);
}
} // namespace AWSCore
@@ -17,6 +17,7 @@
#include <AzCore/std/smart_ptr/make_shared.h>
#include <AzCore/std/string/conversions.h>
#include <AzCore/StringFunc/StringFunc.h>
#include <AzCore/Utils/Utils.h>
#include <ACETypes.h>
#include <AudioSystemControl_wwise.h>
@@ -540,11 +541,10 @@ namespace AudioControls
}
//-------------------------------------------------------------------------------------------//
AZStd::string CAudioSystemEditor_wwise::GetDataPath() const
AZ::IO::FixedMaxPath CAudioSystemEditor_wwise::GetDataPath() const
{
AZStd::string path(Path::GetEditingGameDataFolder());
AZ::StringFunc::Path::Join(path.c_str(), "sounds/wwise_project/", path);
return path;
auto projectPath = AZ::IO::FixedMaxPath{ AZ::Utils::GetProjectPath() };
return (projectPath / "sounds" / "wwise_project");
}
} // namespace AudioControls
@@ -86,7 +86,7 @@ namespace AudioControls
const AZStd::string_view GetTypeIcon(TImplControlType type) const override;
const AZStd::string_view GetTypeIconSelected(TImplControlType type) const override;
AZStd::string GetName() const override;
AZStd::string GetDataPath() const;
AZ::IO::FixedMaxPath GetDataPath() const override;
void DataSaved() override {}
void ConnectionRemoved(IAudioSystemControl* control) override;
//////////////////////////////////////////////////////////
@@ -54,12 +54,12 @@ namespace AudioControls
void CAudioWwiseLoader::Load(CAudioSystemEditor_wwise* audioSystemImpl)
{
m_audioSystemImpl = audioSystemImpl;
const AZStd::string wwiseProjectFullPath(m_audioSystemImpl->GetDataPath());
LoadControlsInFolder(wwiseProjectFullPath + WwiseStrings::GameParametersFolder);
LoadControlsInFolder(wwiseProjectFullPath + WwiseStrings::GameStatesFolder);
LoadControlsInFolder(wwiseProjectFullPath + WwiseStrings::SwitchesFolder);
LoadControlsInFolder(wwiseProjectFullPath + WwiseStrings::EventsFolder);
LoadControlsInFolder(wwiseProjectFullPath + WwiseStrings::EnvironmentsFolder);
const AZ::IO::FixedMaxPath wwiseProjectFullPath{ m_audioSystemImpl->GetDataPath() };
LoadControlsInFolder(AZ::IO::FixedMaxPath{ wwiseProjectFullPath / WwiseStrings::GameParametersFolder }.Native());
LoadControlsInFolder(AZ::IO::FixedMaxPath{ wwiseProjectFullPath / WwiseStrings::GameStatesFolder }.Native());
LoadControlsInFolder(AZ::IO::FixedMaxPath{ wwiseProjectFullPath / WwiseStrings::SwitchesFolder }.Native());
LoadControlsInFolder(AZ::IO::FixedMaxPath{ wwiseProjectFullPath / WwiseStrings::EventsFolder }.Native());
LoadControlsInFolder(AZ::IO::FixedMaxPath{ wwiseProjectFullPath / WwiseStrings::EnvironmentsFolder }.Native());
LoadSoundBanks(Audio::Wwise::GetBanksRootPath(), "", false);
}
@@ -14,6 +14,7 @@
#pragma once
#include <AzCore/EBus/EBus.h>
#include <AzCore/IO/Path/Path.h>
#include <AzCore/std/string/string_view.h>
#include <ACETypes.h>
@@ -151,7 +152,7 @@ namespace AudioControls
//! Gets the folder where the implementation specific controls data are stored.
//! This is used by the ACE to update if controls are changed while the editor is open.
//! @return String with the path to the folder where the implementation specific controls are stored.
virtual AZStd::string GetDataPath() const = 0;
virtual AZ::IO::FixedMaxPath GetDataPath() const = 0;
//! Informs the plugin that the ACE has saved the data in case it needs to do any clean up.
virtual void DataSaved() = 0;
@@ -218,7 +218,7 @@ namespace AudioControls
IAudioSystemEditor* pAudioSystemImpl = CAudioControlsEditorPlugin::GetAudioSystemEditorImpl();
if (pAudioSystemImpl)
{
StartWatchingFolder(pAudioSystemImpl->GetDataPath());
StartWatchingFolder(pAudioSystemImpl->GetDataPath().LexicallyNormal().Native());
m_pMiddlewareDockWidget->setWindowTitle(QString(pAudioSystemImpl->GetName().c_str()) + " Controls");
}
}
@@ -63,10 +63,10 @@ namespace Multiplayer
//! @}
NetEntityId GetNetEntityId() const;
bool IsAuthority() const;
bool IsAutonomous() const;
bool IsServer() const;
bool IsClient() const;
bool IsNetEntityRoleAuthority() const;
bool IsNetEntityRoleAutonomous() const;
bool IsNetEntityRoleServer() const;
bool IsNetEntityRoleClient() const;
ConstNetworkEntityHandle GetEntityHandle() const;
NetworkEntityHandle GetEntityHandle();
void MarkDirty();
@@ -64,10 +64,23 @@ namespace Multiplayer
//! @}
NetEntityRole GetNetEntityRole() const;
bool IsAuthority() const;
bool IsAutonomous() const;
bool IsServer() const;
bool IsClient() const;
//! IsNetEntityRoleAuthority
//! @return true if this network entity is an authoritative proxy on a server (full authority); otherwise false.
bool IsNetEntityRoleAuthority() const;
//! IsNetEntityRoleAutonomous
//! @return true if this network entity is an autonomous proxy on a client (can execute local prediction) or if this network entity is an authoritative proxy on a server but has autonomous privileges (ie: a host who is also a player); otherwise false.
bool IsNetEntityRoleAutonomous() const;
//! IsNetEntityRoleServer
//! @return true if this network entity is a simulated proxy on a server (ie: a different server may have authority for this entity, but the entity has been replicated on this server; otherwise false.
bool IsNetEntityRoleServer() const;
//! IsNetEntityRoleClient
//! @return true if this network entity is a simulated proxy on a client; otherwise false.
bool IsNetEntityRoleClient() const;
bool HasController() const;
NetEntityId GetNetEntityId() const;
const PrefabEntityId& GetPrefabEntityId() const;
@@ -46,24 +46,24 @@ namespace Multiplayer
return m_netBindComponent ? m_netBindComponent->GetNetEntityId() : InvalidNetEntityId;
}
bool MultiplayerComponent::IsAuthority() const
bool MultiplayerComponent::IsNetEntityRoleAuthority() const
{
return m_netBindComponent ? m_netBindComponent->IsAuthority() : false;
return m_netBindComponent ? m_netBindComponent->IsNetEntityRoleAuthority() : false;
}
bool MultiplayerComponent::IsAutonomous() const
bool MultiplayerComponent::IsNetEntityRoleAutonomous() const
{
return m_netBindComponent ? m_netBindComponent->IsAutonomous() : false;
return m_netBindComponent ? m_netBindComponent->IsNetEntityRoleAutonomous() : false;
}
bool MultiplayerComponent::IsServer() const
bool MultiplayerComponent::IsNetEntityRoleServer() const
{
return m_netBindComponent ? m_netBindComponent->IsServer() : false;
return m_netBindComponent ? m_netBindComponent->IsNetEntityRoleServer() : false;
}
bool MultiplayerComponent::IsClient() const
bool MultiplayerComponent::IsNetEntityRoleClient() const
{
return m_netBindComponent ? m_netBindComponent->IsClient() : false;
return m_netBindComponent ? m_netBindComponent->IsNetEntityRoleClient() : false;
}
ConstNetworkEntityHandle MultiplayerComponent::GetEntityHandle() const
@@ -29,12 +29,12 @@ namespace Multiplayer
bool MultiplayerController::IsAuthority() const
{
return GetNetBindComponent() ? GetNetBindComponent()->IsAuthority() : false;
return GetNetBindComponent() ? GetNetBindComponent()->IsNetEntityRoleAuthority() : false;
}
bool MultiplayerController::IsAutonomous() const
{
return GetNetBindComponent() ? GetNetBindComponent()->IsAutonomous() : false;
return GetNetBindComponent() ? GetNetBindComponent()->IsNetEntityRoleAutonomous() : false;
}
AZ::Entity* MultiplayerController::GetEntity() const
@@ -54,69 +54,72 @@ namespace Multiplayer
->Attribute(AZ::Script::Attributes::Module, "multiplayer")
->Attribute(AZ::Script::Attributes::Category, "Multiplayer")
->Method("IsAuthority", [](AZ::EntityId id) -> bool {
->Method("IsNetEntityRoleAuthority", [](AZ::EntityId id) -> bool {
AZ::Entity* entity = AZ::Interface<AZ::ComponentApplicationRequests>::Get()->FindEntity(id);
if (!entity)
{
AZ_Warning( "NetBindComponent", false, "NetBindComponent IsAuthority failed. The entity with id %s doesn't exist, please provide a valid entity id.", id.ToString().c_str())
AZ_Warning( "NetBindComponent", false, "NetBindComponent IsNetEntityRoleAuthority failed. The entity with id %s doesn't exist, please provide a valid entity id.", id.ToString().c_str())
return false;
}
NetBindComponent* netBindComponent = entity-> FindComponent<NetBindComponent>();
if (!netBindComponent)
{
AZ_Warning( "NetBindComponent", false, "NetBindComponent IsAuthority failed. Entity '%s' (id: %s) is missing a NetBindComponent, make sure this entity contains a component which derives from NetBindComponent.", entity->GetName().c_str(), id.ToString().c_str())
AZ_Warning( "NetBindComponent", false, "NetBindComponent IsNetEntityRoleAuthority failed. Entity '%s' (id: %s) is missing a NetBindComponent, make sure this entity contains a component which derives from NetBindComponent.", entity->GetName().c_str(), id.ToString().c_str())
return false;
}
return netBindComponent->IsAuthority();
return netBindComponent->IsNetEntityRoleAuthority();
})
->Method("IsAutonomous", [](AZ::EntityId id) -> bool {
->Method("IsNetEntityRoleAutonomous", [](AZ::EntityId id) -> bool {
AZ::Entity* entity = AZ::Interface<AZ::ComponentApplicationRequests>::Get()->FindEntity(id);
if (!entity)
{
AZ_Warning( "NetBindComponent", false, "NetBindComponent IsAutonomous failed. The entity with id %s doesn't exist, please provide a valid entity id.", id.ToString().c_str())
AZ_Warning( "NetBindComponent", false, "NetBindComponent IsNetEntityRoleAutonomous failed. The entity with id %s doesn't exist, please provide a valid entity id.", id.ToString().c_str())
return false;
}
NetBindComponent* netBindComponent = entity->FindComponent<NetBindComponent>();
if (!netBindComponent)
{
AZ_Warning("NetBindComponent", false, "NetBindComponent IsAutonomous failed. Entity '%s' (id: %s) is missing a NetBindComponent, make sure this entity contains a component which derives from NetBindComponent.", entity->GetName().c_str(), id.ToString().c_str())
AZ_Warning("NetBindComponent", false, "NetBindComponent IsNetEntityRoleAutonomous failed. Entity '%s' (id: %s) is missing a NetBindComponent, make sure this entity contains a component which derives from NetBindComponent.", entity->GetName().c_str(), id.ToString().c_str())
return false;
}
return netBindComponent->IsAutonomous();
return netBindComponent->IsNetEntityRoleAutonomous();
})
->Method("IsClient", [](AZ::EntityId id) -> bool {
->Method("IsNetEntityRoleClient", [](AZ::EntityId id) -> bool {
AZ::Entity* entity = AZ::Interface<AZ::ComponentApplicationRequests>::Get()->FindEntity(id);
if (!entity)
{
AZ_Warning( "NetBindComponent", false, "NetBindComponent IsClient failed. The entity with id %s doesn't exist, please provide a valid entity id.", id.ToString().c_str())
AZ_Warning( "NetBindComponent", false, "NetBindComponent IsNetEntityRoleClient failed. The entity with id %s doesn't exist, please provide a valid entity id.", id.ToString().c_str())
return false;
}
NetBindComponent* netBindComponent = entity->FindComponent<NetBindComponent>();
if (!netBindComponent)
{
AZ_Warning("NetBindComponent", false, "NetBindComponent IsClient failed. Entity '%s' (id: %s) is missing a NetBindComponent, make sure this entity contains a component which derives from NetBindComponent.", entity->GetName().c_str(), id.ToString().c_str())
AZ_Warning("NetBindComponent", false, "NetBindComponent IsNetEntityRoleClient failed. Entity '%s' (id: %s) is missing a NetBindComponent, make sure this entity contains a component which derives from NetBindComponent.", entity->GetName().c_str(), id.ToString().c_str())
return false;
}
return netBindComponent->IsClient();
return netBindComponent->IsNetEntityRoleClient();
})
->Method("IsServer", [](AZ::EntityId id) -> bool {
->Method("IsNetEntityRoleServer", [](AZ::EntityId id) -> bool {
AZ::Entity* entity = AZ::Interface<AZ::ComponentApplicationRequests>::Get()->FindEntity(id);
if (!entity)
{
AZ_Warning( "NetBindComponent", false, "NetBindComponent IsServer failed. The entity with id %s doesn't exist, please provide a valid entity id.", id.ToString().c_str())
AZ_Warning( "NetBindComponent", false, "NetBindComponent IsNetEntityRoleServer failed. The entity with id %s doesn't exist, please provide a valid entity id.", id.ToString().c_str())
return false;
}
NetBindComponent* netBindComponent = entity->FindComponent<NetBindComponent>();
if (!netBindComponent)
{
AZ_Warning("NetBindComponent", false, "NetBindComponent IsServer failed. Entity '%s' (id: %s) is missing a NetBindComponent, make sure this entity contains a component which derives from NetBindComponent.", entity->GetName().c_str(), id.ToString().c_str())
AZ_Warning("NetBindComponent", false, "NetBindComponent IsNetEntityRoleServer failed. Entity '%s' (id: %s) is missing a NetBindComponent, make sure this entity contains a component which derives from NetBindComponent.", entity->GetName().c_str(), id.ToString().c_str())
return false;
}
return netBindComponent->IsServer();
return netBindComponent->IsNetEntityRoleServer();
})
;
}
@@ -179,23 +182,23 @@ namespace Multiplayer
return m_netEntityRole;
}
bool NetBindComponent::IsAuthority() const
bool NetBindComponent::IsNetEntityRoleAuthority() const
{
return (m_netEntityRole == NetEntityRole::Authority);
}
bool NetBindComponent::IsAutonomous() const
bool NetBindComponent::IsNetEntityRoleAutonomous() const
{
return (m_netEntityRole == NetEntityRole::Autonomous)
|| (m_netEntityRole == NetEntityRole::Authority) && m_allowAutonomy;
}
bool NetBindComponent::IsServer() const
bool NetBindComponent::IsNetEntityRoleServer() const
{
return (m_netEntityRole == NetEntityRole::Server);
}
bool NetBindComponent::IsClient() const
bool NetBindComponent::IsNetEntityRoleClient() const
{
return (m_netEntityRole == NetEntityRole::Client);
}
@@ -96,7 +96,7 @@ namespace Multiplayer
{
AZ_Assert(entityHandle.GetNetBindComponent(), "No NetBindComponent found on networked entity");
[[maybe_unused]] const bool isClientOnlyEntity = false;// (ServerIdFromEntityId(it->first) == InvalidHostId);
AZ_Assert(entityHandle.GetNetBindComponent()->IsAuthority() || isClientOnlyEntity, "Trying to delete a proxy entity, this will lead to issues deserializing entity updates");
AZ_Assert(entityHandle.GetNetBindComponent()->IsNetEntityRoleAuthority() || isClientOnlyEntity, "Trying to delete a proxy entity, this will lead to issues deserializing entity updates");
}
m_removeList.push_back(entityHandle.GetNetEntityId());
m_removeEntitiesEvent.Enqueue(AZ::TimeMs{ 0 });
+67 -11
View File
@@ -17,6 +17,7 @@
#include <AzCore/Component/ComponentApplicationBus.h>
#include <AzCore/Component/TickBus.h>
#include <AzCore/Interface/Interface.h>
#include <AzFramework/Entity/EntityDebugDisplayBus.h>
#include <AzFramework/Physics/MaterialBus.h>
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
#include <LyViewPaneNames.h>
@@ -56,6 +57,15 @@ namespace PhysX
return false;
}
bool IsDrawColliderReadOnly()
{
bool helpersVisible = false;
AzToolsFramework::EditorRequestBus::BroadcastResult(helpersVisible,
&AzToolsFramework::EditorRequests::DisplayHelpersVisible);
// if helpers are visible, draw colliders is NOT read only and can be changed.
return !helpersVisible;
}
static void BuildAABBVerts(const AZ::Aabb& aabb,
AZStd::vector<AZ::Vector3>& verts,
AZStd::vector<AZ::Vector3>& points,
@@ -145,28 +155,42 @@ namespace PhysX
"PhysX Collider Debug Draw", "Manages global and per-collider debug draw settings and logic")
->DataElement(AZ::Edit::UIHandlers::CheckBox, &Collider::m_locallyEnabled, "Draw collider",
"Shows the geometry for the collider in the viewport")
->Attribute(AZ::Edit::Attributes::CheckboxTooltip,
"If set, the geometry of this collider is visible in the viewport")
->Attribute(AZ::Edit::Attributes::Visibility,
VisibilityFunc{ []() { return IsGlobalColliderDebugCheck(GlobalCollisionDebugState::Manual); } })
->Attribute(AZ::Edit::Attributes::CheckboxTooltip,
"If set, the geometry of this collider is visible in the viewport. 'Draw Helpers' needs to be enabled to use.")
->Attribute(AZ::Edit::Attributes::Visibility,
VisibilityFunc{ []() { return IsGlobalColliderDebugCheck(GlobalCollisionDebugState::Manual); } })
->Attribute(AZ::Edit::Attributes::ReadOnly, &IsDrawColliderReadOnly)
->DataElement(AZ::Edit::UIHandlers::Button, &Collider::m_globalButtonState, "Draw collider",
"Shows the geometry for the collider in the viewport")
->Attribute(AZ::Edit::Attributes::ButtonText, "Global override")
->Attribute(AZ::Edit::Attributes::ButtonTooltip,
"A global setting is overriding this property (to disable the override, "
"set the Global Collision Debug setting to \"Set manually\" in the PhysX Configuration)")
->Attribute(AZ::Edit::Attributes::Visibility,
VisibilityFunc{ []() { return !IsGlobalColliderDebugCheck(GlobalCollisionDebugState::Manual); } })
->Attribute(AZ::Edit::Attributes::ChangeNotify, &OpenPhysXSettingsWindow)
->Attribute(AZ::Edit::Attributes::ButtonText, "Global override")
->Attribute(AZ::Edit::Attributes::ButtonTooltip,
"A global setting is overriding this property (to disable the override, "
"set the Global Collision Debug setting to \"Set manually\" in the PhysX Configuration)."
"'Draw Helpers' needs to be enabled to use.")
->Attribute(AZ::Edit::Attributes::Visibility,
VisibilityFunc{ []() { return !IsGlobalColliderDebugCheck(GlobalCollisionDebugState::Manual); } })
->Attribute(AZ::Edit::Attributes::ChangeNotify, &OpenPhysXSettingsWindow)
->Attribute(AZ::Edit::Attributes::ReadOnly, &IsDrawColliderReadOnly)
;
}
}
}
Collider::Collider()
: m_debugDisplayDataChangedEvent(
[this]([[maybe_unused]] const PhysX::Debug::DebugDisplayData& data)
{
this->RefreshTreeHelper();
})
{
}
void Collider::Connect(AZ::EntityId entityId)
{
m_entityId = entityId;
AzFramework::EntityDebugDisplayEventBus::Handler::BusConnect(m_entityId);
AzToolsFramework::EntitySelectionEvents::Bus::Handler::BusConnect(m_entityId);
}
void Collider::SetDisplayCallback(const DisplayCallback* callback)
@@ -176,6 +200,11 @@ namespace PhysX
void Collider::Disconnect()
{
if (AzToolsFramework::ViewportInteraction::ViewportSettingsNotificationBus::Handler::BusIsConnected())
{
AzToolsFramework::ViewportInteraction::ViewportSettingsNotificationBus::Handler::BusDisconnect();
}
AzToolsFramework::EntitySelectionEvents::Bus::Handler::BusDisconnect();
AzFramework::EntityDebugDisplayEventBus::Handler::BusDisconnect();
m_displayCallback = nullptr;
m_entityId = AZ::EntityId();
@@ -731,6 +760,33 @@ namespace PhysX
}
}
void Collider::OnDrawHelpersChanged([[maybe_unused]] bool enabled)
{
RefreshTreeHelper();
}
void Collider::OnSelected()
{
AzToolsFramework::ViewportInteraction::ViewportSettingsNotificationBus::Handler::BusConnect(
AzFramework::g_defaultSceneEntityDebugDisplayId);
if (auto* physXDebug = AZ::Interface<Debug::PhysXDebugInterface>::Get())
{
physXDebug->RegisterDebugDisplayDataChangedEvent(m_debugDisplayDataChangedEvent);
}
}
void Collider::OnDeselected()
{
AzToolsFramework::ViewportInteraction::ViewportSettingsNotificationBus::Handler::BusDisconnect();
m_debugDisplayDataChangedEvent.Disconnect();
}
void Collider::RefreshTreeHelper()
{
AzToolsFramework::ToolsApplicationEvents::Bus::Broadcast(
&AzToolsFramework::ToolsApplicationEvents::Bus::Events::InvalidatePropertyDisplay, AzToolsFramework::Refresh_AttributesAndValues);
}
AZStd::string Collider::GetEntityName() const
{
AZStd::string entityName;
+18 -2
View File
@@ -15,8 +15,11 @@
#include <AzFramework/Entity/EntityDebugDisplayBus.h>
#include <AzFramework/Physics/ShapeConfiguration.h>
#include <AzFramework/Physics/Shape.h>
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
#include <AzToolsFramework/Viewport/ViewportMessages.h>
#include <PhysX/MeshAsset.h>
#include <PhysX/Debug/PhysXDebugConfiguration.h>
#include <PhysX/Debug/PhysXDebugInterface.h>
namespace PhysX
{
@@ -40,13 +43,15 @@ namespace PhysX
class Collider
: protected AzFramework::EntityDebugDisplayEventBus::Handler
, protected AzToolsFramework::ViewportInteraction::ViewportSettingsNotificationBus::Handler
, protected AzToolsFramework::EntitySelectionEvents::Bus::Handler
{
public:
AZ_CLASS_ALLOCATOR(Collider, AZ::SystemAllocator, 0);
AZ_RTTI(Collider, "{7DE9CA01-DF1E-4D72-BBF4-76C9136BE6A2}");
static void Reflect(AZ::ReflectContext* context);
Collider() = default;
Collider();
void Connect(AZ::EntityId entityId);
void SetDisplayCallback(const DisplayCallback* callback);
@@ -109,11 +114,20 @@ namespace PhysX
const AZStd::vector<AZ::u32>& GetIndices(AZ::u32 geomIndex) const;
protected:
// AzFramework::EntityDebugDisplayEventBus
// AzFramework::EntityDebugDisplayEventBus overrides ...
void DisplayEntityViewport(
const AzFramework::ViewportInfo& viewportInfo,
AzFramework::DebugDisplayRequests& debugDisplay) override;
// AzToolsFramework::ViewportInteraction::ViewportSettingsNotificationBus::Handler overrides ...
void OnDrawHelpersChanged(bool enabled) override;
// AzToolsFramework::EntitySelectionEvents::Bus::Handler overrides ...
void OnSelected() override;
void OnDeselected() override;
void RefreshTreeHelper();
// Internal mesh drawing subroutines
void DrawTriangleMesh(
AzFramework::DebugDisplayRequests& debugDisplay, const Physics::ColliderConfiguration& colliderConfig, AZ::u32 geomIndex,
@@ -143,6 +157,8 @@ namespace PhysX
};
mutable AZStd::vector<GeometryData> m_geometry;
PhysX::Debug::DebugDisplayDataChangedEvent::Handler m_debugDisplayDataChangedEvent;
};
} // namespace DebugDraw
} // namespace PhysX