Remove (almost) all references to pRenderer (#651)
Remove all references to pRenderer, except from the DebugDraw and LyShine Gems that are still being updated.
This commit is contained in:
@@ -1,71 +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.
|
||||
*
|
||||
*/
|
||||
#include "ComponentEntityEditorPlugin_precompiled.h"
|
||||
#include "ComponentEntityDebugPrinter.h"
|
||||
|
||||
#include <AzFramework/Entity/GameEntityContextBus.h>
|
||||
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
|
||||
|
||||
ComponentEntityDebugPrinter::ComponentEntityDebugPrinter()
|
||||
{
|
||||
AZ::TickBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
void ComponentEntityDebugPrinter::OnTick(float /*deltaTime*/, AZ::ScriptTimePoint /*time*/)
|
||||
{
|
||||
if (!GetIEditor()->GetRenderer())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ICVar* displayInfo = GetIEditor()->GetSystem()->GetIConsole()->GetCVar("r_DisplayInfo");
|
||||
if (!displayInfo || displayInfo->GetIVal() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float x = 2.f;
|
||||
float y = 2.f;
|
||||
|
||||
SDrawTextInfo textInfo;
|
||||
textInfo.xscale = 1.25f;
|
||||
textInfo.yscale = textInfo.xscale;
|
||||
textInfo.flags = eDrawText_2D | eDrawText_FixedSize | eDrawText_800x600 | eDrawText_Monospace;
|
||||
|
||||
// Figure out whether we're querying the Game or Editor entity context
|
||||
AzFramework::EntityContextId entityContextId = AzFramework::EntityContextId::CreateNull();
|
||||
if (GetIEditor()->IsInGameMode())
|
||||
{
|
||||
AzFramework::GameEntityContextRequestBus::BroadcastResult(entityContextId, &AzFramework::GameEntityContextRequestBus::Events::GetGameEntityContextId);
|
||||
}
|
||||
else
|
||||
{
|
||||
AzToolsFramework::EditorEntityContextRequestBus::BroadcastResult(entityContextId, &AzToolsFramework::EditorEntityContextRequestBus::Events::GetEditorEntityContextId);
|
||||
}
|
||||
if (entityContextId.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Print the number of entities in the level
|
||||
AZ::SliceComponent* rootSlice = nullptr;
|
||||
AzFramework::SliceEntityOwnershipServiceRequestBus::EventResult(rootSlice, entityContextId,
|
||||
&AzFramework::SliceEntityOwnershipServiceRequestBus::Events::GetRootSlice);
|
||||
if (rootSlice)
|
||||
{
|
||||
size_t numEntities = rootSlice->GetInstantiatedEntityCount();
|
||||
if (numEntities > 0)
|
||||
{
|
||||
GetIEditor()->GetRenderer()->DrawTextQueued(Vec3(x, y, 0), textInfo, AZStd::string::format("Entities: %zu", numEntities).c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +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/Component/TickBus.h>
|
||||
|
||||
/**
|
||||
* Prints debug statistics about Component Entities to screen
|
||||
*/
|
||||
class ComponentEntityDebugPrinter
|
||||
: private AZ::TickBus::Handler
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(ComponentEntityDebugPrinter, AZ::SystemAllocator, 0);
|
||||
|
||||
ComponentEntityDebugPrinter();
|
||||
|
||||
private:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// TickBus
|
||||
void OnTick(float deltaTime, AZ::ScriptTimePoint time) override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
};
|
||||
@@ -915,14 +915,6 @@ void CComponentEntityObject::Display(DisplayContext& dc)
|
||||
m_entityId, &AzFramework::EntityDebugDisplayEvents::DisplayEntityViewport,
|
||||
AzFramework::ViewportInfo{ dc.GetView()->asCViewport()->GetViewportId() },
|
||||
*debugDisplay);
|
||||
|
||||
if (showIcons)
|
||||
{
|
||||
if (!displaySelectionHelper && !IsSelected())
|
||||
{
|
||||
m_entityIconVisible = DisplayEntityIcon(dc, *debugDisplay);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -984,38 +976,6 @@ void CComponentEntityObject::OnContextMenu(QMenu* /*pMenu*/)
|
||||
// Deliberately bypass the base class implementation (CEntityObject::OnContextMenu()).
|
||||
}
|
||||
|
||||
bool CComponentEntityObject::DisplayEntityIcon(
|
||||
DisplayContext& displayContext, AzFramework::DebugDisplayRequests& debugDisplay)
|
||||
{
|
||||
if (!m_hasIcon)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const QPoint entityScreenPos = displayContext.GetView()->WorldToView(GetWorldPos());
|
||||
|
||||
const Vec3 worldPos = GetWorldPos();
|
||||
const CCamera& camera = gEnv->pRenderer->GetCamera();
|
||||
const Vec3 cameraToEntity = (worldPos - camera.GetMatrix().GetTranslation());
|
||||
const float distSq = cameraToEntity.GetLengthSquared();
|
||||
if (distSq > square(s_kIconMaxWorldDist))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Draw component icons on top of meshes (no depth testing)
|
||||
int iconFlags = (int) DisplayContext::ETextureIconFlags::TEXICON_ON_TOP;
|
||||
SetDrawTextureIconProperties(displayContext, worldPos, 1.0f, iconFlags);
|
||||
|
||||
const float iconScale = s_kIconMinScale + (s_kIconMaxScale - s_kIconMinScale) * (1.0f - clamp_tpl(max(0.0f, sqrt_tpl(distSq) - s_kIconCloseDist) / s_kIconFarDist, 0.0f, 1.0f));
|
||||
const float worldDistToScreenScaleFraction = 0.045f;
|
||||
const float screenScale = displayContext.GetView()->GetScreenScaleFactor(GetWorldPos()) * worldDistToScreenScaleFraction;
|
||||
|
||||
debugDisplay.DrawTextureLabel(m_iconTexture, LYVec3ToAZVec3(worldPos), s_kIconSize * iconScale, s_kIconSize * iconScale, GetTextureIconFlags());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CComponentEntityObject::SetupEntityIcon()
|
||||
{
|
||||
bool hideIconInViewport = false;
|
||||
@@ -1031,8 +991,9 @@ void CComponentEntityObject::SetupEntityIcon()
|
||||
{
|
||||
m_hasIcon = true;
|
||||
|
||||
int textureId = GetIEditor()->GetIconManager()->GetIconTexture(m_icon.c_str());
|
||||
m_iconTexture = GetIEditor()->GetRenderer() ? GetIEditor()->GetRenderer()->EF_GetTextureByID(textureId) : nullptr;
|
||||
// ToDo: Get from Atom?
|
||||
// int textureId = GetIEditor()->GetIconManager()->GetIconTexture(m_icon.c_str());
|
||||
m_iconTexture = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,6 @@
|
||||
#include <MathConversion.h>
|
||||
|
||||
#include "Objects/ComponentEntityObject.h"
|
||||
#include "ComponentEntityDebugPrinter.h"
|
||||
#include "ISourceControl.h"
|
||||
#include "UI/QComponentEntityEditorMainWindow.h"
|
||||
|
||||
@@ -72,7 +71,6 @@
|
||||
#include <Editor/CryEditDoc.h>
|
||||
#include <Editor/GameEngine.h>
|
||||
#include <Editor/DisplaySettings.h>
|
||||
#include <Editor/Util/CubemapUtils.h>
|
||||
#include <Editor/IconManager.h>
|
||||
#include <Editor/Settings.h>
|
||||
#include <Editor/StringDlg.h>
|
||||
@@ -141,7 +139,6 @@ SandboxIntegrationManager::SandboxIntegrationManager()
|
||||
, m_startedUndoRecordingNestingLevel(0)
|
||||
, m_dc(nullptr)
|
||||
, m_notificationWindowManager(new AzToolsFramework::SliceOverridesNotificationWindowManager())
|
||||
, m_entityDebugPrinter(aznew ComponentEntityDebugPrinter())
|
||||
{
|
||||
// Required to receive events from the Cry Engine undo system
|
||||
GetIEditor()->GetUndoManager()->AddListener(this);
|
||||
@@ -1998,92 +1995,6 @@ void SandboxIntegrationManager::BrowseForAssets(AssetSelectionModel& selection)
|
||||
AssetBrowserComponentRequestBus::Broadcast(&AssetBrowserComponentRequests::PickAssets, selection, GetMainWindow());
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::GenerateCubemapForEntity(AZ::EntityId entityId, AZStd::string* cubemapOutputPath, bool hideEntity)
|
||||
{
|
||||
GenerateCubemapWithIDForEntity(entityId, AZ::Uuid::CreateNull(), cubemapOutputPath, hideEntity, false);
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::GenerateCubemapWithIDForEntity(AZ::EntityId entityId, AZ::Uuid cubemapId,
|
||||
AZStd::string* cubemapOutputPath, bool hideEntity, bool hasCubemapId)
|
||||
{
|
||||
AZ::u32 resolution = 0;
|
||||
EBUS_EVENT_ID_RESULT(resolution, entityId, LmbrCentral::EditorLightComponentRequestBus, GetCubemapResolution);
|
||||
|
||||
if (resolution > 0)
|
||||
{
|
||||
CComponentEntityObject* componentEntity = CComponentEntityObject::FindObjectForEntity(entityId);
|
||||
|
||||
if (componentEntity)
|
||||
{
|
||||
QString levelfolder = GetIEditor()->GetGameEngine()->GetLevelPath();
|
||||
QString levelname = Path::GetFile(levelfolder).toLower();
|
||||
QString fullGameFolder = QString(Path::GetEditingGameDataFolder().c_str());
|
||||
QString texturename;
|
||||
if (hasCubemapId)
|
||||
{
|
||||
texturename = QStringLiteral("%1_cm.tif").arg(cubemapId.ToString<QString>(false, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
texturename = QStringLiteral("%1_cm.tif").arg(static_cast<qulonglong>(componentEntity->GetAssociatedEntityId()));
|
||||
}
|
||||
texturename = texturename.toLower();
|
||||
|
||||
QString fullFolder = Path::SubDirectoryCaseInsensitive(fullGameFolder, {"textures", "cubemaps", levelname});
|
||||
QString fullFilename = QDir(fullFolder).absoluteFilePath(texturename);
|
||||
QString relFilename = QDir(fullGameFolder).relativeFilePath(fullFilename);
|
||||
|
||||
bool directlyExists = CFileUtil::CreateDirectory(fullFolder.toUtf8().data());
|
||||
if (!directlyExists)
|
||||
{
|
||||
QMessageBox::warning(GetMainWindow(), QObject::tr("Cubemap Generation Failed"), QString(QObject::tr("Failed to create destination path '%1'")).arg(fullFolder));
|
||||
return;
|
||||
}
|
||||
|
||||
if (CubemapUtils::GenCubemapWithObjectPathAndSize(fullFilename, componentEntity, static_cast<int>(resolution), hideEntity))
|
||||
{
|
||||
AZStd::string assetPath = relFilename.toUtf8().data();
|
||||
AzFramework::StringFunc::Path::ReplaceExtension(assetPath, ".dds");
|
||||
|
||||
EBUS_EVENT_ID(entityId, LmbrCentral::EditorLightComponentRequestBus, SetCubemap, assetPath);
|
||||
|
||||
if (cubemapOutputPath)
|
||||
{
|
||||
*cubemapOutputPath = AZStd::move(assetPath);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::warning(GetMainWindow(), QObject::tr("Cubemap Generation Failed"), QObject::tr("Unspecified error"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::GenerateAllCubemaps()
|
||||
{
|
||||
AZStd::string cubemapOutputPath;
|
||||
|
||||
std::vector<CBaseObject*> results;
|
||||
results.reserve(128);
|
||||
GetIEditor()->GetObjectManager()->FindObjectsOfType(OBJTYPE_AZENTITY, results);
|
||||
for (std::vector<CBaseObject*>::iterator end = results.end(), item = results.begin(); item != end; ++item)
|
||||
{
|
||||
CComponentEntityObject* componentEntity = static_cast<CComponentEntityObject*>(*item);
|
||||
|
||||
//check if it's customized cubemap, only generate it if it's not.
|
||||
bool isCustomizedCubemap = true;
|
||||
EBUS_EVENT_ID_RESULT(isCustomizedCubemap, componentEntity->GetAssociatedEntityId(), LmbrCentral::EditorLightComponentRequestBus, UseCustomizedCubemap);
|
||||
|
||||
if (isCustomizedCubemap)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
GenerateCubemapForEntity(componentEntity->GetAssociatedEntityId(), nullptr, true);
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::SetColor(float r, float g, float b, float a)
|
||||
{
|
||||
if (m_dc)
|
||||
@@ -2575,19 +2486,6 @@ void SandboxIntegrationManager::Draw2dTextLabel(float x, float y, float size, co
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawTextOn2DBox(const AZ::Vector3& pos, const char* text, float textScale, const AZ::Vector4& textColor, const AZ::Vector4& textBackColor)
|
||||
{
|
||||
if (m_dc)
|
||||
{
|
||||
m_dc->DrawTextOn2DBox(
|
||||
AZVec3ToLYVec3(pos),
|
||||
text,
|
||||
textScale,
|
||||
ColorF(AZVec3ToLYVec3(textColor.GetAsVector3()), textColor.GetW()),
|
||||
ColorF(AZVec3ToLYVec3(textBackColor.GetAsVector3()), textBackColor.GetW()));
|
||||
}
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::DrawTextureLabel(ITexture* texture, const AZ::Vector3& pos, float sizeX, float sizeY, int texIconFlags)
|
||||
{
|
||||
if (m_dc)
|
||||
@@ -2614,8 +2512,12 @@ void SandboxIntegrationManager::DrawTextureLabel(ITexture* texture, const AZ::Ve
|
||||
|
||||
void SandboxIntegrationManager::DrawTextureLabel(int textureId, const AZ::Vector3& pos, float sizeX, float sizeY, int texIconFlags)
|
||||
{
|
||||
ITexture* texture = GetIEditor()->GetRenderer()->EF_GetTextureByID(textureId);
|
||||
DrawTextureLabel(texture, pos, sizeX, sizeY, texIconFlags);
|
||||
// ToDo: With Atom?
|
||||
AZ_UNUSED(textureId);
|
||||
AZ_UNUSED(pos);
|
||||
AZ_UNUSED(sizeX);
|
||||
AZ_UNUSED(sizeY);
|
||||
AZ_UNUSED(texIconFlags);
|
||||
}
|
||||
|
||||
void SandboxIntegrationManager::SetLineWidth(float width)
|
||||
|
||||
@@ -143,9 +143,6 @@ private:
|
||||
QDockWidget* InstanceViewPane(const char* paneName) override;
|
||||
void CloseViewPane(const char* paneName) override;
|
||||
void BrowseForAssets(AzToolsFramework::AssetBrowser::AssetSelectionModel& selection) override;
|
||||
void GenerateAllCubemaps() override;
|
||||
void GenerateCubemapForEntity(AZ::EntityId entityId, AZStd::string* cubemapOutputPath, bool hideEntity) override;
|
||||
void GenerateCubemapWithIDForEntity(AZ::EntityId entityId, AZ::Uuid cubemapId, AZStd::string* cubemapOutputPath, bool hideEntity, bool hasCubemapId) override;
|
||||
void HandleObjectModeSelection(const AZ::Vector2& point, int flags, bool& handled) override;
|
||||
void UpdateObjectModeCursor(AZ::u32& cursorId, AZStd::string& cursorStr) override;
|
||||
void CreateEditorRepresentation(AZ::Entity* entity) override;
|
||||
@@ -249,7 +246,6 @@ private:
|
||||
void DrawArrow(const AZ::Vector3& src, const AZ::Vector3& trg, float fHeadScale, bool b2SidedArrow) override;
|
||||
void DrawTextLabel(const AZ::Vector3& pos, float size, const char* text, const bool bCenter, int srcOffsetX, int scrOffsetY) override;
|
||||
void Draw2dTextLabel(float x, float y, float size, const char* text, bool bCenter) override;
|
||||
void DrawTextOn2DBox(const AZ::Vector3& pos, const char* text, float textScale, const AZ::Vector4& TextColor, const AZ::Vector4& TextBackColor) override;
|
||||
void DrawTextureLabel(ITexture* texture, const AZ::Vector3& pos, float sizeX, float sizeY, int texIconFlags) override;
|
||||
void DrawTextureLabel(int textureId, const AZ::Vector3& pos, float sizeX, float sizeY, int texIconFlags) override;
|
||||
void SetLineWidth(float width) override;
|
||||
@@ -365,8 +361,6 @@ private:
|
||||
|
||||
DisplayContext* m_dc;
|
||||
|
||||
AZStd::unique_ptr<class ComponentEntityDebugPrinter> m_entityDebugPrinter;
|
||||
|
||||
AZStd::vector<SliceAssetDeletionErrorInfo> m_sliceAssetDeletionErrorRestoreInfos;
|
||||
|
||||
// Tracks new entities that have not yet been saved.
|
||||
|
||||
-2
@@ -17,8 +17,6 @@ set(FILES
|
||||
SandboxIntegration.cpp
|
||||
ComponentEntityEditorPlugin_precompiled.cpp
|
||||
ComponentEntityEditorPlugin_precompiled.h
|
||||
ComponentEntityDebugPrinter.h
|
||||
ComponentEntityDebugPrinter.cpp
|
||||
UI/ComponentEntityEditorOutlinerWindow.qrc
|
||||
UI/QComponentEntityEditorMainWindow.h
|
||||
UI/QComponentEntityEditorMainWindow.cpp
|
||||
|
||||
Reference in New Issue
Block a user