Change LOAD_LEGACY_RENDERER_FOR_EDITOR from true -> false (#315)
Change LOAD_LEGACY_RENDERER_FOR_EDITOR from true -> false, and added some null checks to protect against gEnv->pRenderer and gEnv->p3DEngine now being null in the editor as well as the launcher.
This commit is contained in:
@@ -247,7 +247,7 @@ CUNIXConsole* pUnixConsole;
|
||||
|
||||
#define LOCALIZATION_TRANSLATIONS_LIST_FILE_NAME "Libs/Localization/localization.xml"
|
||||
|
||||
#define LOAD_LEGACY_RENDERER_FOR_EDITOR true // If you set this to false you must for now also set 'ed_useAtomNativeViewport' to true (see /Code/Sandbox/Editor/ViewManager.cpp)
|
||||
#define LOAD_LEGACY_RENDERER_FOR_EDITOR false // If you set this to true you must also set 'ed_useAtomNativeViewport' to false (see /Code/Sandbox/Editor/ViewManager.cpp)
|
||||
#define LOAD_LEGACY_RENDERER_FOR_LAUNCHER false
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -232,7 +232,6 @@ int EditorViewportWidget::OnCreate()
|
||||
{
|
||||
m_renderer = GetIEditor()->GetRenderer();
|
||||
m_engine = GetIEditor()->Get3DEngine();
|
||||
assert(m_engine);
|
||||
|
||||
CreateRenderContext();
|
||||
|
||||
@@ -793,8 +792,14 @@ void EditorViewportWidget::OnRender()
|
||||
// This is necessary so that automated editor tests using the null renderer to test systems like dynamic vegetation
|
||||
// are still able to manipulate the current logical camera position, even if nothing is rendered.
|
||||
GetIEditor()->GetSystem()->SetViewCamera(m_Camera);
|
||||
GetIEditor()->GetRenderer()->SetCamera(gEnv->pSystem->GetViewCamera());
|
||||
m_engine->RenderWorld(0, SRenderingPassInfo::CreateGeneralPassRenderingInfo(m_Camera), __FUNCTION__);
|
||||
if (GetIEditor()->GetRenderer())
|
||||
{
|
||||
GetIEditor()->GetRenderer()->SetCamera(gEnv->pSystem->GetViewCamera());
|
||||
}
|
||||
if (m_engine)
|
||||
{
|
||||
m_engine->RenderWorld(0, SRenderingPassInfo::CreateGeneralPassRenderingInfo(m_Camera), __FUNCTION__);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -886,7 +891,7 @@ void EditorViewportWidget::OnBeginPrepareRender()
|
||||
fov = 2 * atanf((h * tan(fov / 2)) / maxTargetHeight);
|
||||
}
|
||||
}
|
||||
m_Camera.SetFrustum(w, h, fov, fNearZ, gEnv->p3DEngine->GetMaxViewDistance());
|
||||
m_Camera.SetFrustum(w, h, fov, fNearZ);
|
||||
}
|
||||
|
||||
GetIEditor()->GetSystem()->SetViewCamera(m_Camera);
|
||||
@@ -2606,8 +2611,7 @@ bool EditorViewportWidget::GetActiveCameraPosition(AZ::Vector3& cameraPos)
|
||||
{
|
||||
if (GetIEditor()->IsInGameMode())
|
||||
{
|
||||
const Vec3 camPos = m_engine->GetRenderingCamera().GetPosition();
|
||||
cameraPos = LYVec3ToAZVec3(camPos);
|
||||
cameraPos = m_renderViewport->GetViewportContext()->GetCameraTransform().GetTranslation();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -525,6 +525,11 @@ void CMaterialManager::OnEditorNotifyEvent(EEditorNotifyEvent event)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMaterialManager::ReloadDirtyMaterials()
|
||||
{
|
||||
if (!GetIEditor()->Get3DEngine())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IMaterialManager* runtimeMaterialManager = GetIEditor()->Get3DEngine()->GetMaterialManager();
|
||||
|
||||
uint32 mtlCount = 0;
|
||||
@@ -743,12 +748,15 @@ int CMaterialManager::GetHighlightFlags(CMaterial* pMaterial) const
|
||||
result |= eHighlight_NoSurfaceType;
|
||||
}
|
||||
|
||||
if (ISurfaceTypeManager* pSurfaceManager = GetIEditor()->Get3DEngine()->GetMaterialManager()->GetSurfaceTypeManager())
|
||||
if (GetIEditor()->Get3DEngine())
|
||||
{
|
||||
const ISurfaceType* pSurfaceType = pSurfaceManager->GetSurfaceTypeByName(surfaceTypeName.toUtf8().data());
|
||||
if (pSurfaceType && pSurfaceType->GetBreakability() != 0)
|
||||
if (ISurfaceTypeManager* pSurfaceManager = GetIEditor()->Get3DEngine()->GetMaterialManager()->GetSurfaceTypeManager())
|
||||
{
|
||||
result |= eHighlight_Breakable;
|
||||
const ISurfaceType* pSurfaceType = pSurfaceManager->GetSurfaceTypeByName(surfaceTypeName.toUtf8().data());
|
||||
if (pSurfaceType && pSurfaceType->GetBreakability() != 0)
|
||||
{
|
||||
result |= eHighlight_Breakable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user