Adding nullptr checks in Gems/ for Get3DEngine()
This commit is contained in:
@@ -48,7 +48,7 @@ namespace PhysX
|
||||
AzToolsFramework::EditorRequests::Bus::BroadcastResult(editor, &AzToolsFramework::EditorRequests::GetEditor);
|
||||
|
||||
ISurfaceTypeEnumerator* surfaceTypeEnumerator = nullptr;
|
||||
if (editor)
|
||||
if (editor && editor->Get3DEngine())
|
||||
{
|
||||
surfaceTypeEnumerator = editor->Get3DEngine()->GetMaterialManager()->GetSurfaceTypeManager()->GetEnumerator();
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ namespace Visibility
|
||||
|
||||
EditorOccluderAreaComponent::~EditorOccluderAreaComponent()
|
||||
{
|
||||
if (m_area)
|
||||
if (m_area && GetIEditor()->Get3DEngine())
|
||||
{
|
||||
GetIEditor()->Get3DEngine()->DeleteVisArea(m_area);
|
||||
m_area = nullptr;
|
||||
@@ -220,7 +220,7 @@ namespace Visibility
|
||||
/// Configuration are set.
|
||||
void EditorOccluderAreaComponent::UpdateOccluderAreaObject()
|
||||
{
|
||||
if (m_area)
|
||||
if (m_area && GetIEditor()->Get3DEngine())
|
||||
{
|
||||
AZStd::array<Vec3, 4> verts;
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ namespace Visibility
|
||||
|
||||
EditorPortalComponent::~EditorPortalComponent()
|
||||
{
|
||||
if (m_area)
|
||||
if (m_area && GetIEditor()->Get3DEngine())
|
||||
{
|
||||
// reset the listener vis area in the unlucky case that we are deleting the
|
||||
// vis area where the listener is currently in
|
||||
@@ -232,7 +232,7 @@ namespace Visibility
|
||||
// This means that dynamic slices cannot effectively contain vis-areas until we fix the core rendering system to allow that.
|
||||
|
||||
const auto visGUID = static_cast<AZ::u64>(entityId);
|
||||
if(!m_area && GetIEditor())
|
||||
if(!m_area && GetIEditor() && GetIEditor()->Get3DEngine())
|
||||
{
|
||||
m_area = GetIEditor()->Get3DEngine()->CreateVisArea(visGUID);
|
||||
}
|
||||
@@ -453,7 +453,10 @@ namespace Visibility
|
||||
verts[i] = m_cryCachedWorldTransform.TransformPoint(verts[i]);
|
||||
}
|
||||
|
||||
GetIEditor()->Get3DEngine()->UpdateVisArea(m_area, &verts[0], verts.size(), name.c_str(), info, true);
|
||||
if (GetIEditor()->Get3DEngine())
|
||||
{
|
||||
GetIEditor()->Get3DEngine()->UpdateVisArea(m_area, &verts[0], verts.size(), name.c_str(), info, true);
|
||||
}
|
||||
|
||||
AzFramework::EntityBoundsUnionRequestBus::Broadcast(
|
||||
&AzFramework::EntityBoundsUnionRequestBus::Events::RefreshEntityLocalBoundsUnion, GetEntityId());
|
||||
|
||||
@@ -188,7 +188,7 @@ namespace Visibility
|
||||
|
||||
EditorVisAreaComponent::~EditorVisAreaComponent()
|
||||
{
|
||||
if (m_area)
|
||||
if (m_area && GetIEditor()->Get3DEngine())
|
||||
{
|
||||
// Reset the listener vis area in the unlucky case that we are deleting the
|
||||
// vis area where the listener is currently in
|
||||
@@ -209,7 +209,7 @@ namespace Visibility
|
||||
// This means that dynamic slices cannot effectively contain vis areas until we fix the core rendering system to allow that.
|
||||
|
||||
const auto visGUID = AZ::u64(entityId);
|
||||
if(!m_area && GetIEditor())
|
||||
if(!m_area && GetIEditor() && GetIEditor()->Get3DEngine())
|
||||
{
|
||||
m_area = GetIEditor()->Get3DEngine()->CreateVisArea(visGUID);
|
||||
}
|
||||
@@ -347,7 +347,10 @@ namespace Visibility
|
||||
|
||||
const AZStd::string name = AZStd::string("vis-area_") + GetEntity()->GetName();
|
||||
|
||||
GetIEditor()->Get3DEngine()->UpdateVisArea(m_area, &points[0], points.size(), name.c_str(), info, true);
|
||||
if (GetIEditor()->Get3DEngine())
|
||||
{
|
||||
GetIEditor()->Get3DEngine()->UpdateVisArea(m_area, &points[0], points.size(), name.c_str(), info, true);
|
||||
}
|
||||
|
||||
AzFramework::EntityBoundsUnionRequestBus::Broadcast(
|
||||
&AzFramework::EntityBoundsUnionRequestBus::Events::RefreshEntityLocalBoundsUnion, GetEntityId());
|
||||
|
||||
Reference in New Issue
Block a user