Merge branch 'main' into LY-113714
This commit is contained in:
@@ -650,114 +650,6 @@ void Q2DViewport::OnDestroy()
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void Q2DViewport::Render()
|
||||
{
|
||||
if (GetIEditor()->IsInGameMode())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_renderer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isVisible())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GetIEditor()->GetDocument()->IsDocumentReady())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_renderer->IsStereoEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
|
||||
|
||||
QRect rc = rect();
|
||||
if (rc.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CalculateViewTM();
|
||||
|
||||
// Render
|
||||
WIN_HWND priorContext = m_renderer->GetCurrentContextHWND();
|
||||
|
||||
m_renderer->SetCurrentContext(renderOverlayHWND());
|
||||
m_renderer->BeginFrame();
|
||||
m_renderer->ChangeViewport(0, 0, rc.right(), rc.bottom(), true);
|
||||
|
||||
CScopedWireFrameMode scopedWireFrame(m_renderer, R_SOLID_MODE);
|
||||
auto colorf = Rgb2ColorF(m_colorBackground);
|
||||
m_renderer->ClearTargetsLater(FRT_CLEAR, colorf);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// 2D Mode.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
if (rc.right() != 0 && rc.bottom() != 0)
|
||||
{
|
||||
TransformationMatrices backupSceneMatrices;
|
||||
|
||||
m_renderer->Set2DMode(rc.right(), rc.bottom(), backupSceneMatrices);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Draw viewport elements here.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Calc world bounding box for objects rendering.
|
||||
m_displayBounds = GetWorldBounds(QPoint(0, 0), QPoint(rc.width(), rc.height()));
|
||||
|
||||
// Draw all objects.
|
||||
DisplayContext& dc = m_displayContext;
|
||||
dc.settings = GetIEditor()->GetDisplaySettings();
|
||||
dc.view = this;
|
||||
dc.renderer = m_renderer;
|
||||
dc.engine = GetIEditor()->Get3DEngine();
|
||||
dc.flags = DISPLAY_2D;
|
||||
dc.box = m_displayBounds;
|
||||
dc.camera = &GetIEditor()->GetSystem()->GetViewCamera();
|
||||
|
||||
if (!dc.settings->IsDisplayLabels() || !dc.settings->IsDisplayHelpers())
|
||||
{
|
||||
dc.flags |= DISPLAY_HIDENAMES;
|
||||
}
|
||||
if (dc.settings->IsDisplayLinks() && dc.settings->IsDisplayHelpers())
|
||||
{
|
||||
dc.flags |= DISPLAY_LINKS;
|
||||
}
|
||||
if (m_bDegradateQuality)
|
||||
{
|
||||
dc.flags |= DISPLAY_DEGRADATED;
|
||||
}
|
||||
|
||||
SRenderingPassInfo passInfo = SRenderingPassInfo::CreateGeneralPassRenderingInfo(GetIEditor()->GetSystem()->GetViewCamera());
|
||||
|
||||
m_renderer->BeginSpawningGeneratingRendItemJobs(passInfo.ThreadID());
|
||||
m_renderer->BeginSpawningShadowGeneratingRendItemJobs(passInfo.ThreadID());
|
||||
m_renderer->EF_StartEf(passInfo);
|
||||
|
||||
dc.SetState(e_Mode3D | e_AlphaBlended | e_FillModeSolid | e_CullModeBack | e_DepthWriteOff | e_DepthTestOn);
|
||||
Draw(dc);
|
||||
|
||||
m_renderer->EF_EndEf3D(SHDF_STREAM_SYNC, -1, -1, passInfo);
|
||||
|
||||
m_renderer->EF_RenderTextMessages();
|
||||
|
||||
// Return back from 2D mode.
|
||||
m_renderer->Unset2DMode(backupSceneMatrices);
|
||||
|
||||
m_renderer->RenderDebug(false);
|
||||
|
||||
ProcessRenderLisneters(m_displayContext);
|
||||
|
||||
m_renderer->EndFrame();
|
||||
}
|
||||
|
||||
GetIEditor()->GetRenderer()->SetCurrentContext(priorContext);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -50,8 +50,6 @@
|
||||
#include "Include/IObjectManager.h"
|
||||
#include "CryEditDoc.h"
|
||||
#include "QtViewPaneManager.h"
|
||||
#include "AzAssetBrowser/Preview/LegacyPreviewerFactory.h"
|
||||
|
||||
|
||||
namespace AzAssetBrowserRequestHandlerPrivate
|
||||
{
|
||||
@@ -230,18 +228,15 @@ namespace AzAssetBrowserRequestHandlerPrivate
|
||||
}
|
||||
|
||||
AzAssetBrowserRequestHandler::AzAssetBrowserRequestHandler()
|
||||
: m_previewerFactory(aznew LegacyPreviewerFactory)
|
||||
{
|
||||
using namespace AzToolsFramework::AssetBrowser;
|
||||
|
||||
AssetBrowserInteractionNotificationBus::Handler::BusConnect();
|
||||
AzQtComponents::DragAndDropEventsBus::Handler::BusConnect(AzQtComponents::DragAndDropContexts::EditorViewport);
|
||||
AzToolsFramework::AssetBrowser::PreviewerRequestBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
AzAssetBrowserRequestHandler::~AzAssetBrowserRequestHandler()
|
||||
{
|
||||
AzToolsFramework::AssetBrowser::PreviewerRequestBus::Handler::BusDisconnect();
|
||||
AzToolsFramework::AssetBrowser::AssetBrowserInteractionNotificationBus::Handler::BusDisconnect();
|
||||
AzQtComponents::DragAndDropEventsBus::Handler::BusDisconnect();
|
||||
}
|
||||
@@ -527,15 +522,6 @@ void AzAssetBrowserRequestHandler::Drop(QDropEvent* event, AzQtComponents::DragA
|
||||
}
|
||||
}
|
||||
|
||||
const AzToolsFramework::AssetBrowser::PreviewerFactory* AzAssetBrowserRequestHandler::GetPreviewerFactory(const AzToolsFramework::AssetBrowser::AssetBrowserEntry* entry) const
|
||||
{
|
||||
if (m_previewerFactory->IsEntrySupported(entry))
|
||||
{
|
||||
return m_previewerFactory.get();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void AzAssetBrowserRequestHandler::AddSourceFileOpeners(const char* fullSourceFileName, const AZ::Uuid& sourceUUID, AzToolsFramework::AssetBrowser::SourceFileOpenerList& openers)
|
||||
{
|
||||
using namespace AzToolsFramework;
|
||||
|
||||
@@ -37,12 +37,9 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
|
||||
class LegacyPreviewerFactory;
|
||||
|
||||
class AzAssetBrowserRequestHandler
|
||||
: protected AzToolsFramework::AssetBrowser::AssetBrowserInteractionNotificationBus::Handler
|
||||
, protected AzQtComponents::DragAndDropEventsBus::Handler
|
||||
, protected AzToolsFramework::AssetBrowser::PreviewerRequestBus::Handler
|
||||
{
|
||||
public:
|
||||
AzAssetBrowserRequestHandler();
|
||||
@@ -66,16 +63,8 @@ protected:
|
||||
void DragLeave(QDragLeaveEvent* event) override;
|
||||
void Drop(QDropEvent* event, AzQtComponents::DragAndDropContextBase& context) override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// PreviewerRequestBus::Handler
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
const AzToolsFramework::AssetBrowser::PreviewerFactory* GetPreviewerFactory(const AzToolsFramework::AssetBrowser::AssetBrowserEntry* entry) const override;
|
||||
|
||||
bool CanAcceptDragAndDropEvent(
|
||||
QDropEvent* event, AzQtComponents::DragAndDropContextBase& context,
|
||||
AZStd::optional<AZStd::vector<const AzToolsFramework::AssetBrowser::SourceAssetBrowserEntry*>*> outSources = AZStd::nullopt,
|
||||
AZStd::optional<AZStd::vector<const AzToolsFramework::AssetBrowser::ProductAssetBrowserEntry*>*> outProducts = AZStd::nullopt) const;
|
||||
|
||||
private:
|
||||
AZStd::unique_ptr<const LegacyPreviewerFactory> m_previewerFactory;
|
||||
};
|
||||
|
||||
@@ -1,409 +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 "EditorDefs.h"
|
||||
|
||||
#include "LegacyPreviewer.h"
|
||||
|
||||
// AzToolsFramework
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserBus.h>
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserEntry.h>
|
||||
#include <AzToolsFramework/AssetBrowser/EBusFindAssetTypeByName.h>
|
||||
|
||||
// Editor
|
||||
#include "Util/Image.h"
|
||||
#include "Util/ImageUtil.h"
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
#include <AzAssetBrowser/Preview/ui_LegacyPreviewer.h>
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
|
||||
static const int s_CharWidth = 6;
|
||||
const QString LegacyPreviewer::Name{ QStringLiteral("LegacyPreviewer") };
|
||||
|
||||
LegacyPreviewer::LegacyPreviewer(QWidget* parent)
|
||||
: Previewer(parent)
|
||||
, m_ui(new Ui::LegacyPreviewerClass())
|
||||
, m_textureType(TextureType::RGB)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->m_comboBoxRGB->addItems(QStringList() << "RGB" << "RGBA" << "Alpha");
|
||||
m_ui->m_previewCtrl->SetAspectRatio(4.0f / 3.0f);
|
||||
connect(m_ui->m_comboBoxRGB, static_cast<void(QComboBox::*)(int)>(&QComboBox::activated), this,
|
||||
[=](int index)
|
||||
{
|
||||
m_textureType = static_cast<TextureType>(index);
|
||||
UpdateTextureType();
|
||||
});
|
||||
Clear();
|
||||
}
|
||||
|
||||
LegacyPreviewer::~LegacyPreviewer()
|
||||
{
|
||||
}
|
||||
|
||||
void LegacyPreviewer::Clear() const
|
||||
{
|
||||
m_ui->m_previewCtrl->ReleaseObject();
|
||||
m_ui->m_modelPreviewWidget->hide();
|
||||
m_ui->m_texturePreviewWidget->hide();
|
||||
m_ui->m_fileInfoCtrl->hide();
|
||||
}
|
||||
|
||||
void LegacyPreviewer::Display(const AzToolsFramework::AssetBrowser::AssetBrowserEntry* entry)
|
||||
{
|
||||
using namespace AzToolsFramework::AssetBrowser;
|
||||
|
||||
if (!entry)
|
||||
{
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
switch (entry->GetEntryType())
|
||||
{
|
||||
case AssetBrowserEntry::AssetEntryType::Source:
|
||||
{
|
||||
const SourceAssetBrowserEntry* sourceEntry = azrtti_cast<const SourceAssetBrowserEntry*>(entry);
|
||||
DisplaySource(sourceEntry);
|
||||
break;
|
||||
}
|
||||
case AssetBrowserEntry::AssetEntryType::Product:
|
||||
DisplayProduct(static_cast<const ProductAssetBrowserEntry*>(entry));
|
||||
break;
|
||||
default:
|
||||
Clear();
|
||||
}
|
||||
}
|
||||
|
||||
const QString& LegacyPreviewer::GetName() const
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
void LegacyPreviewer::resizeEvent(QResizeEvent* /*event*/)
|
||||
{
|
||||
m_ui->m_fileInfoCtrl->setText(WordWrap(m_fileinfo, m_ui->m_fileInfoCtrl->width() / s_CharWidth));
|
||||
}
|
||||
|
||||
bool LegacyPreviewer::DisplayProduct(const AzToolsFramework::AssetBrowser::ProductAssetBrowserEntry* product)
|
||||
{
|
||||
m_ui->m_fileInfoCtrl->show();
|
||||
|
||||
m_fileinfo = QString::fromUtf8(product->GetName().c_str());
|
||||
|
||||
m_fileinfo += GetFileSize(product->GetRelativePath().c_str());
|
||||
|
||||
EBusFindAssetTypeByName meshAssetTypeResult("Static Mesh");
|
||||
AZ::AssetTypeInfoBus::BroadcastResult(meshAssetTypeResult, &AZ::AssetTypeInfo::GetAssetType);
|
||||
|
||||
QString filename(product->GetRelativePath().c_str());
|
||||
|
||||
// Find item.
|
||||
if (product->GetAssetType() == meshAssetTypeResult.GetAssetType())
|
||||
{
|
||||
m_ui->m_modelPreviewWidget->show();
|
||||
m_ui->m_texturePreviewWidget->hide();
|
||||
m_ui->m_previewCtrl->LoadFile(filename);
|
||||
|
||||
int nVertexCount = m_ui->m_previewCtrl->GetVertexCount();
|
||||
int nFaceCount = m_ui->m_previewCtrl->GetFaceCount();
|
||||
int nMaxLod = m_ui->m_previewCtrl->GetMaxLod();
|
||||
int nMtls = m_ui->m_previewCtrl->GetMtlCount();
|
||||
if (nFaceCount > 0)
|
||||
{
|
||||
m_fileinfo += tr("\r\n%1 Faces\r\n%2 Verts\r\n%3 MaxLod\r\n%4 Materials").arg(nFaceCount).arg(nVertexCount).arg(nMaxLod).arg(nMtls);
|
||||
}
|
||||
m_ui->m_fileInfoCtrl->setText(WordWrap(m_fileinfo, m_ui->m_fileInfoCtrl->width() / s_CharWidth));
|
||||
updateGeometry();
|
||||
return true;
|
||||
}
|
||||
|
||||
EBusFindAssetTypeByName textureAssetTypeResult("Texture");
|
||||
AZ::AssetTypeInfoBus::BroadcastResult(textureAssetTypeResult, &AZ::AssetTypeInfo::GetAssetType);
|
||||
|
||||
if (product->GetAssetType() == textureAssetTypeResult.GetAssetType())
|
||||
{
|
||||
// Get full product file path
|
||||
const char* assetCachePath = AZ::IO::FileIOBase::GetInstance()->GetAlias("@assets@");
|
||||
AZStd::string productFullPath;
|
||||
AzFramework::StringFunc::Path::Join(assetCachePath, product->GetRelativePath().c_str(), productFullPath);
|
||||
if (AZ::IO::FileIOBase::GetInstance()->Exists(productFullPath.c_str()))
|
||||
{
|
||||
// Try to display it in modern dds image loader, if no one exists, use the legacy image loader
|
||||
bool foundPixmap = DisplayTextureProductModern(productFullPath.c_str());
|
||||
return foundPixmap ? foundPixmap : DisplayTextureLegacy(productFullPath.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we cannot find the product file, means it's not treated as an asset, display its source
|
||||
return DisplayTextureLegacy(product->GetFullPath().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
Clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
void LegacyPreviewer::DisplaySource(const AzToolsFramework::AssetBrowser::SourceAssetBrowserEntry* source)
|
||||
{
|
||||
using namespace AzToolsFramework::AssetBrowser;
|
||||
|
||||
EBusFindAssetTypeByName textureAssetType("Texture");
|
||||
AZ::AssetTypeInfoBus::BroadcastResult(textureAssetType, &AZ::AssetTypeInfo::GetAssetType);
|
||||
|
||||
if (source->GetPrimaryAssetType() == textureAssetType.GetAssetType())
|
||||
{
|
||||
m_ui->m_fileInfoCtrl->show();
|
||||
m_fileinfo = QString::fromUtf8(source->GetName().c_str());
|
||||
m_fileinfo += GetFileSize(source->GetFullPath().c_str());
|
||||
const char* fullSourcePath = source->GetFullPath().c_str();
|
||||
// If it's a source dds file, try to display it using modern way
|
||||
if (AzFramework::StringFunc::Path::IsExtension(fullSourcePath, "dds", false))
|
||||
{
|
||||
if (DisplayTextureProductModern(fullSourcePath))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
DisplayTextureLegacy(source->GetFullPath().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
AZStd::vector<const ProductAssetBrowserEntry*> products;
|
||||
source->GetChildrenRecursively<ProductAssetBrowserEntry>(products);
|
||||
if (products.empty())
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto* product : products)
|
||||
{
|
||||
if (DisplayProduct(product))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString LegacyPreviewer::GetFileSize(const char* path)
|
||||
{
|
||||
QString fileSizeStr;
|
||||
AZ::u64 fileSizeResult = 0;
|
||||
if (AZ::IO::FileIOBase::GetInstance()->Size(path, fileSizeResult))
|
||||
{
|
||||
static double kb = 1024.0f;
|
||||
static double mb = kb * 1024.0;
|
||||
static double gb = mb * 1024.0;
|
||||
|
||||
static QString byteStr = "B";
|
||||
static QString kbStr = "KB";
|
||||
static QString mbStr = "MB";
|
||||
static QString gbStr = "GB";
|
||||
|
||||
#if AZ_TRAIT_OS_PLATFORM_APPLE
|
||||
kb = 1000.0;
|
||||
mb = kb * 1000.0;
|
||||
gb = mb * 1000.0;
|
||||
|
||||
kbStr = "kB";
|
||||
mbStr = "mB";
|
||||
gbStr = "gB";
|
||||
#endif // AZ_TRAIT_OS_PLATFORM_APPLE
|
||||
|
||||
if (fileSizeResult < kb)
|
||||
{
|
||||
fileSizeStr += tr("\r\nFile Size: %1%2").arg(QString::number(fileSizeResult), byteStr);
|
||||
}
|
||||
else if (fileSizeResult < mb)
|
||||
{
|
||||
double size = fileSizeResult / kb;
|
||||
fileSizeStr += tr("\r\nFile Size: %1%2").arg(QString::number(size, 'f', 2), kbStr);
|
||||
}
|
||||
else if (fileSizeResult < gb)
|
||||
{
|
||||
double size = fileSizeResult / mb;
|
||||
fileSizeStr += tr("\r\nFile Size: %1%2").arg(QString::number(size, 'f', 2), mbStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
double size = fileSizeResult / gb;
|
||||
fileSizeStr += tr("\r\nFile Size: %1%2").arg(QString::number(size, 'f', 2), gbStr);
|
||||
}
|
||||
}
|
||||
return fileSizeStr;
|
||||
}
|
||||
|
||||
bool LegacyPreviewer::DisplayTextureLegacy(const char* fullImagePath)
|
||||
{
|
||||
m_ui->m_modelPreviewWidget->hide();
|
||||
m_ui->m_texturePreviewWidget->show();
|
||||
|
||||
bool foundPixmap = false;
|
||||
if (!AZ::IO::FileIOBase::GetInstance()->IsDirectory(fullImagePath))
|
||||
{
|
||||
QString strLoadFilename = QString(fullImagePath);
|
||||
if (CImageUtil::LoadImage(strLoadFilename, m_previewImageSource))
|
||||
{
|
||||
m_fileinfo += QStringLiteral("\r\n%1x%2\r\n%3")
|
||||
.arg(m_previewImageSource.GetWidth())
|
||||
.arg(m_previewImageSource.GetHeight())
|
||||
.arg(m_previewImageSource.GetFormatDescription());
|
||||
|
||||
m_fileinfoAlphaTexture = m_fileinfo;
|
||||
UpdateTextureType();
|
||||
foundPixmap = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundPixmap)
|
||||
{
|
||||
m_ui->m_previewImageCtrl->setPixmap(QPixmap());
|
||||
m_ui->m_fileInfoCtrl->setText(WordWrap(m_fileinfo, m_ui->m_fileInfoCtrl->width() / s_CharWidth));
|
||||
}
|
||||
|
||||
updateGeometry();
|
||||
|
||||
return foundPixmap;
|
||||
}
|
||||
|
||||
bool LegacyPreviewer::DisplayTextureProductModern(const char* fullProductImagePath)
|
||||
{
|
||||
m_ui->m_modelPreviewWidget->hide();
|
||||
m_ui->m_texturePreviewWidget->show();
|
||||
|
||||
bool foundPixmap = false;
|
||||
QImage previewImage;
|
||||
AZStd::string productInfo;
|
||||
AZStd::string productAlphaInfo;
|
||||
AzToolsFramework::AssetBrowser::AssetBrowserTexturePreviewRequestsBus::BroadcastResult(foundPixmap, &AzToolsFramework::AssetBrowser::AssetBrowserTexturePreviewRequests::GetProductTexturePreview, fullProductImagePath, previewImage, productInfo, productAlphaInfo);
|
||||
|
||||
if (foundPixmap)
|
||||
{
|
||||
QPixmap pix = QPixmap::fromImage(previewImage);
|
||||
m_ui->m_previewImageCtrl->setPixmap(pix);
|
||||
m_ui->m_previewImageCtrl->updateGeometry();
|
||||
CImageUtil::QImageToImage(previewImage, m_previewImageSource);
|
||||
|
||||
m_fileinfo += QStringLiteral("\r\n%1x%2\r\n%3")
|
||||
.arg(m_previewImageSource.GetWidth())
|
||||
.arg(m_previewImageSource.GetHeight())
|
||||
.arg(m_previewImageSource.GetFormatDescription());
|
||||
|
||||
m_fileinfoAlphaTexture = m_fileinfo;
|
||||
|
||||
m_fileinfo += QString(productInfo.c_str());
|
||||
if (productAlphaInfo.empty())
|
||||
{
|
||||
// If there is no separate info for alpha, use the image info
|
||||
m_fileinfoAlphaTexture += QString(productInfo.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fileinfoAlphaTexture += QString(productAlphaInfo.c_str());
|
||||
}
|
||||
|
||||
|
||||
UpdateTextureType();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->m_previewImageCtrl->setPixmap(QPixmap());
|
||||
m_ui->m_fileInfoCtrl->setText(WordWrap(m_fileinfo, m_ui->m_fileInfoCtrl->width() / s_CharWidth));
|
||||
}
|
||||
|
||||
updateGeometry();
|
||||
return foundPixmap;
|
||||
}
|
||||
|
||||
void LegacyPreviewer::UpdateTextureType()
|
||||
{
|
||||
m_previewImageUpdated.Copy(m_previewImageSource);
|
||||
|
||||
switch (m_textureType)
|
||||
{
|
||||
case TextureType::RGB:
|
||||
{
|
||||
m_previewImageUpdated.SwapRedAndBlue();
|
||||
m_previewImageUpdated.FillAlpha();
|
||||
break;
|
||||
}
|
||||
case TextureType::RGBA:
|
||||
{
|
||||
m_previewImageUpdated.SwapRedAndBlue();
|
||||
break;
|
||||
}
|
||||
case TextureType::Alpha:
|
||||
{
|
||||
for (int h = 0; h < m_previewImageUpdated.GetHeight(); h++)
|
||||
{
|
||||
for (int w = 0; w < m_previewImageUpdated.GetWidth(); w++)
|
||||
{
|
||||
int a = m_previewImageUpdated.ValueAt(w, h) >> 24;
|
||||
m_previewImageUpdated.ValueAt(w, h) = RGB(a, a, a) | 0xFF000000;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// note that Qt will not deep copy the data, so WE MUST KEEP THE IMAGE DATA AROUND!
|
||||
QPixmap qtPixmap = QPixmap::fromImage(
|
||||
QImage(reinterpret_cast<uchar*>(m_previewImageUpdated.GetData()), m_previewImageUpdated.GetWidth(), m_previewImageUpdated.GetHeight(), QImage::Format_ARGB32));
|
||||
m_ui->m_previewImageCtrl->setPixmap(qtPixmap);
|
||||
m_ui->m_fileInfoCtrl->setText(WordWrap(m_textureType == TextureType::Alpha? m_fileinfoAlphaTexture: m_fileinfo, m_ui->m_fileInfoCtrl->width() / s_CharWidth));
|
||||
m_ui->m_previewImageCtrl->updateGeometry();
|
||||
}
|
||||
|
||||
bool LegacyPreviewer::FileInfoCompare(const FileInfo& f1, const FileInfo& f2)
|
||||
{
|
||||
if ((f1.attrib & _A_SUBDIR) && !(f2.attrib & _A_SUBDIR))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (!(f1.attrib & _A_SUBDIR) && (f2.attrib & _A_SUBDIR))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return QString::compare(f1.filename, f2.filename, Qt::CaseInsensitive) < 0;
|
||||
}
|
||||
|
||||
QString LegacyPreviewer::WordWrap(const QString& string, int maxLength)
|
||||
{
|
||||
QString result;
|
||||
int length = 0;
|
||||
|
||||
for (auto c : string)
|
||||
{
|
||||
if (c == '\n')
|
||||
{
|
||||
length = 0;
|
||||
}
|
||||
else if (length > maxLength)
|
||||
{
|
||||
result.append('\n');
|
||||
length = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
length++;
|
||||
}
|
||||
result.append(c);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#include <AzAssetBrowser/Preview/moc_LegacyPreviewer.cpp>
|
||||
@@ -1,100 +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
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <Editor/Util/Image.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzToolsFramework/AssetBrowser/Previewer/Previewer.h>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QScopedPointer>
|
||||
#endif
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class LegacyPreviewerClass;
|
||||
}
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace AssetBrowser
|
||||
{
|
||||
class ProductAssetBrowserEntry;
|
||||
class SourceAssetBrowserEntry;
|
||||
class AssetBrowserEntry;
|
||||
}
|
||||
}
|
||||
|
||||
class QResizeEvent;
|
||||
|
||||
class LegacyPreviewer
|
||||
: public AzToolsFramework::AssetBrowser::Previewer
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(LegacyPreviewer, AZ::SystemAllocator, 0);
|
||||
|
||||
explicit LegacyPreviewer(QWidget* parent = nullptr);
|
||||
~LegacyPreviewer();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// AzToolsFramework::AssetBrowser::Previewer
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void Clear() const override;
|
||||
void Display(const AzToolsFramework::AssetBrowser::AssetBrowserEntry* entry) override;
|
||||
const QString& GetName() const override;
|
||||
|
||||
static const QString Name;
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent * event) override;
|
||||
|
||||
private:
|
||||
struct FileInfo
|
||||
{
|
||||
QString filename;
|
||||
unsigned attrib;
|
||||
time_t time_create; /* -1 for FAT file systems */
|
||||
time_t time_access; /* -1 for FAT file systems */
|
||||
time_t time_write;
|
||||
_fsize_t size;
|
||||
};
|
||||
|
||||
enum class TextureType
|
||||
{
|
||||
RGB,
|
||||
RGBA,
|
||||
Alpha
|
||||
};
|
||||
|
||||
QScopedPointer<Ui::LegacyPreviewerClass> m_ui;
|
||||
CImageEx m_previewImageSource;
|
||||
CImageEx m_previewImageUpdated;
|
||||
TextureType m_textureType;
|
||||
QString m_fileinfo;
|
||||
QString m_fileinfoAlphaTexture;
|
||||
|
||||
bool DisplayProduct(const AzToolsFramework::AssetBrowser::ProductAssetBrowserEntry* product);
|
||||
void DisplaySource(const AzToolsFramework::AssetBrowser::SourceAssetBrowserEntry* source);
|
||||
|
||||
QString GetFileSize(const char* path);
|
||||
|
||||
bool DisplayTextureLegacy(const char* fullImagePath);
|
||||
bool DisplayTextureProductModern(const char* fullProductImagePath);
|
||||
|
||||
void UpdateTextureType();
|
||||
|
||||
static bool FileInfoCompare(const FileInfo& f1, const FileInfo& f2);
|
||||
//! QLabel word wrap does not break long words such as filenames, so manual word wrap needed
|
||||
static QString WordWrap(const QString& string, int maxLength);
|
||||
};
|
||||
@@ -1,176 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LegacyPreviewerClass</class>
|
||||
<widget class="QWidget" name="LegacyPreviewerClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>148</width>
|
||||
<height>282</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Preview</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="m_texturePreviewWidget" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="m_horizontalLayout">
|
||||
<item>
|
||||
<spacer name="m_horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="m_comboBoxRGB">
|
||||
<property name="currentText">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="AzToolsFramework::AspectRatioAwarePixmapWidget" name="m_previewImageCtrl" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="m_modelPreviewWidget" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="CPreviewModelCtrl" name="m_previewCtrl" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_fileInfoCtrl">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::AutoText</enum>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="m_verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>CPreviewModelCtrl</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>Controls/PreviewModelCtrl.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>AzToolsFramework::AspectRatioAwarePixmapWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>AzToolsFramework/UI/UICore/AspectRatioAwarePixmapWidget.hxx</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -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 "EditorDefs.h"
|
||||
|
||||
#include "LegacyPreviewerFactory.h"
|
||||
|
||||
// AzToolsFramework
|
||||
#include <AzToolsFramework/AssetBrowser/AssetBrowserEntry.h> // for AssetBrowserEntry::AssetEntryType
|
||||
#include <AzToolsFramework/AssetBrowser/EBusFindAssetTypeByName.h> // for EBusFindAssetTypeByName
|
||||
|
||||
// Editor
|
||||
#include "LegacyPreviewer.h"
|
||||
|
||||
|
||||
AzToolsFramework::AssetBrowser::Previewer* LegacyPreviewerFactory::CreatePreviewer(QWidget* parent) const
|
||||
{
|
||||
return new LegacyPreviewer(parent);
|
||||
}
|
||||
|
||||
bool LegacyPreviewerFactory::IsEntrySupported(const AzToolsFramework::AssetBrowser::AssetBrowserEntry* entry) const
|
||||
{
|
||||
using namespace AzToolsFramework::AssetBrowser;
|
||||
|
||||
EBusFindAssetTypeByName meshAssetTypeResult("Static Mesh");
|
||||
AZ::AssetTypeInfoBus::BroadcastResult(meshAssetTypeResult, &AZ::AssetTypeInfo::GetAssetType);
|
||||
EBusFindAssetTypeByName textureAssetTypeResult("Texture");
|
||||
AZ::AssetTypeInfoBus::BroadcastResult(textureAssetTypeResult, &AZ::AssetTypeInfo::GetAssetType);
|
||||
|
||||
switch (entry->GetEntryType())
|
||||
{
|
||||
case AssetBrowserEntry::AssetEntryType::Source:
|
||||
{
|
||||
const auto* source = azrtti_cast < const SourceAssetBrowserEntry * > (entry);
|
||||
if (source->GetPrimaryAssetType() == textureAssetTypeResult.GetAssetType())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
AZStd::vector < const ProductAssetBrowserEntry * > products;
|
||||
source->GetChildrenRecursively < ProductAssetBrowserEntry > (products);
|
||||
for (auto* product : products)
|
||||
{
|
||||
if (product->GetAssetType() == textureAssetTypeResult.GetAssetType() ||
|
||||
product->GetAssetType() == meshAssetTypeResult.GetAssetType())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AssetBrowserEntry::AssetEntryType::Product:
|
||||
const auto* product = azrtti_cast < const ProductAssetBrowserEntry * > (entry);
|
||||
return product->GetAssetType() == textureAssetTypeResult.GetAssetType() ||
|
||||
product->GetAssetType() == meshAssetTypeResult.GetAssetType();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const QString& LegacyPreviewerFactory::GetName() const
|
||||
{
|
||||
return LegacyPreviewer::Name;
|
||||
}
|
||||
@@ -1,34 +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/Memory/SystemAllocator.h>
|
||||
#include <AzToolsFramework/AssetBrowser/Previewer/PreviewerFactory.h>
|
||||
|
||||
class QString;
|
||||
|
||||
class LegacyPreviewerFactory final
|
||||
: public AzToolsFramework::AssetBrowser::PreviewerFactory
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(LegacyPreviewerFactory, AZ::SystemAllocator, 0);
|
||||
|
||||
LegacyPreviewerFactory() = default;
|
||||
~LegacyPreviewerFactory() = default;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// AzToolsFramework::AssetBrowser::PreviewerFactory
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
AzToolsFramework::AssetBrowser::Previewer* CreatePreviewer(QWidget* parent = nullptr) const override;
|
||||
bool IsEntrySupported(const AzToolsFramework::AssetBrowser::AssetBrowserEntry* entry) const override;
|
||||
const QString& GetName() const override;
|
||||
};
|
||||
@@ -826,9 +826,6 @@ void CBaseLibraryManager::OnEditorNotifyEvent(EEditorNotifyEvent event)
|
||||
SetSelectedItem(0);
|
||||
ClearAll();
|
||||
break;
|
||||
case eNotify_OnMissionChange:
|
||||
SetSelectedItem(0);
|
||||
break;
|
||||
case eNotify_OnCloseScene:
|
||||
SetSelectedItem(0);
|
||||
ClearAll();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,198 +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_CONTROLS_PREVIEWMODELCTRL_H
|
||||
#define CRYINCLUDE_EDITOR_CONTROLS_PREVIEWMODELCTRL_H
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <QString>
|
||||
#include <QPoint>
|
||||
#include <QWidget>
|
||||
|
||||
#include <IStatObj.h>
|
||||
|
||||
#endif
|
||||
|
||||
struct IRenderNode;
|
||||
class CImageEx;
|
||||
|
||||
class CPreviewModelCtrl
|
||||
: public QWidget
|
||||
, public IEditorNotifyListener
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CPreviewModelCtrl(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
|
||||
|
||||
QSize minimumSizeHint() const override;
|
||||
|
||||
public:
|
||||
void LoadFile(const QString& modelFile, bool changeCamera = true);
|
||||
Vec3 GetSize() const { return m_size; };
|
||||
QString GetLoadedFile() const { return m_loadedFile; }
|
||||
|
||||
void SetEntity(IRenderNode* entity);
|
||||
void SetObject(IStatObj* pObject);
|
||||
IStatObj* GetObject() { return m_pObj; }
|
||||
void SetCameraLookAt(float fRadiusScale, const Vec3& dir = Vec3(0, 1, 0));
|
||||
void SetCameraRadius(float fRadius);
|
||||
CCamera& GetCamera();
|
||||
void SetGrid(bool bEnable) { m_bGrid = bEnable; }
|
||||
void SetAxis(bool bEnable, bool forParticleEditor = false) { m_bAxis = bEnable; m_bAxisParticleEditor = forParticleEditor; }
|
||||
void SetRotation(bool bEnable);
|
||||
void SetClearColor(const ColorF& color);
|
||||
void SetBackgroundTexture(const QString& textureFilename);
|
||||
void UseBackLight(bool bEnable);
|
||||
bool UseBackLight() const { return m_bUseBacklight; }
|
||||
void SetShowNormals(bool bShow) { m_bShowNormals = bShow; }
|
||||
void SetShowPhysics(bool bShow) { m_bShowPhysics = bShow; }
|
||||
void SetShowRenderInfo(bool bShow) { m_bShowRenderInfo = bShow; }
|
||||
|
||||
void EnableUpdate(bool bEnable);
|
||||
bool IsUpdateEnabled() const { return m_bUpdate; }
|
||||
void Update(bool bForceUpdate = false);
|
||||
void ProcessKeys();
|
||||
|
||||
// this turns on and off aspect-ratio-maintaining. Use it when the widget is free to resize itself.
|
||||
void SetAspectRatio(float newAspectRatio);
|
||||
int heightForWidth(int w) const override;
|
||||
bool hasHeightForWidth() const override;
|
||||
|
||||
void GetImageOffscreen(CImageEx& image, const QSize& customSize = QSize(0, 0));
|
||||
|
||||
void GetCameraTM(Matrix34& cameraTM);
|
||||
void SetCameraTM(const Matrix34& cameraTM);
|
||||
|
||||
// Place camera so that whole object fits on screen.
|
||||
void FitToScreen();
|
||||
|
||||
// Get information about the preview model.
|
||||
int GetFaceCount();
|
||||
int GetVertexCount();
|
||||
int GetMaxLod();
|
||||
int GetMtlCount();
|
||||
|
||||
void SetShowObject(bool bShowObject) {m_bShowObject = bShowObject; }
|
||||
bool GetShowObject() {return m_bShowObject; }
|
||||
|
||||
void SetAmbient(ColorF amb) { m_ambientColor = amb; }
|
||||
void SetAmbientMultiplier(f32 multiplier) { m_ambientMultiplier = multiplier; }
|
||||
|
||||
typedef void (* CameraChangeCallback)(void* m_userData, CPreviewModelCtrl* m_currentCamera);
|
||||
void SetCameraChangeCallback(CameraChangeCallback callback, void* userData) { m_cameraChangeCallback = callback, m_pCameraChangeUserData = userData; }
|
||||
|
||||
void EnableMaterialPrecaching(bool bPrecacheMaterial) { m_bPrecacheMaterial = bPrecacheMaterial; }
|
||||
void EnableWireframeRendering(bool bDrawWireframe) { m_bDrawWireFrame = bDrawWireframe; }
|
||||
|
||||
public:
|
||||
~CPreviewModelCtrl();
|
||||
|
||||
bool CreateContext();
|
||||
void ReleaseObject();
|
||||
void DeleteRenderContex();
|
||||
|
||||
protected:
|
||||
void OnCreate();
|
||||
void OnDestroy();
|
||||
void OnLButtonDown(QPoint point);
|
||||
void OnLButtonUp(QPoint point);
|
||||
void OnMButtonDown(QPoint point);
|
||||
void OnMButtonUp(QPoint point);
|
||||
void OnRButtonUp(QPoint point);
|
||||
void OnRButtonDown(QPoint point);
|
||||
|
||||
QPaintEngine* paintEngine() const override;
|
||||
void showEvent(QShowEvent* event) override;
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void timerEvent(QTimerEvent* event) override;
|
||||
void mouseMoveEvent(QMouseEvent* event) override;
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
void wheelEvent(QWheelEvent* event) override;
|
||||
|
||||
virtual void OnEditorNotifyEvent(EEditorNotifyEvent event);
|
||||
|
||||
protected:
|
||||
virtual bool Render();
|
||||
virtual void SetCamera(CCamera& cam);
|
||||
|
||||
virtual void RenderObject(_smart_ptr<IMaterial> pMaterial, SRenderingPassInfo& passInfo);
|
||||
|
||||
HWND m_hWnd;
|
||||
CCamera m_camera;
|
||||
float m_fov;
|
||||
|
||||
struct SPreviousContext;
|
||||
std::vector<SPreviousContext> m_previousContexts;
|
||||
|
||||
void SetOrbitAngles(const Ang3& ang);
|
||||
void DrawGrid();
|
||||
void DrawBackground();
|
||||
_smart_ptr<IMaterial> GetCurrentMaterial();
|
||||
|
||||
_smart_ptr<IStatObj> m_pObj;
|
||||
|
||||
IRenderer* m_pRenderer;
|
||||
bool m_bContextCreated;
|
||||
|
||||
Vec3 m_size;
|
||||
Vec3 m_pos;
|
||||
int m_nTimer;
|
||||
bool m_useAspectRatio = false;
|
||||
float m_aspectRatio = 1.0f;
|
||||
|
||||
QString m_loadedFile;
|
||||
std::vector<CDLight> m_lights;
|
||||
|
||||
AABB m_aabb;
|
||||
Vec3 m_cameraTarget;
|
||||
float m_cameraRadius;
|
||||
Vec3 m_cameraAngles;
|
||||
bool m_bInRotateMode;
|
||||
bool m_bInMoveMode;
|
||||
bool m_bInPanMode;
|
||||
QPoint m_mousePosition;
|
||||
QPoint m_previousMousePosition;
|
||||
IRenderNode* m_pEntity;
|
||||
bool m_bHaveAnythingToRender;
|
||||
bool m_bGrid;
|
||||
bool m_bAxis;
|
||||
bool m_bAxisParticleEditor;
|
||||
bool m_bUpdate;
|
||||
bool m_bRotate;
|
||||
float m_rotateAngle;
|
||||
ColorF m_clearColor;
|
||||
ColorF m_ambientColor;
|
||||
f32 m_ambientMultiplier;
|
||||
bool m_bUseBacklight;
|
||||
bool m_bShowObject;
|
||||
bool m_bPrecacheMaterial;
|
||||
bool m_bDrawWireFrame;
|
||||
bool m_bShowNormals;
|
||||
bool m_bShowPhysics;
|
||||
bool m_bShowRenderInfo;
|
||||
int m_backgroundTextureId;
|
||||
float m_tileX;
|
||||
float m_tileY;
|
||||
float m_tileSizeX;
|
||||
float m_tileSizeY;
|
||||
CameraChangeCallback m_cameraChangeCallback;
|
||||
void* m_pCameraChangeUserData;
|
||||
|
||||
protected:
|
||||
void StorePreviousContext();
|
||||
void SetCurrentContext();
|
||||
void RestorePreviousContext();
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_CONTROLS_PREVIEWMODELCTRL_H
|
||||
@@ -1,26 +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.
|
||||
|
||||
// Description : implementation file
|
||||
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "TimeOfDaySlider.h"
|
||||
|
||||
QString TimeOfDaySlider::hoverValueText(int sliderValue) const
|
||||
{
|
||||
return QString::fromLatin1("%1:%2").arg(static_cast<int>(sliderValue / 60)).arg(sliderValue % 60, 2, 10, QLatin1Char('0'));
|
||||
}
|
||||
|
||||
#include <Controls/moc_TimeOfDaySlider.cpp>
|
||||
@@ -1,34 +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_TIMEOFDAYSLIDER_H
|
||||
#define CRYINCLUDE_EDITOR_TIMEOFDAYSLIDER_H
|
||||
#pragma once
|
||||
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <AzQtComponents/Components/Widgets/Slider.h>
|
||||
#endif
|
||||
|
||||
class TimeOfDaySlider
|
||||
: public AzQtComponents::SliderInt
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using AzQtComponents::SliderInt::SliderInt;
|
||||
|
||||
protected:
|
||||
QString hoverValueText(int sliderValue) const override;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_TIMEOFDAYSLIDER_H
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "Objects/SelectionGroup.h"
|
||||
#include "ViewManager.h"
|
||||
|
||||
#include <AzFramework/API/AtomActiveInterface.h>
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
|
||||
// Qt
|
||||
|
||||
@@ -78,7 +78,6 @@ AZ_POP_DISABLE_WARNING
|
||||
#include <AzQtComponents/Utilities/QtPluginPaths.h>
|
||||
|
||||
// CryCommon
|
||||
#include <CryCommon/I3DEngine.h>
|
||||
#include <CryCommon/ITimer.h>
|
||||
#include <CryCommon/IPhysics.h>
|
||||
#include <CryCommon/ILevelSystem.h>
|
||||
@@ -99,7 +98,6 @@ AZ_POP_DISABLE_WARNING
|
||||
#include "GridSettingsDialog.h"
|
||||
#include "LayoutConfigDialog.h"
|
||||
#include "ViewManager.h"
|
||||
#include "ModelViewport.h"
|
||||
#include "FileTypeUtils.h"
|
||||
#include "PluginManager.h"
|
||||
|
||||
@@ -109,14 +107,12 @@ AZ_POP_DISABLE_WARNING
|
||||
#include "GameEngine.h"
|
||||
|
||||
#include "StartupTraceHandler.h"
|
||||
#include "ThumbnailGenerator.h"
|
||||
#include "ToolsConfigPage.h"
|
||||
#include "Objects/SelectionGroup.h"
|
||||
#include "Include/IObjectManager.h"
|
||||
#include "WaitProgress.h"
|
||||
|
||||
#include "ToolBox.h"
|
||||
#include "Geometry/EdMesh.h"
|
||||
#include "LevelInfo.h"
|
||||
#include "EditorPreferencesDialog.h"
|
||||
#include "GraphicsSettingsDialog.h"
|
||||
@@ -392,7 +388,6 @@ void CCryEditApp::RegisterActionHandlers()
|
||||
ON_COMMAND(ID_FILE_RESAVESLICES, OnFileResaveSlices)
|
||||
ON_COMMAND(ID_FILE_EDITEDITORINI, OnFileEditEditorini)
|
||||
ON_COMMAND(ID_PREFERENCES, OnPreferences)
|
||||
ON_COMMAND(ID_RELOAD_GEOMETRY, OnReloadGeometry)
|
||||
ON_COMMAND(ID_REDO, OnRedo)
|
||||
ON_COMMAND(ID_TOOLBAR_WIDGET_REDO, OnRedo)
|
||||
ON_COMMAND(ID_RELOAD_TEXTURES, OnReloadTextures)
|
||||
@@ -401,7 +396,6 @@ void CCryEditApp::RegisterActionHandlers()
|
||||
ON_COMMAND(ID_FILE_NEW_SLICE, OnCreateSlice)
|
||||
ON_COMMAND(ID_FILE_OPEN_SLICE, OnOpenSlice)
|
||||
#endif
|
||||
ON_COMMAND(ID_RESOURCES_GENERATECGFTHUMBNAILS, OnGenerateCgfThumbnails)
|
||||
ON_COMMAND(ID_SWITCH_PHYSICS, OnSwitchPhysics)
|
||||
ON_COMMAND(ID_GAME_SYNCPLAYER, OnSyncPlayer)
|
||||
ON_COMMAND(ID_RESOURCES_REDUCEWORKINGSET, OnResourcesReduceworkingset)
|
||||
@@ -451,14 +445,12 @@ void CCryEditApp::RegisterActionHandlers()
|
||||
#endif
|
||||
ON_COMMAND(ID_DISPLAY_GOTOPOSITION, OnDisplayGotoPosition)
|
||||
ON_COMMAND(ID_SNAPANGLE, OnSnapangle)
|
||||
ON_COMMAND(ID_EDIT_RENAMEOBJECT, OnEditRenameobject)
|
||||
ON_COMMAND(ID_CHANGEMOVESPEED_INCREASE, OnChangemovespeedIncrease)
|
||||
ON_COMMAND(ID_CHANGEMOVESPEED_DECREASE, OnChangemovespeedDecrease)
|
||||
ON_COMMAND(ID_CHANGEMOVESPEED_CHANGESTEP, OnChangemovespeedChangestep)
|
||||
ON_COMMAND(ID_FILE_SAVELEVELRESOURCES, OnFileSavelevelresources)
|
||||
ON_COMMAND(ID_CLEAR_REGISTRY, OnClearRegistryData)
|
||||
ON_COMMAND(ID_VALIDATELEVEL, OnValidatelevel)
|
||||
ON_COMMAND(ID_TOOLS_VALIDATEOBJECTPOSITIONS, OnValidateObjectPositions)
|
||||
ON_COMMAND(ID_TOOLS_PREFERENCES, OnToolsPreferences)
|
||||
ON_COMMAND(ID_GRAPHICS_SETTINGS, OnGraphicsSettings)
|
||||
ON_COMMAND(ID_SWITCHCAMERA_DEFAULTCAMERA, OnSwitchToDefaultCamera)
|
||||
@@ -472,8 +464,6 @@ void CCryEditApp::RegisterActionHandlers()
|
||||
ON_COMMAND(ID_DISPLAY_SHOWHELPERS, OnShowHelpers)
|
||||
ON_COMMAND(ID_OPEN_TRACKVIEW, OnOpenTrackView)
|
||||
ON_COMMAND(ID_OPEN_UICANVASEDITOR, OnOpenUICanvasEditor)
|
||||
ON_COMMAND(ID_TERRAIN_TIMEOFDAY, OnTimeOfDay)
|
||||
ON_COMMAND(ID_TERRAIN_TIMEOFDAYBUTTON, OnTimeOfDay)
|
||||
|
||||
ON_COMMAND_RANGE(ID_GAME_PC_ENABLELOWSPEC, ID_GAME_PC_ENABLEVERYHIGHSPEC, OnChangeGameSpec)
|
||||
|
||||
@@ -1913,11 +1903,6 @@ void CCryEditApp::LoadFile(QString fileName)
|
||||
{
|
||||
return;
|
||||
}
|
||||
CViewport* vp = GetIEditor()->GetViewManager()->GetView(0);
|
||||
if (CModelViewport* mvp = viewport_cast<CModelViewport*>(vp))
|
||||
{
|
||||
mvp->LoadObject(fileName, 1);
|
||||
}
|
||||
|
||||
LoadTagLocations();
|
||||
|
||||
@@ -2953,43 +2938,6 @@ void CCryEditApp::OnReloadTextures()
|
||||
GetIEditor()->GetRenderer()->EF_ReloadTextures();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::OnReloadGeometry()
|
||||
{
|
||||
CErrorsRecorder errRecorder(GetIEditor());
|
||||
CWaitProgress wait("Reloading static geometry");
|
||||
|
||||
CLogFile::WriteLine("Reloading Static objects geometries.");
|
||||
CEdMesh::ReloadAllGeometries();
|
||||
|
||||
GetIEditor()->GetObjectManager()->SendEvent(EVENT_UNLOAD_GEOM);
|
||||
|
||||
GetIEditor()->GetObjectManager()->SendEvent(EVENT_RELOAD_GEOM);
|
||||
GetIEditor()->Notify(eNotify_OnReloadTrackView);
|
||||
|
||||
// Rephysicalize viewport meshes
|
||||
for (int i = 0; i < GetIEditor()->GetViewManager()->GetViewCount(); ++i)
|
||||
{
|
||||
CViewport* vp = GetIEditor()->GetViewManager()->GetView(i);
|
||||
if (CModelViewport* mvp = viewport_cast<CModelViewport*>(vp))
|
||||
{
|
||||
mvp->RePhysicalize();
|
||||
}
|
||||
}
|
||||
|
||||
IRenderNode** plist = new IRenderNode*[
|
||||
gEnv->p3DEngine->GetObjectsByType(eERType_StaticMeshRenderComponent,0)
|
||||
];
|
||||
for (const EERType type : AZStd::array<EERType, 3>{eERType_Dummy_10, eERType_StaticMeshRenderComponent})
|
||||
{
|
||||
for (int j = gEnv->p3DEngine->GetObjectsByType(type, plist) - 1; j >= 0; j--)
|
||||
{
|
||||
plist[j]->Physicalize(true);
|
||||
}
|
||||
}
|
||||
delete[] plist;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::OnUndo()
|
||||
{
|
||||
@@ -3154,15 +3102,6 @@ void CCryEditApp::OnSyncPlayerUpdate(QAction* action)
|
||||
action->setChecked(!GetIEditor()->GetGameEngine()->IsSyncPlayerPosition());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::OnGenerateCgfThumbnails()
|
||||
{
|
||||
qApp->setOverrideCursor(Qt::BusyCursor);
|
||||
CThumbnailGenerator gen;
|
||||
gen.GenerateForDirectory("Objects\\");
|
||||
qApp->restoreOverrideCursor();
|
||||
}
|
||||
|
||||
void CCryEditApp::OnUpdateNonGameMode(QAction* action)
|
||||
{
|
||||
action->setEnabled(!GetIEditor()->IsInGameMode());
|
||||
@@ -3261,10 +3200,9 @@ CCryEditApp::ECreateLevelResult CCryEditApp::CreateLevel(const QString& levelNam
|
||||
m_bIsExportingLegacyData = false;
|
||||
}
|
||||
|
||||
GetIEditor()->GetGameEngine()->LoadLevel(GetIEditor()->GetGameEngine()->GetMissionName(), true, true);
|
||||
GetIEditor()->GetGameEngine()->LoadLevel(true, true);
|
||||
GetIEditor()->GetSystem()->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_LEVEL_PRECACHE_START, 0, 0);
|
||||
|
||||
GetIEditor()->GetGameEngine()->ReloadEnvironment();
|
||||
GetIEditor()->GetSystem()->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_LEVEL_PRECACHE_END, 0, 0);
|
||||
}
|
||||
|
||||
@@ -3824,59 +3762,6 @@ void CCryEditApp::OnUpdateSnapangle(QAction* action)
|
||||
action->setChecked(gSettings.pGrid->IsAngleSnapEnabled());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::OnEditRenameobject()
|
||||
{
|
||||
CSelectionGroup* pSelection = GetIEditor()->GetSelection();
|
||||
if (pSelection->IsEmpty())
|
||||
{
|
||||
QMessageBox::critical(AzToolsFramework::GetActiveWindow(), QString(), QObject::tr("No Selected Objects!"));
|
||||
return;
|
||||
}
|
||||
|
||||
IObjectManager* pObjMan = GetIEditor()->GetObjectManager();
|
||||
|
||||
if (!pObjMan)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
StringDlg dlg(QObject::tr("Rename Object(s)"));
|
||||
if (dlg.exec() == QDialog::Accepted)
|
||||
{
|
||||
CUndo undo("Rename Objects");
|
||||
QString newName;
|
||||
QString str = dlg.GetString();
|
||||
int num = 0;
|
||||
|
||||
for (int i = 0; i < pSelection->GetCount(); ++i)
|
||||
{
|
||||
CBaseObject* pObject = pSelection->GetObject(i);
|
||||
|
||||
if (pObject)
|
||||
{
|
||||
if (pObjMan->IsDuplicateObjectName(str))
|
||||
{
|
||||
pObjMan->ShowDuplicationMsgWarning(pObject, str, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < pSelection->GetCount(); ++i)
|
||||
{
|
||||
newName = QStringLiteral("%1%2").arg(str).arg(num);
|
||||
++num;
|
||||
CBaseObject* pObject = pSelection->GetObject(i);
|
||||
|
||||
if (pObject)
|
||||
{
|
||||
pObjMan->ChangeObjectName(pObject, newName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::OnChangemovespeedIncrease()
|
||||
{
|
||||
@@ -3936,119 +3821,6 @@ void CCryEditApp::OnValidatelevel()
|
||||
levelInfo.Validate();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::OnValidateObjectPositions()
|
||||
{
|
||||
IObjectManager* objMan = GetIEditor()->GetObjectManager();
|
||||
|
||||
if (!objMan)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CErrorReport errorReport;
|
||||
errorReport.SetCurrentFile("");
|
||||
errorReport.SetImmediateMode(false);
|
||||
|
||||
int objCount = objMan->GetObjectCount();
|
||||
AABB bbox1;
|
||||
AABB bbox2;
|
||||
int bugNo = 0;
|
||||
QString statTxt("");
|
||||
|
||||
std::vector<CBaseObject*> objects;
|
||||
objMan->GetObjects(objects);
|
||||
|
||||
std::vector<CBaseObject*> foundObjects;
|
||||
|
||||
std::vector<GUID> objIDs;
|
||||
|
||||
for (int i1 = 0; i1 < objCount; ++i1)
|
||||
{
|
||||
CBaseObject* pObj1 = objects[i1];
|
||||
|
||||
if (!pObj1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Object must have geometry
|
||||
if (!pObj1->GetGeometry())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
pObj1->GetBoundBox(bbox1);
|
||||
|
||||
// Check if object has other objects inside its bbox
|
||||
foundObjects.clear();
|
||||
objMan->FindObjectsInAABB(bbox1, foundObjects);
|
||||
|
||||
for (int i2 = 0; i2 < foundObjects.size(); ++i2)
|
||||
{
|
||||
CBaseObject* pObj2 = objects[i2];
|
||||
if (!pObj2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pObj2->GetId() == pObj1->GetId())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pObj2->GetParent())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (stl::find(objIDs, pObj2->GetId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!pObj2->GetGeometry())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
pObj2->GetBoundBox(bbox2);
|
||||
|
||||
if (!bbox1.IsContainPoint(bbox2.max))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!bbox1.IsContainPoint(bbox2.min))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
objIDs.push_back(pObj2->GetId());
|
||||
|
||||
CErrorRecord error;
|
||||
error.pObject = pObj2;
|
||||
error.count = bugNo;
|
||||
error.error = tr("%1 inside %2 object").arg(pObj2->GetName(), pObj1->GetName());
|
||||
error.description = "Object left inside other object";
|
||||
errorReport.ReportError(error);
|
||||
++bugNo;
|
||||
}
|
||||
|
||||
statTxt = tr("%1/%2 [Reported Objects: %3]").arg(i1).arg(objCount).arg(bugNo);
|
||||
GetIEditor()->SetStatusText(statTxt);
|
||||
}
|
||||
|
||||
if (errorReport.GetErrorCount() == 0)
|
||||
{
|
||||
QMessageBox::critical(AzToolsFramework::GetActiveWindow(), QString(), QObject::tr("No Errors Found"));
|
||||
}
|
||||
else
|
||||
{
|
||||
errorReport.Display();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::OnToolsPreferences()
|
||||
{
|
||||
@@ -4197,12 +3969,6 @@ void CCryEditApp::OnOpenUICanvasEditor()
|
||||
QtViewPaneManager::instance()->OpenPane(LyViewPane::UiEditor);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::OnTimeOfDay()
|
||||
{
|
||||
GetIEditor()->OpenView("Time Of Day");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::SetGameSpecCheck(ESystemConfigSpec spec, ESystemConfigPlatform platform, int &nCheck, bool &enable)
|
||||
{
|
||||
|
||||
@@ -230,11 +230,9 @@ public:
|
||||
void OnFileEditEditorini();
|
||||
void OnPreferences();
|
||||
void OnReloadTextures();
|
||||
void OnReloadGeometry();
|
||||
void OnRedo();
|
||||
void OnUpdateRedo(QAction* action);
|
||||
void OnUpdateUndo(QAction* action);
|
||||
void OnGenerateCgfThumbnails();
|
||||
void OnSwitchPhysics();
|
||||
void OnSwitchPhysicsUpdate(QAction* action);
|
||||
void OnSyncPlayer();
|
||||
@@ -413,14 +411,12 @@ private:
|
||||
void OnDisplayGotoPosition();
|
||||
void OnSnapangle();
|
||||
void OnUpdateSnapangle(QAction* action);
|
||||
void OnEditRenameobject();
|
||||
void OnChangemovespeedIncrease();
|
||||
void OnChangemovespeedDecrease();
|
||||
void OnChangemovespeedChangestep();
|
||||
void OnFileSavelevelresources();
|
||||
void OnClearRegistryData();
|
||||
void OnValidatelevel();
|
||||
void OnValidateObjectPositions();
|
||||
void OnToolsPreferences();
|
||||
void OnGraphicsSettings();
|
||||
void OnSwitchToDefaultCamera();
|
||||
@@ -435,7 +431,6 @@ private:
|
||||
void OnOpenTrackView();
|
||||
void OnOpenAudioControlsEditor();
|
||||
void OnOpenUICanvasEditor();
|
||||
void OnTimeOfDay();
|
||||
void OnChangeGameSpec(UINT nID);
|
||||
void SetGameSpecCheck(ESystemConfigSpec spec, ESystemConfigPlatform platform, int &nCheck, bool &enable);
|
||||
void OnUpdateGameSpec(QAction* action);
|
||||
|
||||
@@ -27,12 +27,6 @@
|
||||
// AzFramework
|
||||
#include <AzFramework/Archive/IArchive.h>
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
#include <AzFramework/API/AtomActiveInterface.h>
|
||||
#include <AzFramework/Viewport/CameraInput.h>
|
||||
|
||||
// Atom
|
||||
#include <Atom/RPI.Public/ViewportContext.h>
|
||||
#include <Atom/RPI.Public/ViewportContextBus.h>
|
||||
|
||||
// AzToolsFramework
|
||||
#include <AzToolsFramework/Slice/SliceUtilities.h>
|
||||
@@ -48,7 +42,6 @@
|
||||
#include "Settings.h"
|
||||
|
||||
#include "PluginManager.h"
|
||||
#include "Mission.h"
|
||||
#include "ViewManager.h"
|
||||
#include "DisplaySettings.h"
|
||||
#include "GameEngine.h"
|
||||
@@ -63,11 +56,13 @@
|
||||
#include "CheckOutDialog.h"
|
||||
#include "GameExporter.h"
|
||||
#include "MainWindow.h"
|
||||
#include "ITimeOfDay.h"
|
||||
#include "LevelFileDialog.h"
|
||||
#include "StatObjBus.h"
|
||||
|
||||
// LmbrCentral
|
||||
#include <ModernViewportCameraController.h>
|
||||
#include <Atom/RPI.Public/ViewportContext.h>
|
||||
#include <Atom/RPI.Public/ViewportContextBus.h>
|
||||
#include <LmbrCentral/Rendering/EditorLightComponentBus.h> // for LmbrCentral::EditorLightComponentRequestBus
|
||||
|
||||
|
||||
@@ -126,7 +121,6 @@ CCryEditDoc::CCryEditDoc()
|
||||
// The right way would require us to save to the level folder the export status of the
|
||||
// level.
|
||||
, m_boLevelExported(true)
|
||||
, m_mission(NULL)
|
||||
, m_modified(false)
|
||||
, m_envProbeHeight(200.0f)
|
||||
, m_envProbeSliceRelativePath("EngineAssets/Slices/DefaultLevelSetup.slice")
|
||||
@@ -161,7 +155,6 @@ CCryEditDoc::CCryEditDoc()
|
||||
CCryEditDoc::~CCryEditDoc()
|
||||
{
|
||||
GetIEditor()->SetDocument(nullptr);
|
||||
ClearMissions();
|
||||
|
||||
delete m_pLevelShaderCache;
|
||||
|
||||
@@ -258,17 +251,6 @@ bool CCryEditDoc::Save()
|
||||
return OnSaveDocument(GetActivePathName());
|
||||
}
|
||||
|
||||
void CCryEditDoc::ChangeMission()
|
||||
{
|
||||
GetIEditor()->Notify(eNotify_OnMissionChange);
|
||||
|
||||
// Notify listeners.
|
||||
for (std::list<IDocListener*>::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it)
|
||||
{
|
||||
(*it)->OnMissionChange();
|
||||
}
|
||||
}
|
||||
|
||||
void CCryEditDoc::DeleteContents()
|
||||
{
|
||||
m_hasErrors = false;
|
||||
@@ -298,10 +280,6 @@ void CCryEditDoc::DeleteContents()
|
||||
// Delete all objects from Object Manager.
|
||||
GetIEditor()->GetObjectManager()->DeleteAllObjects();
|
||||
|
||||
ClearMissions();
|
||||
|
||||
GetIEditor()->GetGameEngine()->ResetResources();
|
||||
|
||||
// Load scripts data
|
||||
SetModifiedFlag(FALSE);
|
||||
SetModifiedModules(eModifiedNothing);
|
||||
@@ -344,7 +322,6 @@ void CCryEditDoc::Save(TDocMultiArchive& arrXmlAr)
|
||||
if (!isPrefabEnabled)
|
||||
{
|
||||
CAutoDocNotReady autoDocNotReady;
|
||||
QString currentMissionName;
|
||||
|
||||
if (arrXmlAr[DMAS_GENERAL] != NULL)
|
||||
{
|
||||
@@ -359,8 +336,6 @@ void CCryEditDoc::Save(TDocMultiArchive& arrXmlAr)
|
||||
|
||||
// Fog settings ///////////////////////////////////////////////////////
|
||||
SerializeFogSettings((*arrXmlAr[DMAS_GENERAL]));
|
||||
// Serialize Missions //////////////////////////////////////////////////
|
||||
SerializeMissions(arrXmlAr, currentMissionName, false);
|
||||
|
||||
SerializeShaderCache((*arrXmlAr[DMAS_GENERAL_NAMED_DATA]));
|
||||
SerializeNameSelection((*arrXmlAr[DMAS_GENERAL]));
|
||||
@@ -407,7 +382,6 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
|
||||
HEAP_CHECK
|
||||
|
||||
CLogFile::FormatLine("Loading from %s...", szFilename.toUtf8().data());
|
||||
QString currentMissionName;
|
||||
QString szLevelPath = Path::GetPath(szFilename);
|
||||
|
||||
{
|
||||
@@ -485,27 +459,9 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
|
||||
Audio::AudioSystemRequestBus::Broadcast(&Audio::AudioSystemRequestBus::Events::PushRequestBlocking, oAudioRequestData);
|
||||
}
|
||||
|
||||
HEAP_CHECK
|
||||
|
||||
if (!isPrefabEnabled)
|
||||
{
|
||||
// multiple missions are no longer supported, only load the current mission (last used)
|
||||
SerializeMissions(arrXmlAr, currentMissionName, false);
|
||||
}
|
||||
|
||||
HEAP_CHECK
|
||||
|
||||
if (GetIEditor()->Get3DEngine())
|
||||
{
|
||||
if (!isPrefabEnabled)
|
||||
{
|
||||
GetIEditor()->Get3DEngine()->LoadCompiledOctreeForEditor();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
CAutoLogTime logtime("Game Engine level load");
|
||||
GetIEditor()->GetGameEngine()->LoadLevel(currentMissionName, true, true);
|
||||
GetIEditor()->GetGameEngine()->LoadLevel(true, true);
|
||||
}
|
||||
|
||||
if (!isPrefabEnabled)
|
||||
@@ -526,27 +482,6 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
|
||||
SerializeFogSettings((*arrXmlAr[DMAS_GENERAL]));
|
||||
}
|
||||
|
||||
{
|
||||
QByteArray str;
|
||||
str = tr("Activating Mission %1").arg(currentMissionName).toUtf8();
|
||||
|
||||
CAutoLogTime logtime(str.data());
|
||||
|
||||
// Select current mission.
|
||||
m_mission = FindMission(currentMissionName);
|
||||
|
||||
if (m_mission)
|
||||
{
|
||||
SyncCurrentMissionContent(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetCurrentMission();
|
||||
}
|
||||
}
|
||||
|
||||
ForceSkyUpdate();
|
||||
|
||||
if (!isPrefabEnabled)
|
||||
{
|
||||
// Serialize Shader Cache.
|
||||
@@ -652,21 +587,14 @@ void CCryEditDoc::SerializeViewSettings(CXmlArchive& xmlAr)
|
||||
|
||||
CViewport* pVP = GetIEditor()->GetViewManager()->GetView(i);
|
||||
|
||||
Matrix34 tm = Matrix34::CreateRotationXYZ(va);
|
||||
tm.SetTranslation(vp);
|
||||
|
||||
if (pVP)
|
||||
{
|
||||
Matrix34 tm = Matrix34::CreateRotationXYZ(va);
|
||||
tm.SetTranslation(vp);
|
||||
pVP->SetViewTM(tm);
|
||||
}
|
||||
|
||||
if (auto viewportContext = AZ::Interface<AZ::RPI::ViewportContextRequestsInterface>::Get()->GetDefaultViewportContext())
|
||||
{
|
||||
AzFramework::ModernViewportCameraControllerRequestBus::Event(
|
||||
viewportContext->GetId(), &AzFramework::ModernViewportCameraControllerRequestBus::Events::SetTargetCameraTransform,
|
||||
LYTransformToAZTransform(tm));
|
||||
}
|
||||
|
||||
// Load grid.
|
||||
auto gridName = QString("Grid%1").arg(useOldViewFormat ? "" : QString::number(i));
|
||||
XmlNodeRef gridNode = xmlAr.root->newChild(gridName.toUtf8().constData());
|
||||
@@ -740,94 +668,6 @@ void CCryEditDoc::SerializeFogSettings(CXmlArchive& xmlAr)
|
||||
}
|
||||
}
|
||||
|
||||
void CCryEditDoc::SerializeMissions(TDocMultiArchive& arrXmlAr, QString& currentMissionName, bool bPartsInXml)
|
||||
{
|
||||
bool bLoading = IsLoadingXmlArArray(arrXmlAr);
|
||||
|
||||
if (bLoading)
|
||||
{
|
||||
// Loading
|
||||
CLogFile::WriteLine("Loading missions...");
|
||||
// Clear old layers
|
||||
ClearMissions();
|
||||
// Load shared objects and layers.
|
||||
XmlNodeRef objectsNode = arrXmlAr[DMAS_GENERAL]->root->findChild("Objects");
|
||||
XmlNodeRef objectLayersNode = arrXmlAr[DMAS_GENERAL]->root->findChild("ObjectLayers");
|
||||
// Load the layer count
|
||||
XmlNodeRef node = arrXmlAr[DMAS_GENERAL]->root->findChild("Missions");
|
||||
|
||||
if (!node)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QString current;
|
||||
node->getAttr("Current", current);
|
||||
currentMissionName = current;
|
||||
|
||||
// Read all node
|
||||
for (int i = 0; i < node->getChildCount(); i++)
|
||||
{
|
||||
CXmlArchive ar(*arrXmlAr[DMAS_GENERAL]);
|
||||
ar.root = node->getChild(i);
|
||||
CMission* mission = new CMission(this);
|
||||
mission->Serialize(ar);
|
||||
if (bPartsInXml)
|
||||
{
|
||||
mission->SerializeTimeOfDay(*arrXmlAr[DMAS_TIME_OF_DAY]);
|
||||
mission->SerializeEnvironment(*arrXmlAr[DMAS_ENVIRONMENT]);
|
||||
}
|
||||
else
|
||||
{
|
||||
mission->LoadParts();
|
||||
}
|
||||
|
||||
// Timur[9/11/2002] For backward compatibility with shared objects
|
||||
if (objectsNode)
|
||||
{
|
||||
mission->AddObjectsNode(objectsNode);
|
||||
}
|
||||
if (objectLayersNode)
|
||||
{
|
||||
mission->SetLayersNode(objectLayersNode);
|
||||
}
|
||||
|
||||
AddMission(mission);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Storing
|
||||
CLogFile::WriteLine("Storing missions...");
|
||||
// Save contents of current mission.
|
||||
SyncCurrentMissionContent(false);
|
||||
|
||||
XmlNodeRef node = arrXmlAr[DMAS_GENERAL]->root->newChild("Missions");
|
||||
|
||||
//! Store current mission name.
|
||||
currentMissionName = GetCurrentMission()->GetName();
|
||||
node->setAttr("Current", currentMissionName.toUtf8().data());
|
||||
|
||||
// Write all surface types.
|
||||
for (int i = 0; i < m_missions.size(); i++)
|
||||
{
|
||||
CXmlArchive ar(*arrXmlAr[DMAS_GENERAL]);
|
||||
ar.root = node->newChild("Mission");
|
||||
m_missions[i]->Serialize(ar, false);
|
||||
if (bPartsInXml)
|
||||
{
|
||||
m_missions[i]->SerializeTimeOfDay(*arrXmlAr[DMAS_TIME_OF_DAY]);
|
||||
m_missions[i]->SerializeEnvironment(*arrXmlAr[DMAS_ENVIRONMENT]);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_missions[i]->SaveParts();
|
||||
}
|
||||
}
|
||||
CLogFile::WriteString("Done");
|
||||
}
|
||||
}
|
||||
|
||||
void CCryEditDoc::SerializeShaderCache(CXmlArchive& xmlAr)
|
||||
{
|
||||
if (xmlAr.bLoading)
|
||||
@@ -2099,58 +1939,6 @@ void CCryEditDoc::SaveAutoBackup(bool bForce)
|
||||
isInProgress = false;
|
||||
}
|
||||
|
||||
|
||||
CMission* CCryEditDoc::GetCurrentMission(bool bSkipLoadingAIWhenSyncingContent /* = false */)
|
||||
{
|
||||
if (m_mission)
|
||||
{
|
||||
return m_mission;
|
||||
}
|
||||
|
||||
if (!m_missions.empty())
|
||||
{
|
||||
// Choose first available mission.
|
||||
SetCurrentMission(m_missions[0]);
|
||||
return m_mission;
|
||||
}
|
||||
|
||||
// Create initial mission.
|
||||
m_mission = new CMission(this);
|
||||
m_mission->SetName("Mission0");
|
||||
AddMission(m_mission);
|
||||
m_mission->SyncContent(true, false, bSkipLoadingAIWhenSyncingContent);
|
||||
return m_mission;
|
||||
}
|
||||
|
||||
void CCryEditDoc::SetCurrentMission(CMission* mission)
|
||||
{
|
||||
if (mission != m_mission)
|
||||
{
|
||||
QWaitCursor wait;
|
||||
|
||||
if (m_mission)
|
||||
{
|
||||
m_mission->SyncContent(false, false);
|
||||
}
|
||||
|
||||
m_mission = mission;
|
||||
m_mission->SyncContent(true, false);
|
||||
|
||||
GetIEditor()->GetGameEngine()->LoadMission(m_mission->GetName());
|
||||
}
|
||||
}
|
||||
|
||||
void CCryEditDoc::ClearMissions()
|
||||
{
|
||||
for (int i = 0; i < m_missions.size(); i++)
|
||||
{
|
||||
delete m_missions[i];
|
||||
}
|
||||
|
||||
m_missions.clear();
|
||||
m_mission = 0;
|
||||
}
|
||||
|
||||
bool CCryEditDoc::IsLevelExported() const
|
||||
{
|
||||
return m_boLevelExported;
|
||||
@@ -2161,37 +1949,6 @@ void CCryEditDoc::SetLevelExported(bool boExported)
|
||||
m_boLevelExported = boExported;
|
||||
}
|
||||
|
||||
CMission* CCryEditDoc::FindMission(const QString& name) const
|
||||
{
|
||||
for (int i = 0; i < m_missions.size(); i++)
|
||||
{
|
||||
if (QString::compare(name, m_missions[i]->GetName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return m_missions[i];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CCryEditDoc::AddMission(CMission* mission)
|
||||
{
|
||||
assert(std::find(m_missions.begin(), m_missions.end(), mission) == m_missions.end());
|
||||
m_missions.push_back(mission);
|
||||
GetIEditor()->Notify(eNotify_OnInvalidateControls);
|
||||
}
|
||||
|
||||
void CCryEditDoc::RemoveMission(CMission* mission)
|
||||
{
|
||||
// if deleting current mission.
|
||||
if (mission == m_mission)
|
||||
{
|
||||
m_mission = 0;
|
||||
}
|
||||
|
||||
m_missions.erase(std::find(m_missions.begin(), m_missions.end(), mission));
|
||||
GetIEditor()->Notify(eNotify_OnInvalidateControls);
|
||||
}
|
||||
|
||||
void CCryEditDoc::RegisterListener(IDocListener* listener)
|
||||
{
|
||||
if (listener == nullptr)
|
||||
@@ -2297,19 +2054,6 @@ void CCryEditDoc::OnStartLevelResourceList()
|
||||
gEnv->pCryPak->GetResourceList(AZ::IO::IArchive::RFOM_Level)->Clear();
|
||||
}
|
||||
|
||||
void CCryEditDoc::ForceSkyUpdate()
|
||||
{
|
||||
ITimeOfDay* pTimeOfDay = gEnv->p3DEngine ? gEnv->p3DEngine->GetTimeOfDay() : nullptr;
|
||||
CMission* pCurMission = GetIEditor()->GetDocument()->GetCurrentMission();
|
||||
|
||||
if (pTimeOfDay && pCurMission)
|
||||
{
|
||||
pTimeOfDay->SetTime(pCurMission->GetTime(), gSettings.bForceSkyUpdate);
|
||||
pCurMission->SetTime(pCurMission->GetTime());
|
||||
GetIEditor()->Notify(eNotify_OnTimeOfDayChange);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CCryEditDoc::DoFileSave()
|
||||
{
|
||||
if (GetEditMode() == CCryEditDoc::DocumentEditingMode::LevelEdit)
|
||||
@@ -2371,27 +2115,11 @@ void CCryEditDoc::InitEmptyLevel(int /*resolution*/, int /*unitSize*/, bool /*bU
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
if (!GetIEditor()->IsInPreviewMode())
|
||||
{
|
||||
// Make new mission.
|
||||
GetIEditor()->ReloadTemplates();
|
||||
m_environmentTemplate = GetIEditor()->FindTemplate("Environment");
|
||||
|
||||
GetCurrentMission(true); // true = skip loading the AI in case the content needs to get synchronized (otherwise it would attempt to load AI stuff from the previously loaded level (!) which might give confusing warnings)
|
||||
GetIEditor()->GetGameEngine()->SetMissionName(GetCurrentMission()->GetName());
|
||||
GetIEditor()->GetGameEngine()->SetLevelCreated(true);
|
||||
GetIEditor()->GetGameEngine()->ReloadEnvironment();
|
||||
GetIEditor()->GetGameEngine()->SetLevelCreated(false);
|
||||
|
||||
// Default time of day.
|
||||
auto defaultTimeOfDayPath = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / "Assets" / "Editor" / "default_time_of_day.xml";
|
||||
XmlNodeRef root = GetISystem()->LoadXmlFromFile(defaultTimeOfDayPath.c_str());
|
||||
if (root)
|
||||
{
|
||||
ITimeOfDay* pTimeOfDay = gEnv->p3DEngine ? gEnv->p3DEngine->GetTimeOfDay() : nullptr;
|
||||
if (pTimeOfDay)
|
||||
{
|
||||
pTimeOfDay->Serialize(root, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
@@ -2417,44 +2145,9 @@ void CCryEditDoc::InitEmptyLevel(int /*resolution*/, int /*unitSize*/, bool /*bU
|
||||
GetIEditor()->SetStatusText("Ready");
|
||||
}
|
||||
|
||||
void CCryEditDoc::CreateDefaultLevelAssets(int resolution, int unitSize)
|
||||
void CCryEditDoc::CreateDefaultLevelAssets([[maybe_unused]] int resolution, [[maybe_unused]] int unitSize)
|
||||
{
|
||||
if (AZ::Interface<AzFramework::AtomActiveInterface>::Get())
|
||||
{
|
||||
AzToolsFramework::EditorLevelNotificationBus::Broadcast(&AzToolsFramework::EditorLevelNotificationBus::Events::OnNewLevelCreated);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool isPrefabSystemEnabled = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(
|
||||
isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
|
||||
if (!isPrefabSystemEnabled)
|
||||
{
|
||||
AZ::Data::AssetCatalogRequestBus::BroadcastResult(
|
||||
m_envProbeSliceAssetId, &AZ::Data::AssetCatalogRequests::GetAssetIdByPath, m_envProbeSliceRelativePath,
|
||||
azrtti_typeid<AZ::SliceAsset>(), false);
|
||||
|
||||
if (m_envProbeSliceAssetId.IsValid())
|
||||
{
|
||||
AZ::Data::Asset<AZ::Data::AssetData> asset = AZ::Data::AssetManager::Instance().FindOrCreateAsset<AZ::SliceAsset>(
|
||||
m_envProbeSliceAssetId, AZ::Data::AssetLoadBehavior::Default);
|
||||
if (asset)
|
||||
{
|
||||
m_terrainSize = resolution * unitSize;
|
||||
const float halfTerrainSize = m_terrainSize / 2.0f;
|
||||
|
||||
AZ::Transform worldTransform = AZ::Transform::CreateIdentity();
|
||||
worldTransform = AZ::Transform::CreateTranslation(AZ::Vector3(halfTerrainSize, halfTerrainSize, m_envProbeHeight / 2));
|
||||
|
||||
AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler::BusConnect();
|
||||
GetIEditor()->SuspendUndo();
|
||||
AzToolsFramework::SliceEditorEntityOwnershipServiceRequestBus::Broadcast(
|
||||
&AzToolsFramework::SliceEditorEntityOwnershipServiceRequests::InstantiateEditorSlice, asset, worldTransform);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
AzToolsFramework::EditorLevelNotificationBus::Broadcast(&AzToolsFramework::EditorLevelNotificationBus::Events::OnNewLevelCreated);
|
||||
}
|
||||
|
||||
void CCryEditDoc::OnEnvironmentPropertyChanged(IVariable* pVar)
|
||||
@@ -2514,8 +2207,6 @@ void CCryEditDoc::OnEnvironmentPropertyChanged(IVariable* pVar)
|
||||
pVar->Get(value);
|
||||
childNode->setAttr("value", value.toUtf8().data());
|
||||
}
|
||||
|
||||
GetIEditor()->GetGameEngine()->ReloadEnvironment();
|
||||
}
|
||||
|
||||
QString CCryEditDoc::GetCryIndexPath(const LPCTSTR levelFilePath)
|
||||
@@ -2568,12 +2259,6 @@ void CCryEditDoc::ReleaseXmlArchiveArray(TDocMultiArchive& arrXmlAr)
|
||||
SAFE_DELETE(arrXmlAr[0]);
|
||||
}
|
||||
|
||||
|
||||
void CCryEditDoc::SyncCurrentMissionContent(bool bRetrieve)
|
||||
{
|
||||
GetCurrentMission()->SyncContent(bRetrieve, false);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// AzToolsFramework::EditorEntityContextNotificationBus interface implementation
|
||||
void CCryEditDoc::OnSliceInstantiated(const AZ::Data::AssetId& sliceAssetId, AZ::SliceComponent::SliceInstanceAddress& sliceAddress, const AzFramework::SliceInstantiationTicket& /*ticket*/)
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <TimeValue.h>
|
||||
#endif
|
||||
|
||||
class CMission;
|
||||
class CLevelShaderCache;
|
||||
class CClouds;
|
||||
struct LightingSettings;
|
||||
@@ -124,18 +123,6 @@ public: // Create from serialization only
|
||||
const char* GetTemporaryLevelName() const;
|
||||
void DeleteTemporaryLevel();
|
||||
|
||||
void ChangeMission();
|
||||
//! Return currently active Mission.
|
||||
CMission* GetCurrentMission(bool bSkipLoadingAIWhenSyncingContent = false);
|
||||
//! Get number of missions on Map.
|
||||
int GetMissionCount() const { return m_missions.size(); }
|
||||
//! Get Mission by index.
|
||||
CMission* GetMission(int index) const { return m_missions[index]; }
|
||||
//! Find Mission by name.
|
||||
CMission* FindMission(const QString& name) const;
|
||||
//! Makes specified mission current.
|
||||
void SetCurrentMission(CMission* mission);
|
||||
|
||||
CLevelShaderCache* GetShaderCache() { return m_pLevelShaderCache; }
|
||||
CClouds* GetClouds() { return m_pClouds; }
|
||||
void SetWaterColor(const QColor& col) { m_waterColor = col; }
|
||||
@@ -167,7 +154,6 @@ protected:
|
||||
|
||||
virtual void Load(TDocMultiArchive& arrXmlAr, const QString& szFilename);
|
||||
virtual void StartStreamingLoad(){}
|
||||
virtual void SyncCurrentMissionContent(bool bRetrieve);
|
||||
|
||||
void Save(CXmlArchive& xmlAr);
|
||||
void Load(CXmlArchive& xmlAr, const QString& szFilename);
|
||||
@@ -179,14 +165,8 @@ protected:
|
||||
bool LoadEntitiesFromSlice(const QString& sliceFile);
|
||||
void SerializeFogSettings(CXmlArchive& xmlAr);
|
||||
virtual void SerializeViewSettings(CXmlArchive& xmlAr);
|
||||
void SerializeMissions(TDocMultiArchive& arrXmlAr, QString& currentMission, bool bPartsInXml);
|
||||
void SerializeShaderCache(CXmlArchive& xmlAr);
|
||||
void SerializeNameSelection(CXmlArchive& xmlAr);
|
||||
void ForceSkyUpdate();
|
||||
//! Add new mission to map.
|
||||
void AddMission(CMission* mission);
|
||||
//! Remove existing mission from map.
|
||||
void RemoveMission(CMission* mission);
|
||||
void LogLoadTime(int time);
|
||||
|
||||
struct TSaveDocContext
|
||||
@@ -200,10 +180,8 @@ protected:
|
||||
|
||||
virtual bool OnSaveDocument(const QString& lpszPathName);
|
||||
virtual void OnFileSaveAs();
|
||||
void LoadTemplates();
|
||||
//! called immediately after saving the level.
|
||||
void AfterSave();
|
||||
void ClearMissions();
|
||||
void RegisterConsoleVariables();
|
||||
void OnStartLevelResourceList();
|
||||
static void OnValidateSurfaceTypesChanged(ICVar*);
|
||||
@@ -220,9 +198,7 @@ protected:
|
||||
QColor m_waterColor;
|
||||
XmlNodeRef m_fogTemplate;
|
||||
XmlNodeRef m_environmentTemplate;
|
||||
CMission* m_mission;
|
||||
CClouds* m_pClouds;
|
||||
std::vector<CMission*> m_missions;
|
||||
std::list<IDocListener*> m_listeners;
|
||||
bool m_bDocumentReady;
|
||||
CLevelShaderCache* m_pLevelShaderCache;
|
||||
|
||||
@@ -86,11 +86,6 @@ void CDisplaySettings::PostInitApply()
|
||||
void CDisplaySettings::SetRenderFlags(int flags)
|
||||
{
|
||||
m_renderFlags = flags;
|
||||
|
||||
if (!GetIEditor()->Get3DEngine())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -132,7 +132,6 @@
|
||||
#include <IRenderer.h>
|
||||
#include <CryFile.h>
|
||||
#include <ISystem.h>
|
||||
#include <I3DEngine.h>
|
||||
#include <IIndexedMesh.h>
|
||||
#include <ITimer.h>
|
||||
#include <IXml.h>
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
# include <AzFramework/Input/Buses/Notifications/RawInputNotificationBus_Platform.h>
|
||||
#endif // defined(AZ_PLATFORM_WINDOWS)
|
||||
#include <AzFramework/Input/Devices/Mouse/InputDeviceMouse.h> // for AzFramework::InputDeviceMouse
|
||||
#include <AzFramework/API/AtomActiveInterface.h>
|
||||
#include <AzFramework/Viewport/ViewportControllerList.h>
|
||||
|
||||
// AzQtComponents
|
||||
@@ -55,7 +54,6 @@
|
||||
#include <AtomToolsFramework/Viewport/RenderViewportWidget.h>
|
||||
|
||||
// CryCommon
|
||||
#include <CryCommon/I3DEngine.h>
|
||||
#include <CryCommon/HMDBus.h>
|
||||
|
||||
// AzFramework
|
||||
@@ -98,12 +96,25 @@
|
||||
|
||||
#include <QtGui/private/qhighdpiscaling_p.h>
|
||||
|
||||
#include <IEntityRenderState.h>
|
||||
#include <IPhysics.h>
|
||||
#include <IStatObj.h>
|
||||
|
||||
AZ_CVAR(
|
||||
bool, ed_visibility_logTiming, false, nullptr, AZ::ConsoleFunctorFlags::Null,
|
||||
"Output the timing of the new IVisibilitySystem query");
|
||||
|
||||
EditorViewportWidget* EditorViewportWidget::m_pPrimaryViewport = nullptr;
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
extern InputChannelId CameraFreeLookButton;
|
||||
extern InputChannelId CameraFreePanButton;
|
||||
extern InputChannelId CameraOrbitLookButton;
|
||||
extern InputChannelId CameraOrbitDollyButton;
|
||||
extern InputChannelId CameraOrbitPanButton;
|
||||
}
|
||||
|
||||
#if AZ_TRAIT_OS_PLATFORM_APPLE
|
||||
void StopFixedCursorMode();
|
||||
void StartFixedCursorMode(QObject *viewport);
|
||||
@@ -159,6 +170,7 @@ EditorViewportWidget::EditorViewportWidget(const QString& name, QWidget* parent)
|
||||
, m_camFOV(gSettings.viewports.fDefaultFov)
|
||||
, m_defaultViewName(name)
|
||||
, m_renderViewport(nullptr) //m_renderViewport is initialized later, in SetViewportId
|
||||
, m_editorViewportSettings(this)
|
||||
{
|
||||
// need this to be set in order to allow for language switching on Windows
|
||||
setAttribute(Qt::WA_InputMethodEnabled);
|
||||
@@ -251,11 +263,6 @@ void EditorViewportWidget::resizeEvent(QResizeEvent* event)
|
||||
|
||||
gEnv->pSystem->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_RESIZE, width(), height());
|
||||
|
||||
if (gEnv->pRenderer)
|
||||
{
|
||||
gEnv->pRenderer->EF_DisableTemporalEffects();
|
||||
}
|
||||
|
||||
// We queue the window resize event because the render overlay may be hidden.
|
||||
// If the render overlay is not visible, the native window that is backing it will
|
||||
// also be hidden, and it will not resize until it becomes visible.
|
||||
@@ -321,8 +328,8 @@ AzToolsFramework::ViewportInteraction::MousePick EditorViewportWidget::BuildMous
|
||||
using namespace AzToolsFramework::ViewportInteraction;
|
||||
|
||||
MousePick mousePick;
|
||||
mousePick.m_screenCoordinates = AzFramework::ScreenPoint(point.x(), point.y());
|
||||
const auto& ray = m_renderViewport->ViewportScreenToWorldRay(point);
|
||||
mousePick.m_screenCoordinates = ScreenPointFromQPoint(point);
|
||||
const auto& ray = m_renderViewport->ViewportScreenToWorldRay(mousePick.m_screenCoordinates);
|
||||
if (ray.has_value())
|
||||
{
|
||||
mousePick.m_rayOrigin = ray.value().origin;
|
||||
@@ -521,9 +528,6 @@ void EditorViewportWidget::Update()
|
||||
// Render
|
||||
{
|
||||
// TODO: Move out this logic to a controller and refactor to work with Atom
|
||||
// m_renderer->SetClearColor(Vec3(0.4f, 0.4f, 0.4f));
|
||||
// 3D engine stats
|
||||
GetIEditor()->GetSystem()->RenderBegin();
|
||||
|
||||
OnRender();
|
||||
|
||||
@@ -548,8 +552,6 @@ void EditorViewportWidget::Update()
|
||||
}
|
||||
}
|
||||
|
||||
GetIEditor()->GetSystem()->RenderEnd(m_bRenderStats);
|
||||
|
||||
gEnv->pSystem->SetViewCamera(CurCamera);
|
||||
}
|
||||
|
||||
@@ -1106,40 +1108,14 @@ AzFramework::CameraState EditorViewportWidget::GetCameraState()
|
||||
return m_renderViewport->GetCameraState();
|
||||
}
|
||||
|
||||
bool EditorViewportWidget::GridSnappingEnabled()
|
||||
{
|
||||
return GetViewManager()->GetGrid()->IsEnabled();
|
||||
}
|
||||
|
||||
float EditorViewportWidget::GridSize()
|
||||
{
|
||||
const CGrid* grid = GetViewManager()->GetGrid();
|
||||
return grid->scale * grid->size;
|
||||
}
|
||||
|
||||
bool EditorViewportWidget::ShowGrid()
|
||||
{
|
||||
return gSettings.viewports.bShowGridGuide;
|
||||
}
|
||||
|
||||
bool EditorViewportWidget::AngleSnappingEnabled()
|
||||
{
|
||||
return GetViewManager()->GetGrid()->IsAngleSnapEnabled();
|
||||
}
|
||||
|
||||
float EditorViewportWidget::AngleStep()
|
||||
{
|
||||
return GetViewManager()->GetGrid()->GetAngleSnap();
|
||||
}
|
||||
|
||||
AZ::Vector3 EditorViewportWidget::PickTerrain(const QPoint& point)
|
||||
AZ::Vector3 EditorViewportWidget::PickTerrain(const AzFramework::ScreenPoint& point)
|
||||
{
|
||||
FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
|
||||
|
||||
return LYVec3ToAZVec3(ViewToWorld(point, nullptr, true));
|
||||
return LYVec3ToAZVec3(ViewToWorld(AzToolsFramework::ViewportInteraction::QPointFromScreenPoint(point), nullptr, true));
|
||||
}
|
||||
|
||||
AZ::EntityId EditorViewportWidget::PickEntity(const QPoint& point)
|
||||
AZ::EntityId EditorViewportWidget::PickEntity(const AzFramework::ScreenPoint& point)
|
||||
{
|
||||
FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
|
||||
|
||||
@@ -1148,7 +1124,7 @@ AZ::EntityId EditorViewportWidget::PickEntity(const QPoint& point)
|
||||
AZ::EntityId entityId;
|
||||
HitContext hitInfo;
|
||||
hitInfo.view = this;
|
||||
if (HitTest(point, hitInfo))
|
||||
if (HitTest(AzToolsFramework::ViewportInteraction::QPointFromScreenPoint(point), hitInfo))
|
||||
{
|
||||
if (hitInfo.object && (hitInfo.object->GetType() == OBJTYPE_AZENTITY))
|
||||
{
|
||||
@@ -1174,7 +1150,7 @@ void EditorViewportWidget::FindVisibleEntities(AZStd::vector<AZ::EntityId>& visi
|
||||
visibleEntitiesOut.assign(m_entityVisibilityQuery.Begin(), m_entityVisibilityQuery.End());
|
||||
}
|
||||
|
||||
QPoint EditorViewportWidget::ViewportWorldToScreen(const AZ::Vector3& worldPosition)
|
||||
AzFramework::ScreenPoint EditorViewportWidget::ViewportWorldToScreen(const AZ::Vector3& worldPosition)
|
||||
{
|
||||
return m_renderViewport->ViewportWorldToScreen(worldPosition);
|
||||
}
|
||||
@@ -1234,13 +1210,48 @@ void EditorViewportWidget::SetViewportId(int id)
|
||||
|
||||
if (ed_useNewCameraSystem)
|
||||
{
|
||||
m_renderViewport->GetControllerList()->Add(AZStd::make_shared<SandboxEditor::ModernViewportCameraController>());
|
||||
AzFramework::ReloadCameraKeyBindings();
|
||||
|
||||
auto controller = AZStd::make_shared<SandboxEditor::ModernViewportCameraController>();
|
||||
controller->SetCameraListBuilderCallback([](AzFramework::Cameras& cameras)
|
||||
{
|
||||
auto firstPersonRotateCamera = AZStd::make_shared<AzFramework::RotateCameraInput>(AzFramework::CameraFreeLookButton);
|
||||
auto firstPersonPanCamera =
|
||||
AZStd::make_shared<AzFramework::PanCameraInput>(AzFramework::CameraFreePanButton, AzFramework::LookPan);
|
||||
auto firstPersonTranslateCamera = AZStd::make_shared<AzFramework::TranslateCameraInput>(AzFramework::LookTranslation);
|
||||
auto firstPersonWheelCamera = AZStd::make_shared<AzFramework::ScrollTranslationCameraInput>();
|
||||
|
||||
auto orbitCamera = AZStd::make_shared<AzFramework::OrbitCameraInput>();
|
||||
auto orbitRotateCamera = AZStd::make_shared<AzFramework::RotateCameraInput>(AzFramework::CameraOrbitLookButton);
|
||||
auto orbitTranslateCamera = AZStd::make_shared<AzFramework::TranslateCameraInput>(AzFramework::OrbitTranslation);
|
||||
auto orbitDollyWheelCamera = AZStd::make_shared<AzFramework::OrbitDollyScrollCameraInput>();
|
||||
auto orbitDollyMoveCamera =
|
||||
AZStd::make_shared<AzFramework::OrbitDollyCursorMoveCameraInput>(AzFramework::CameraOrbitDollyButton);
|
||||
auto orbitPanCamera =
|
||||
AZStd::make_shared<AzFramework::PanCameraInput>(AzFramework::CameraOrbitPanButton, AzFramework::OrbitPan);
|
||||
|
||||
orbitCamera->m_orbitCameras.AddCamera(orbitRotateCamera);
|
||||
orbitCamera->m_orbitCameras.AddCamera(orbitTranslateCamera);
|
||||
orbitCamera->m_orbitCameras.AddCamera(orbitDollyWheelCamera);
|
||||
orbitCamera->m_orbitCameras.AddCamera(orbitDollyMoveCamera);
|
||||
orbitCamera->m_orbitCameras.AddCamera(orbitPanCamera);
|
||||
|
||||
cameras.AddCamera(firstPersonRotateCamera);
|
||||
cameras.AddCamera(firstPersonPanCamera);
|
||||
cameras.AddCamera(firstPersonTranslateCamera);
|
||||
cameras.AddCamera(firstPersonWheelCamera);
|
||||
cameras.AddCamera(orbitCamera);
|
||||
});
|
||||
|
||||
m_renderViewport->GetControllerList()->Add(controller);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_renderViewport->GetControllerList()->Add(AZStd::make_shared<SandboxEditor::LegacyViewportCameraController>());
|
||||
}
|
||||
|
||||
m_renderViewport->SetViewportSettings(&m_editorViewportSettings);
|
||||
|
||||
UpdateScene();
|
||||
|
||||
if (m_pPrimaryViewport == this)
|
||||
@@ -1305,26 +1316,8 @@ namespace AZ::ViewportHelpers
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void EditorViewportWidget::OnTitleMenu(QMenu* menu)
|
||||
{
|
||||
const int nWireframe = gEnv->pConsole->GetCVar("r_wireframe")->GetIVal();
|
||||
QAction* action = menu->addAction(tr("Wireframe"));
|
||||
connect(action, &QAction::triggered, action, []()
|
||||
{
|
||||
ICVar* piVar(gEnv->pConsole->GetCVar("r_wireframe"));
|
||||
int nRenderMode = piVar->GetIVal();
|
||||
if (nRenderMode != R_WIREFRAME_MODE)
|
||||
{
|
||||
piVar->Set(R_WIREFRAME_MODE);
|
||||
}
|
||||
else
|
||||
{
|
||||
piVar->Set(R_SOLID_MODE);
|
||||
}
|
||||
});
|
||||
action->setCheckable(true);
|
||||
action->setChecked(nWireframe == R_WIREFRAME_MODE);
|
||||
|
||||
const bool bDisplayLabels = GetIEditor()->GetDisplaySettings()->IsDisplayLabels();
|
||||
action = menu->addAction(tr("Labels"));
|
||||
QAction* action = menu->addAction(tr("Labels"));
|
||||
connect(action, &QAction::triggered, this, [bDisplayLabels] {GetIEditor()->GetDisplaySettings()->DisplayLabels(!bDisplayLabels);
|
||||
});
|
||||
action->setCheckable(true);
|
||||
@@ -1556,7 +1549,6 @@ void EditorViewportWidget::ToggleCameraObject()
|
||||
{
|
||||
if (m_viewSourceType == ViewSourceType::SequenceCamera)
|
||||
{
|
||||
gEnv->p3DEngine->GetPostEffectBaseGroup()->SetParam("Dof_Active", 0.0f);
|
||||
ResetToViewSourceType(ViewSourceType::LegacyCamera);
|
||||
}
|
||||
else
|
||||
@@ -2001,7 +1993,7 @@ Vec3 EditorViewportWidget::WorldToView3D(const Vec3& wp, [[maybe_unused]] int nF
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QPoint EditorViewportWidget::WorldToView(const Vec3& wp) const
|
||||
{
|
||||
return m_renderViewport->ViewportWorldToScreen(LYVec3ToAZVec3(wp));
|
||||
return AzToolsFramework::ViewportInteraction::QPointFromScreenPoint(m_renderViewport->ViewportWorldToScreen(LYVec3ToAZVec3(wp)));
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QPoint EditorViewportWidget::WorldToViewParticleEditor(const Vec3& wp, int width, int height) const
|
||||
@@ -2023,7 +2015,8 @@ QPoint EditorViewportWidget::WorldToViewParticleEditor(const Vec3& wp, int width
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
Vec3 EditorViewportWidget::ViewToWorld(const QPoint& vp, bool* collideWithTerrain, bool onlyTerrain, bool bSkipVegetation, bool bTestRenderMesh, bool* collideWithObject) const
|
||||
Vec3 EditorViewportWidget::ViewToWorld(
|
||||
const QPoint& vp, bool* collideWithTerrain, bool onlyTerrain, bool bSkipVegetation, bool bTestRenderMesh, bool* collideWithObject) const
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
|
||||
|
||||
@@ -2034,7 +2027,7 @@ Vec3 EditorViewportWidget::ViewToWorld(const QPoint& vp, bool* collideWithTerrai
|
||||
AZ_UNUSED(bSkipVegetation)
|
||||
AZ_UNUSED(collideWithObject)
|
||||
|
||||
auto ray = m_renderViewport->ViewportScreenToWorldRay(vp);
|
||||
auto ray = m_renderViewport->ViewportScreenToWorldRay(AzToolsFramework::ViewportInteraction::ScreenPointFromQPoint(vp));
|
||||
if (!ray.has_value())
|
||||
{
|
||||
return Vec3(0, 0, 0);
|
||||
@@ -2135,23 +2128,29 @@ bool EditorViewportWidget::AdjustObjectPosition(const ray_hit& hit, Vec3& outNor
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool EditorViewportWidget::RayRenderMeshIntersection(IRenderMesh* pRenderMesh, const Vec3& vInPos, const Vec3& vInDir, Vec3& vOutPos, Vec3& vOutNormal) const
|
||||
{
|
||||
SRayHitInfo hitInfo;
|
||||
AZ_UNUSED(pRenderMesh);
|
||||
AZ_UNUSED(vInPos);
|
||||
AZ_UNUSED(vInDir);
|
||||
AZ_UNUSED(vOutPos);
|
||||
AZ_UNUSED(vOutNormal);
|
||||
return false;
|
||||
/*SRayHitInfo hitInfo;
|
||||
hitInfo.bUseCache = false;
|
||||
hitInfo.bInFirstHit = false;
|
||||
hitInfo.inRay.origin = vInPos;
|
||||
hitInfo.inRay.direction = vInDir.GetNormalized();
|
||||
hitInfo.inReferencePoint = vInPos;
|
||||
hitInfo.fMaxHitDistance = 0;
|
||||
bool bRes = GetIEditor()->Get3DEngine()->RenderMeshRayIntersection(pRenderMesh, hitInfo, nullptr);
|
||||
bool bRes = ???->RenderMeshRayIntersection(pRenderMesh, hitInfo, nullptr);
|
||||
vOutPos = hitInfo.vHitPos;
|
||||
vOutNormal = hitInfo.vHitNormal;
|
||||
return bRes;
|
||||
return bRes;*/
|
||||
}
|
||||
|
||||
void EditorViewportWidget::UnProjectFromScreen(float sx, float sy, float sz, float* px, float* py, float* pz) const
|
||||
{
|
||||
AZ::Vector3 wp;
|
||||
wp = m_renderViewport->ViewportScreenToWorld({(int)sx, m_rcClient.bottom() - ((int)sy)}, sz).value_or(wp);
|
||||
wp = m_renderViewport->ViewportScreenToWorld(AzFramework::ScreenPoint{(int)sx, m_rcClient.bottom() - ((int)sy)}, sz).value_or(wp);
|
||||
*px = wp.GetX();
|
||||
*py = wp.GetY();
|
||||
*pz = wp.GetZ();
|
||||
@@ -2159,9 +2158,9 @@ void EditorViewportWidget::UnProjectFromScreen(float sx, float sy, float sz, flo
|
||||
|
||||
void EditorViewportWidget::ProjectToScreen(float ptx, float pty, float ptz, float* sx, float* sy, float* sz) const
|
||||
{
|
||||
QPoint screenPosition = m_renderViewport->ViewportWorldToScreen(AZ::Vector3{ptx, pty, ptz});
|
||||
*sx = screenPosition.x();
|
||||
*sy = screenPosition.y();
|
||||
AzFramework::ScreenPoint screenPosition = m_renderViewport->ViewportWorldToScreen(AZ::Vector3{ptx, pty, ptz});
|
||||
*sx = screenPosition.m_x;
|
||||
*sy = screenPosition.m_y;
|
||||
*sz = 0.f;
|
||||
}
|
||||
|
||||
@@ -2416,10 +2415,6 @@ void EditorViewportWidget::SetDefaultCamera()
|
||||
return;
|
||||
}
|
||||
ResetToViewSourceType(ViewSourceType::None);
|
||||
if (gEnv->p3DEngine)
|
||||
{
|
||||
gEnv->p3DEngine->GetPostEffectBaseGroup()->SetParam("Dof_Active", 0.0f);
|
||||
}
|
||||
GetViewManager()->SetCameraObjectId(m_cameraObjectId);
|
||||
SetName(m_defaultViewName);
|
||||
SetViewTM(m_defaultViewTM);
|
||||
@@ -2876,4 +2871,35 @@ void EditorViewportWidget::SetAsActiveViewport()
|
||||
}
|
||||
}
|
||||
|
||||
EditorViewportSettings::EditorViewportSettings(const EditorViewportWidget* editorViewportWidget)
|
||||
: m_editorViewportWidget(editorViewportWidget)
|
||||
{
|
||||
}
|
||||
|
||||
bool EditorViewportSettings::GridSnappingEnabled() const
|
||||
{
|
||||
return m_editorViewportWidget->GetViewManager()->GetGrid()->IsEnabled();
|
||||
}
|
||||
|
||||
float EditorViewportSettings::GridSize() const
|
||||
{
|
||||
const CGrid* grid = m_editorViewportWidget->GetViewManager()->GetGrid();
|
||||
return grid->scale * grid->size;
|
||||
}
|
||||
|
||||
bool EditorViewportSettings::ShowGrid() const
|
||||
{
|
||||
return gSettings.viewports.bShowGridGuide;
|
||||
}
|
||||
|
||||
bool EditorViewportSettings::AngleSnappingEnabled() const
|
||||
{
|
||||
return m_editorViewportWidget->GetViewManager()->GetGrid()->IsAngleSnapEnabled();
|
||||
}
|
||||
|
||||
float EditorViewportSettings::AngleStep() const
|
||||
{
|
||||
return m_editorViewportWidget->GetViewManager()->GetGrid()->GetAngleSnap();
|
||||
}
|
||||
|
||||
#include <moc_EditorViewportWidget.cpp>
|
||||
|
||||
@@ -65,6 +65,23 @@ namespace AzToolsFramework
|
||||
class ManipulatorManager;
|
||||
}
|
||||
|
||||
class EditorViewportWidget;
|
||||
|
||||
//! Viewport settings for the EditorViewportWidget
|
||||
struct EditorViewportSettings : public AzToolsFramework::ViewportInteraction::ViewportSettings
|
||||
{
|
||||
explicit EditorViewportSettings(const EditorViewportWidget* editorViewportWidget);
|
||||
|
||||
bool GridSnappingEnabled() const override;
|
||||
float GridSize() const override;
|
||||
bool ShowGrid() const override;
|
||||
bool AngleSnappingEnabled() const override;
|
||||
float AngleStep() const override;
|
||||
|
||||
private:
|
||||
const EditorViewportWidget* m_editorViewportWidget = nullptr;
|
||||
};
|
||||
|
||||
// EditorViewportWidget window
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
@@ -189,22 +206,16 @@ public:
|
||||
virtual void OnStartPlayInEditor();
|
||||
virtual void OnStopPlayInEditor();
|
||||
|
||||
// AzToolsFramework::ViewportInteractionRequestBus
|
||||
AzFramework::CameraState GetCameraState();
|
||||
bool GridSnappingEnabled();
|
||||
float GridSize();
|
||||
bool ShowGrid();
|
||||
bool AngleSnappingEnabled();
|
||||
float AngleStep();
|
||||
QPoint ViewportWorldToScreen(const AZ::Vector3& worldPosition);
|
||||
AzFramework::ScreenPoint ViewportWorldToScreen(const AZ::Vector3& worldPosition);
|
||||
|
||||
// AzToolsFramework::ViewportFreezeRequestBus
|
||||
bool IsViewportInputFrozen() override;
|
||||
void FreezeViewportInput(bool freeze) override;
|
||||
|
||||
// AzToolsFramework::MainEditorViewportInteractionRequestBus
|
||||
AZ::EntityId PickEntity(const QPoint& point) override;
|
||||
AZ::Vector3 PickTerrain(const QPoint& point) override;
|
||||
AZ::EntityId PickEntity(const AzFramework::ScreenPoint& point) override;
|
||||
AZ::Vector3 PickTerrain(const AzFramework::ScreenPoint& point) override;
|
||||
float TerrainHeight(const AZ::Vector2& position) override;
|
||||
void FindVisibleEntities(AZStd::vector<AZ::EntityId>& visibleEntitiesOut) override;
|
||||
bool ShowingWorldSpace() override;
|
||||
@@ -481,10 +492,6 @@ protected:
|
||||
OBB m_GroundOBB;
|
||||
Vec3 m_GroundOBBPos;
|
||||
|
||||
//-------------------------------------------
|
||||
// Render options.
|
||||
bool m_bRenderStats = true;
|
||||
|
||||
// Index of camera objects.
|
||||
mutable GUID m_cameraObjectId;
|
||||
mutable AZ::EntityId m_viewEntityId;
|
||||
@@ -557,8 +564,7 @@ private:
|
||||
void PushDisableRendering();
|
||||
void PopDisableRendering();
|
||||
bool IsRenderingDisabled() const;
|
||||
AzToolsFramework::ViewportInteraction::MousePick BuildMousePickInternal(
|
||||
const QPoint& point) const;
|
||||
AzToolsFramework::ViewportInteraction::MousePick BuildMousePickInternal(const QPoint& point) const;
|
||||
|
||||
void RestoreViewportAfterGameMode();
|
||||
void UpdateCameraFromViewportContext();
|
||||
@@ -601,5 +607,7 @@ private:
|
||||
|
||||
AZ::Name m_defaultViewportContextName;
|
||||
|
||||
EditorViewportSettings m_editorViewportSettings;
|
||||
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
};
|
||||
|
||||
@@ -1,53 +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 "EnvironmentPanel.h"
|
||||
|
||||
// Editor
|
||||
#include "GameEngine.h"
|
||||
#include "CryEditDoc.h"
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
#include <ui_EnvironmentPanel.h>
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CEnvironmentPanel dialog
|
||||
|
||||
CEnvironmentPanel::CEnvironmentPanel(QWidget* pParent /*=nullptr*/)
|
||||
: QWidget(pParent)
|
||||
, ui(new Ui::CEnvironmentPanel)
|
||||
{
|
||||
XmlNodeRef node = GetIEditor()->GetDocument()->GetEnvironmentTemplate();
|
||||
|
||||
m_onSetCallback = AZStd::bind(&CCryEditDoc::OnEnvironmentPropertyChanged, GetIEditor()->GetDocument(), AZStd::placeholders::_1);
|
||||
|
||||
ui->setupUi(this);
|
||||
ui->m_wndProps->Setup();
|
||||
ui->m_wndProps->CreateItems(node, m_varBlock, &m_onSetCallback, true);
|
||||
ui->m_wndProps->RebuildCtrl(false);
|
||||
ui->m_wndProps->ExpandAll();
|
||||
connect(ui->APPLYBTN, &QPushButton::clicked, this, &CEnvironmentPanel::OnBnClickedApply);
|
||||
}
|
||||
|
||||
CEnvironmentPanel::~CEnvironmentPanel()
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CEnvironmentPanel::OnBnClickedApply()
|
||||
{
|
||||
GetIEditor()->GetGameEngine()->ReloadEnvironment();
|
||||
}
|
||||
@@ -1,53 +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_ENVIRONMENTPANEL_H
|
||||
#define CRYINCLUDE_EDITOR_ENVIRONMENTPANEL_H
|
||||
|
||||
#pragma once
|
||||
// EnvironmentPanel.h : header file
|
||||
//
|
||||
|
||||
#include "Util/Variable.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QScopedPointer>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CEnvironmentPanel dialog
|
||||
namespace Ui {
|
||||
class CEnvironmentPanel;
|
||||
}
|
||||
|
||||
class CEnvironmentPanel
|
||||
: public QWidget
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CEnvironmentPanel(QWidget* pParent = nullptr); // standard constructor
|
||||
~CEnvironmentPanel();
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
CVarBlockPtr m_varBlock;
|
||||
|
||||
public:
|
||||
void OnBnClickedApply();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CEnvironmentPanel> ui;
|
||||
|
||||
IVariable::OnSetCallback m_onSetCallback;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_ENVIRONMENTPANEL_H
|
||||
@@ -1,56 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CEnvironmentPanel</class>
|
||||
<widget class="QWidget" name="CEnvironmentPanel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>264</width>
|
||||
<height>259</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="ReflectedPropertyControl" name="m_wndProps" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="APPLYBTN">
|
||||
<property name="text">
|
||||
<string>Apply</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>162</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ReflectedPropertyControl</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <Maestro/Types/AnimParamType.h>
|
||||
|
||||
// Editor
|
||||
#include "Geometry/EdGeometry.h"
|
||||
#include "ViewManager.h"
|
||||
#include "OBJExporter.h"
|
||||
#include "OCMExporter.h"
|
||||
@@ -41,6 +40,9 @@
|
||||
#include "Resource.h"
|
||||
#include "Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.h"
|
||||
|
||||
#include <IEntityRenderState.h>
|
||||
#include <IStatObj.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
void SetTexture(Export::TPath& outName, IRenderShaderResources* pRes, int nSlot)
|
||||
@@ -494,53 +496,6 @@ bool CExportManager::AddStatObj(Export::CObject* pObj, IStatObj* pStatObj, Matri
|
||||
|
||||
bool CExportManager::AddMeshes(Export::CObject* pObj)
|
||||
{
|
||||
CEdGeometry* pEdGeom = m_pBaseObj->GetGeometry();
|
||||
IIndexedMesh* pIndMesh = 0;
|
||||
|
||||
if (pEdGeom)
|
||||
{
|
||||
size_t idx = 0;
|
||||
size_t nextIdx = 0;
|
||||
do
|
||||
{
|
||||
pIndMesh = 0;
|
||||
if (m_isOccluder)
|
||||
{
|
||||
if (pEdGeom->GetIStatObj() && pEdGeom->GetIStatObj()->GetLodObject(2))
|
||||
{
|
||||
pIndMesh = pEdGeom->GetIStatObj()->GetLodObject(2)->GetIndexedMesh(true);
|
||||
}
|
||||
if (!pIndMesh && pEdGeom->GetIStatObj() && pEdGeom->GetIStatObj()->GetLodObject(1))
|
||||
{
|
||||
pIndMesh = pEdGeom->GetIStatObj()->GetLodObject(1)->GetIndexedMesh(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (!pIndMesh)
|
||||
{
|
||||
pIndMesh = pEdGeom->GetIndexedMesh(idx);
|
||||
nextIdx++;
|
||||
}
|
||||
|
||||
if (!pIndMesh)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Matrix34 tm;
|
||||
pEdGeom->GetTM(&tm, idx);
|
||||
Matrix34A objTM = tm;
|
||||
AddMesh(pObj, pIndMesh, &objTM);
|
||||
idx = nextIdx;
|
||||
}
|
||||
while (pIndMesh && idx);
|
||||
|
||||
if (idx > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_pBaseObj->GetType() == OBJTYPE_AZENTITY)
|
||||
{
|
||||
CEntityObject* pEntityObject = (CEntityObject*)m_pBaseObj;
|
||||
@@ -548,11 +503,7 @@ bool CExportManager::AddMeshes(Export::CObject* pObj)
|
||||
|
||||
if (pEngineNode)
|
||||
{
|
||||
if (m_isPrecaching)
|
||||
{
|
||||
GetIEditor()->Get3DEngine()->PrecacheRenderNode(pEngineNode, 0);
|
||||
}
|
||||
else
|
||||
if (!m_isPrecaching)
|
||||
{
|
||||
for (int i = 0; i < pEngineNode->GetSlotCount(); ++i)
|
||||
{
|
||||
@@ -1091,35 +1042,6 @@ bool CExportManager::AddSelectedEntityObjects()
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CExportManager::AddSelectedObjects()
|
||||
{
|
||||
CSelectionGroup* pSelection = GetIEditor()->GetSelection();
|
||||
|
||||
int numObjects = pSelection->GetCount();
|
||||
if (numObjects > m_data.m_objects.size())
|
||||
{
|
||||
m_data.m_objects.reserve(numObjects + 1); // +1 for terrain
|
||||
}
|
||||
// First run pipeline to precache geometry
|
||||
m_isPrecaching = true;
|
||||
for (int i = 0; i < numObjects; i++)
|
||||
{
|
||||
AddObject(pSelection->GetObject(i));
|
||||
}
|
||||
|
||||
GetIEditor()->Get3DEngine()->ProposeContentPrecache();
|
||||
|
||||
// Repeat pipeline to collect geometry
|
||||
m_isPrecaching = false;
|
||||
for (int i = 0; i < numObjects; i++)
|
||||
{
|
||||
AddObject(pSelection->GetObject(i));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CExportManager::AddSelectedRegionObjects()
|
||||
{
|
||||
AABB box;
|
||||
@@ -1144,8 +1066,6 @@ bool CExportManager::AddSelectedRegionObjects()
|
||||
AddObject(objects[i]);
|
||||
}
|
||||
|
||||
GetIEditor()->Get3DEngine()->ProposeContentPrecache();
|
||||
|
||||
// Repeat pipeline to collect geometry
|
||||
m_isPrecaching = false;
|
||||
for (size_t i = 0; i < numObjects; ++i)
|
||||
@@ -1185,7 +1105,7 @@ bool CExportManager::ExportToFile(const char* filename, bool bClearDataAfterExpo
|
||||
}
|
||||
|
||||
|
||||
bool CExportManager::Export(const char* defaultName, const char* defaultExt, const char* defaultPath, bool isSelectedObjects, bool isSelectedRegionObjects, bool isOccluder, bool bAnimationExport)
|
||||
bool CExportManager::Export(const char* defaultName, const char* defaultExt, const char* defaultPath, [[maybe_unused]] bool isSelectedObjects, bool isSelectedRegionObjects, bool isOccluder, bool bAnimationExport)
|
||||
{
|
||||
m_bAnimationExport = bAnimationExport;
|
||||
|
||||
@@ -1229,10 +1149,6 @@ bool CExportManager::Export(const char* defaultName, const char* defaultExt, con
|
||||
if (m_bAnimationExport || CFileUtil::SelectSaveFile(filters, defaultExt, defaultPath, newFilename))
|
||||
{
|
||||
WaitCursor wait;
|
||||
if (isSelectedObjects)
|
||||
{
|
||||
AddSelectedObjects();
|
||||
}
|
||||
if (isSelectedRegionObjects)
|
||||
{
|
||||
AddSelectedRegionObjects();
|
||||
|
||||
@@ -128,10 +128,6 @@ public:
|
||||
bool Export(const char* defaultName, const char* defaultExt = "", const char* defaultPath = "", bool isSelectedObjects = true,
|
||||
bool isSelectedRegionObjects = false, bool isOccluder = false, bool bAnimationExport = false);
|
||||
|
||||
//! Add to Export Data geometry from selected objects
|
||||
//! return true if succeed, otherwise false
|
||||
bool AddSelectedObjects();
|
||||
|
||||
bool AddSelectedEntityObjects();
|
||||
|
||||
//! Add to Export Data geometry from objects inside selected region volume
|
||||
|
||||
@@ -34,15 +34,11 @@
|
||||
// Editor
|
||||
#include "IEditorImpl.h"
|
||||
#include "CryEditDoc.h"
|
||||
#include "Geometry/EdMesh.h"
|
||||
#include "Mission.h"
|
||||
#include "Settings.h"
|
||||
|
||||
// CryCommon
|
||||
#include <CryCommon/I3DEngine.h>
|
||||
#include <CryCommon/INavigationSystem.h>
|
||||
#include <CryCommon/IDeferredCollisionEvent.h>
|
||||
#include <CryCommon/ITimeOfDay.h>
|
||||
#include <CryCommon/LyShine/ILyShine.h>
|
||||
#include <CryCommon/MainThreadRenderRequestBus.h>
|
||||
|
||||
@@ -283,7 +279,6 @@ AZ_POP_DISABLE_WARNING
|
||||
AZ::Interface<IEditorCameraController>::Unregister(this);
|
||||
GetIEditor()->UnregisterNotifyListener(this);
|
||||
m_pISystem->GetIMovieSystem()->SetCallback(NULL);
|
||||
CEdMesh::ReleaseAll();
|
||||
|
||||
if (m_gameDll)
|
||||
{
|
||||
@@ -493,13 +488,6 @@ AZ::Outcome<void, AZStd::string> CGameEngine::Init(
|
||||
|
||||
SetEditorCoreEnvironment(gEnv);
|
||||
|
||||
if (gEnv
|
||||
&& gEnv->p3DEngine
|
||||
&& gEnv->p3DEngine->GetTimeOfDay())
|
||||
{
|
||||
gEnv->p3DEngine->GetTimeOfDay()->BeginEditMode();
|
||||
}
|
||||
|
||||
if (gEnv && gEnv->pMovieSystem)
|
||||
{
|
||||
gEnv->pMovieSystem->EnablePhysicsEvents(m_bSimulationMode);
|
||||
@@ -549,26 +537,14 @@ void CGameEngine::SetLevelPath(const QString& path)
|
||||
{
|
||||
m_levelExtension = defaultExtension;
|
||||
}
|
||||
|
||||
if (gEnv->p3DEngine)
|
||||
{
|
||||
gEnv->p3DEngine->SetLevelPath(m_levelPath.toUtf8().data());
|
||||
}
|
||||
}
|
||||
|
||||
void CGameEngine::SetMissionName(const QString& mission)
|
||||
{
|
||||
m_missionName = mission;
|
||||
}
|
||||
|
||||
bool CGameEngine::LoadLevel(
|
||||
const QString& mission,
|
||||
[[maybe_unused]] bool bDeleteAIGraph,
|
||||
bool bReleaseResources)
|
||||
{
|
||||
LOADING_TIME_PROFILE_SECTION(GetIEditor()->GetSystem());
|
||||
m_bLevelLoaded = false;
|
||||
m_missionName = mission;
|
||||
CLogFile::FormatLine("Loading map '%s' into engine...", m_levelPath.toUtf8().data());
|
||||
// Switch the current directory back to the Primary CD folder first.
|
||||
// The engine might have trouble to find some files when the current
|
||||
@@ -607,30 +583,17 @@ bool CGameEngine::LoadLevel(
|
||||
|
||||
}
|
||||
|
||||
// Load level in 3d engine.
|
||||
if (gEnv->p3DEngine && !gEnv->p3DEngine->InitLevelForEditor(m_levelPath.toUtf8().data(), m_missionName.toUtf8().data()))
|
||||
{
|
||||
CLogFile::WriteLine("ERROR: Can't load level !");
|
||||
QMessageBox::critical(QApplication::activeWindow(), QString(), QObject::tr("ERROR: Can't load level !"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Audio: notify audio of level loading start?
|
||||
GetIEditor()->GetObjectManager()->SendEvent(EVENT_REFRESH);
|
||||
|
||||
m_bLevelLoaded = true;
|
||||
|
||||
if (!bReleaseResources)
|
||||
{
|
||||
ReloadEnvironment();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGameEngine::ReloadLevel()
|
||||
{
|
||||
if (!LoadLevel(GetMissionName(), false, false))
|
||||
if (!LoadLevel(false, false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -638,61 +601,8 @@ bool CGameEngine::ReloadLevel()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGameEngine::LoadMission(const QString& mission)
|
||||
{
|
||||
if (!IsLevelLoaded())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mission != m_missionName)
|
||||
{
|
||||
m_missionName = mission;
|
||||
gEnv->p3DEngine->LoadMissionDataFromXMLNode(m_missionName.toUtf8().data());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGameEngine::ReloadEnvironment()
|
||||
{
|
||||
if (!gEnv->p3DEngine)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IsLevelLoaded() && !m_bJustCreated)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!GetIEditor()->GetDocument())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
XmlNodeRef env = XmlHelpers::CreateXmlNode("Environment");
|
||||
CXmlTemplate::SetValues(GetIEditor()->GetDocument()->GetEnvironmentTemplate(), env);
|
||||
|
||||
// Notify mission that environment may be changed.
|
||||
GetIEditor()->GetDocument()->GetCurrentMission()->OnEnvironmentChange();
|
||||
|
||||
QString xmlStr = QString::fromLatin1(env->getXML());
|
||||
|
||||
// Reload level data in engine.
|
||||
gEnv->p3DEngine->LoadEnvironmentSettingsFromXML(env);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CGameEngine::SwitchToInGame()
|
||||
{
|
||||
if (gEnv->p3DEngine)
|
||||
{
|
||||
gEnv->p3DEngine->DisablePostEffects();
|
||||
gEnv->p3DEngine->ResetPostEffects();
|
||||
}
|
||||
|
||||
auto streamer = AZ::Interface<AZ::IO::IStreamer>::Get();
|
||||
if (streamer)
|
||||
{
|
||||
@@ -707,11 +617,6 @@ void CGameEngine::SwitchToInGame()
|
||||
|
||||
m_pISystem->SetThreadState(ESubsys_Physics, false);
|
||||
|
||||
if (gEnv->p3DEngine)
|
||||
{
|
||||
gEnv->p3DEngine->ResetParticlesAndDecals();
|
||||
}
|
||||
|
||||
m_pISystem->GetIMovieSystem()->EnablePhysicsEvents(true);
|
||||
m_bInGameMode = true;
|
||||
|
||||
@@ -721,10 +626,6 @@ void CGameEngine::SwitchToInGame()
|
||||
pRuler->SetActive(false);
|
||||
}
|
||||
|
||||
if (gEnv->p3DEngine)
|
||||
{
|
||||
gEnv->p3DEngine->GetTimeOfDay()->EndEditMode();
|
||||
}
|
||||
gEnv->pSystem->GetViewCamera().SetMatrix(m_playerViewTM);
|
||||
|
||||
// Disable accelerators.
|
||||
@@ -760,24 +661,9 @@ void CGameEngine::SwitchToInEditor()
|
||||
|
||||
m_pISystem->SetThreadState(ESubsys_Physics, false);
|
||||
|
||||
if (gEnv->p3DEngine)
|
||||
{
|
||||
// Reset 3d engine effects
|
||||
gEnv->p3DEngine->DisablePostEffects();
|
||||
gEnv->p3DEngine->ResetPostEffects();
|
||||
gEnv->p3DEngine->ResetParticlesAndDecals();
|
||||
}
|
||||
|
||||
CViewport* pGameViewport = GetIEditor()->GetViewManager()->GetGameViewport();
|
||||
|
||||
m_pISystem->GetIMovieSystem()->EnablePhysicsEvents(m_bSimulationMode);
|
||||
if (gEnv->p3DEngine)
|
||||
{
|
||||
gEnv->p3DEngine->GetTimeOfDay()->BeginEditMode();
|
||||
|
||||
// this has to be done before the RemoveSink() call, or else some entities may not be removed
|
||||
gEnv->p3DEngine->GetDeferredPhysicsEventManager()->ClearDeferredEvents();
|
||||
}
|
||||
|
||||
// Enable accelerators.
|
||||
GetIEditor()->EnableAcceleratos(true);
|
||||
@@ -865,7 +751,6 @@ void CGameEngine::SetGameMode(bool bInGame)
|
||||
|
||||
// Ignore updates while changing in and out of game mode
|
||||
m_bIgnoreUpdates = true;
|
||||
LockResources();
|
||||
|
||||
// Switching modes will destroy the current AzFramework::EntityConext which may contain
|
||||
// data the queued events hold on to, so execute all queued events before switching.
|
||||
@@ -891,7 +776,6 @@ void CGameEngine::SetGameMode(bool bInGame)
|
||||
|
||||
GetISystem()->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_EDITOR_GAME_MODE_CHANGED, bInGame, 0);
|
||||
|
||||
UnlockResources();
|
||||
m_bIgnoreUpdates = false;
|
||||
|
||||
GetISystem()->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_GAME_MODE_SWITCH_END, bInGame, 0);
|
||||
@@ -906,11 +790,6 @@ void CGameEngine::SetSimulationMode(bool enabled, bool bOnlyPhysics)
|
||||
|
||||
m_pISystem->GetIMovieSystem()->EnablePhysicsEvents(enabled);
|
||||
|
||||
if (!bOnlyPhysics)
|
||||
{
|
||||
LockResources();
|
||||
}
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
CRuler* pRuler = GetIEditor()->GetRuler();
|
||||
@@ -935,35 +814,12 @@ void CGameEngine::SetSimulationMode(bool enabled, bool bOnlyPhysics)
|
||||
|
||||
if (m_bSimulationMode)
|
||||
{
|
||||
if (!bOnlyPhysics)
|
||||
{
|
||||
if (m_pISystem->GetI3DEngine())
|
||||
{
|
||||
m_pISystem->GetI3DEngine()->ResetPostEffects();
|
||||
}
|
||||
|
||||
GetIEditor()->SetConsoleVar("ai_ignoreplayer", 1);
|
||||
//GetIEditor()->SetConsoleVar( "ai_soundperception",0 );
|
||||
}
|
||||
|
||||
// [Anton] the order of the next 3 calls changed, since, EVENT_INGAME loads physics state (if any),
|
||||
// and Reset should be called before it
|
||||
GetIEditor()->GetObjectManager()->SendEvent(EVENT_INGAME);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!bOnlyPhysics)
|
||||
{
|
||||
GetIEditor()->SetConsoleVar("ai_ignoreplayer", 0);
|
||||
//GetIEditor()->SetConsoleVar( "ai_soundperception",1 );
|
||||
|
||||
if (m_pISystem->GetI3DEngine())
|
||||
{
|
||||
m_pISystem->GetI3DEngine()->ResetPostEffects();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GetIEditor()->GetObjectManager()->SendEvent(EVENT_OUTOFGAME);
|
||||
}
|
||||
|
||||
@@ -983,23 +839,9 @@ void CGameEngine::SetSimulationMode(bool enabled, bool bOnlyPhysics)
|
||||
AzToolsFramework::EditorEntityContextRequestBus::Broadcast(&AzToolsFramework::EditorEntityContextRequestBus::Events::StartPlayInEditor);
|
||||
}
|
||||
|
||||
if (!bOnlyPhysics)
|
||||
{
|
||||
UnlockResources();
|
||||
}
|
||||
|
||||
AzFramework::InputChannelRequestBus::Broadcast(&AzFramework::InputChannelRequests::ResetState);
|
||||
}
|
||||
|
||||
void CGameEngine::ResetResources()
|
||||
{
|
||||
if (gEnv->p3DEngine)
|
||||
{
|
||||
gEnv->p3DEngine->UnloadLevel();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CGameEngine::SetPlayerViewMatrix(const Matrix34& tm, [[maybe_unused]] bool bEyePos)
|
||||
{
|
||||
m_playerViewTM = tm;
|
||||
@@ -1107,24 +949,6 @@ void CGameEngine::OnEditorNotifyEvent(EEditorNotifyEvent event)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case eNotify_OnBeginNewScene:
|
||||
case eNotify_OnBeginSceneOpen:
|
||||
{
|
||||
ResetResources();
|
||||
}
|
||||
break;
|
||||
case eNotify_OnEndSceneOpen:
|
||||
case eNotify_OnEndTerrainRebuild:
|
||||
{
|
||||
}
|
||||
case eNotify_OnEndNewScene: // intentional fall-through?
|
||||
{
|
||||
if (gEnv->p3DEngine)
|
||||
{
|
||||
gEnv->p3DEngine->PostLoadLevel();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case eNotify_OnSplashScreenDestroyed:
|
||||
{
|
||||
if (m_pSystemUserCallback != NULL)
|
||||
@@ -1136,22 +960,6 @@ void CGameEngine::OnEditorNotifyEvent(EEditorNotifyEvent event)
|
||||
}
|
||||
}
|
||||
|
||||
void CGameEngine::LockResources()
|
||||
{
|
||||
if (gEnv->p3DEngine)
|
||||
{
|
||||
gEnv->p3DEngine->LockCGFResources();
|
||||
}
|
||||
}
|
||||
|
||||
void CGameEngine::UnlockResources()
|
||||
{
|
||||
if (gEnv->p3DEngine)
|
||||
{
|
||||
gEnv->p3DEngine->UnlockCGFResources();
|
||||
}
|
||||
}
|
||||
|
||||
void CGameEngine::OnTerrainModified(const Vec2& modPosition, float modAreaRadius, bool fullTerrain)
|
||||
{
|
||||
INavigationSystem* pNavigationSystem = nullptr; // INavigationSystem will be converted to an AZInterface (LY-111343)
|
||||
|
||||
@@ -89,15 +89,10 @@ public:
|
||||
//! Load new terrain level into 3d engine.
|
||||
//! Also load AI triangulation for this level.
|
||||
bool LoadLevel(
|
||||
const QString& mission,
|
||||
bool bDeleteAIGraph,
|
||||
bool bReleaseResources);
|
||||
//!* Reload level if it was already loaded.
|
||||
bool ReloadLevel();
|
||||
//! Load new mission.
|
||||
bool LoadMission(const QString& mission);
|
||||
//! Reload environment settings in currently loaded level.
|
||||
bool ReloadEnvironment();
|
||||
//! Request to switch In/Out of game mode on next update.
|
||||
//! The switch will happen when no sub systems are currently being updated.
|
||||
//! @param inGame When true editor switch to game mode.
|
||||
@@ -111,14 +106,10 @@ public:
|
||||
bool IsLevelLoaded() const { return m_bLevelLoaded; };
|
||||
//! Assign new level path name.
|
||||
void SetLevelPath(const QString& path);
|
||||
//! Assign new current mission name.
|
||||
void SetMissionName(const QString& mission);
|
||||
//! Return name of currently loaded level.
|
||||
const QString& GetLevelName() const { return m_levelName; };
|
||||
//! Return extension of currently loaded level.
|
||||
const QString& GetLevelExtension() const { return m_levelExtension; };
|
||||
//! Return name of currently active mission.
|
||||
const QString& GetMissionName() const { return m_missionName; };
|
||||
//! Get fully specified level path.
|
||||
const QString& GetLevelPath() const { return m_levelPath; };
|
||||
//! Query if engine is in game mode.
|
||||
@@ -142,9 +133,6 @@ public:
|
||||
//! Called every frame.
|
||||
void Update();
|
||||
virtual void OnEditorNotifyEvent(EEditorNotifyEvent event);
|
||||
void LockResources();
|
||||
void UnlockResources();
|
||||
void ResetResources();
|
||||
void OnTerrainModified(const Vec2& modPosition, float modAreaRadius, bool fullTerrain);
|
||||
void OnAreaModified(const AABB& modifiedArea);
|
||||
|
||||
@@ -179,7 +167,6 @@ private:
|
||||
CLogFile m_logFile;
|
||||
QString m_levelName;
|
||||
QString m_levelExtension;
|
||||
QString m_missionName;
|
||||
QString m_levelPath;
|
||||
QString m_MOD;
|
||||
bool m_bLevelLoaded;
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "GameExporter.h"
|
||||
#include "GameEngine.h"
|
||||
#include "CryEditDoc.h"
|
||||
#include "Mission.h"
|
||||
#include "ShaderCache.h"
|
||||
#include "UsedResources.h"
|
||||
#include "WaitProgress.h"
|
||||
@@ -131,13 +130,6 @@ bool CGameExporter::Export(unsigned int flags, [[maybe_unused]] EEndian eExportE
|
||||
m_levelPath = Path::RemoveBackslash(sLevelPath);
|
||||
QString rootLevelPath = Path::AddSlash(pGameEngine->GetLevelPath());
|
||||
|
||||
// Make sure we unload any unused CGFs before exporting so that they don't end up in
|
||||
// the level data.
|
||||
if (pEditor->Get3DEngine())
|
||||
{
|
||||
pEditor->Get3DEngine()->FreeUnusedCGFResources();
|
||||
}
|
||||
|
||||
CCryEditDoc* pDocument = pEditor->GetDocument();
|
||||
|
||||
if (flags & eExp_Fast)
|
||||
@@ -191,8 +183,6 @@ bool CGameExporter::Export(unsigned int flags, [[maybe_unused]] EEndian eExportE
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
if (exportSuccessful)
|
||||
{
|
||||
ExportVisAreas(sLevelPath.toUtf8().data(), eExportEndian);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Exporting map setttings
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@@ -254,47 +244,6 @@ bool CGameExporter::Export(unsigned int flags, [[maybe_unused]] EEndian eExportE
|
||||
return exportSuccessful;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CGameExporter::ExportVisAreas(const char* pszGamePath, EEndian eExportEndian)
|
||||
{
|
||||
char szFileOutputPath[_MAX_PATH];
|
||||
|
||||
// export visareas
|
||||
IEditor* pEditor = GetIEditor();
|
||||
|
||||
// remove old files
|
||||
sprintf_s(szFileOutputPath, "%s%s", pszGamePath, COMPILED_VISAREA_MAP_FILE_NAME);
|
||||
m_levelPak.m_pakFile.RemoveFile(szFileOutputPath);
|
||||
|
||||
SHotUpdateInfo exportInfo;
|
||||
I3DEngine* p3DEngine = pEditor->Get3DEngine();
|
||||
|
||||
if (p3DEngine && (eExportEndian == GetPlatformEndian())) // skip second export, this data is common for PC and consoles
|
||||
{
|
||||
std::vector<struct IStatObj*>* pTempBrushTable = NULL;
|
||||
std::vector<_smart_ptr<IMaterial>>* pTempMatsTable = NULL;
|
||||
std::vector<struct IStatInstGroup*>* pTempVegGroupTable = NULL;
|
||||
|
||||
// export visareas
|
||||
CLogFile::WriteLine("Exporting indoors...");
|
||||
pEditor->SetStatusText("Exporting indoors...");
|
||||
if (IVisAreaManager* pVisAreaManager = p3DEngine->GetIVisAreaManager())
|
||||
{
|
||||
if (int nSize = pVisAreaManager->GetCompiledDataSize())
|
||||
{ // get visareas data from 3dengine and save it into file
|
||||
uint8* pData = new uint8[nSize];
|
||||
pVisAreaManager->GetCompiledData(pData, nSize, &pTempBrushTable, &pTempMatsTable, &pTempVegGroupTable, eExportEndian);
|
||||
sprintf_s(szFileOutputPath, "%s%s", pszGamePath, COMPILED_VISAREA_MAP_FILE_NAME);
|
||||
CCryMemFile visareasCompiledFile;
|
||||
visareasCompiledFile.Write(pData, nSize);
|
||||
m_levelPak.m_pakFile.UpdateFile(szFileOutputPath, visareasCompiledFile);
|
||||
delete[] pData;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CGameExporter::ExportOcclusionMesh(const char* pszGamePath)
|
||||
{
|
||||
@@ -319,7 +268,7 @@ void CGameExporter::ExportOcclusionMesh(const char* pszGamePath)
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CGameExporter::ExportLevelData(const QString& path, bool bExportMission)
|
||||
void CGameExporter::ExportLevelData(const QString& path, bool /*bExportMission*/)
|
||||
{
|
||||
IEditor* pEditor = GetIEditor();
|
||||
pEditor->SetStatusText(QObject::tr("Exporting LevelData.xml..."));
|
||||
@@ -332,49 +281,6 @@ void CGameExporter::ExportLevelData(const QString& path, bool bExportMission)
|
||||
XmlNodeRef rootAction = XmlHelpers::CreateXmlNode("LevelDataAction");
|
||||
rootAction->setAttr("SandboxVersion", versionString);
|
||||
|
||||
ExportMapInfo(root);
|
||||
|
||||
CCryEditDoc* pDocument = pEditor->GetDocument();
|
||||
CMission* pCurrentMission = 0;
|
||||
|
||||
if (bExportMission)
|
||||
{
|
||||
pCurrentMission = pDocument->GetCurrentMission();
|
||||
// Save contents of current mission.
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Export missions tag.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
XmlNodeRef missionsNode = rootAction->newChild("Missions");
|
||||
QString missionFileName;
|
||||
QString currentMissionFileName;
|
||||
I3DEngine* p3DEngine = pEditor->Get3DEngine();
|
||||
if (p3DEngine)
|
||||
{
|
||||
for (int i = 0; i < pDocument->GetMissionCount(); i++)
|
||||
{
|
||||
CMission* pMission = pDocument->GetMission(i);
|
||||
|
||||
QString name = pMission->GetName();
|
||||
name.replace(' ', '_');
|
||||
missionFileName = QStringLiteral("Mission_%1.xml").arg(name);
|
||||
|
||||
XmlNodeRef missionDescNode = missionsNode->newChild("Mission");
|
||||
missionDescNode->setAttr("Name", pMission->GetName().toUtf8().data());
|
||||
missionDescNode->setAttr("File", missionFileName.toUtf8().data());
|
||||
missionDescNode->setAttr("CGFCount", p3DEngine->GetLoadedObjectCount());
|
||||
|
||||
int nProgressBarRange = m_numExportedMaterials / 10 + p3DEngine->GetLoadedObjectCount();
|
||||
missionDescNode->setAttr("ProgressBarRange", nProgressBarRange);
|
||||
|
||||
if (pMission == pCurrentMission)
|
||||
{
|
||||
currentMissionFileName = missionFileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Save Level Data XML
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -389,41 +295,6 @@ void CGameExporter::ExportLevelData(const QString& path, bool bExportMission)
|
||||
CCryMemFile fileAction;
|
||||
fileAction.Write(xmlDataAction.c_str(), xmlDataAction.length());
|
||||
m_levelPak.m_pakFile.UpdateFile(levelDataActionFile.toUtf8().data(), fileAction);
|
||||
|
||||
if (bExportMission)
|
||||
{
|
||||
XmlNodeRef objectsNode = NULL;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Export current mission file.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
XmlNodeRef missionNode = rootAction->createNode("Mission");
|
||||
pCurrentMission->Export(missionNode, objectsNode);
|
||||
|
||||
if (p3DEngine)
|
||||
{
|
||||
missionNode->setAttr("CGFCount", p3DEngine->GetLoadedObjectCount());
|
||||
}
|
||||
|
||||
//if (!CFileUtil::OverwriteFile( path+currentMissionFileName ))
|
||||
// return;
|
||||
|
||||
AZStd::vector<char> entitySaveBuffer;
|
||||
AZ::IO::ByteContainerStream<AZStd::vector<char> > entitySaveStream(&entitySaveBuffer);
|
||||
bool savedEntities = false;
|
||||
EBUS_EVENT_RESULT(savedEntities, AzToolsFramework::EditorEntityContextRequestBus, SaveToStreamForGame, entitySaveStream, AZ::DataStream::ST_BINARY);
|
||||
if (savedEntities)
|
||||
{
|
||||
QString entitiesFile;
|
||||
entitiesFile = QStringLiteral("%1%2.entities_xml").arg(path, pCurrentMission ? pCurrentMission->GetName() : "");
|
||||
m_levelPak.m_pakFile.UpdateFile(entitiesFile.toUtf8().data(), entitySaveBuffer.begin(), entitySaveBuffer.size());
|
||||
}
|
||||
|
||||
_smart_ptr<IXmlStringData> pXmlStrData = missionNode->getXMLData(5000000);
|
||||
|
||||
CCryMemFile fileMission;
|
||||
fileMission.Write(pXmlStrData->GetString(), pXmlStrData->GetStringLength());
|
||||
m_levelPak.m_pakFile.UpdateFile((path + currentMissionFileName).toUtf8().data(), fileMission);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -446,18 +317,6 @@ void CGameExporter::ExportLevelInfo(const QString& path)
|
||||
const int compiledHeightmapSize = static_cast<int>(terrainAabb.GetXExtent() / terrainGridResolution.GetX());
|
||||
root->setAttr("HeightmapSize", compiledHeightmapSize);
|
||||
|
||||
// Save all missions in this level.
|
||||
XmlNodeRef missionsNode = root->newChild("Missions");
|
||||
int numMissions = pEditor->GetDocument()->GetMissionCount();
|
||||
for (int i = 0; i < numMissions; i++)
|
||||
{
|
||||
CMission* pMission = pEditor->GetDocument()->GetMission(i);
|
||||
XmlNodeRef missionNode = missionsNode->newChild("Mission");
|
||||
missionNode->setAttr("Name", pMission->GetName().toUtf8().data());
|
||||
missionNode->setAttr("Description", pMission->GetDescription().toUtf8().data());
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Save LevelInfo file.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -469,38 +328,6 @@ void CGameExporter::ExportLevelInfo(const QString& path)
|
||||
m_levelPak.m_pakFile.UpdateFile(filename.toUtf8().data(), file);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CGameExporter::ExportMapInfo(XmlNodeRef& node)
|
||||
{
|
||||
if (!GetIEditor()->Get3DEngine())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
XmlNodeRef info = node->newChild("LevelInfo");
|
||||
|
||||
IEditor* pEditor = GetIEditor();
|
||||
info->setAttr("Name", QFileInfo(pEditor->GetDocument()->GetTitle()).completeBaseName());
|
||||
|
||||
auto terrain = AzFramework::Terrain::TerrainDataRequestBus::FindFirstHandler();
|
||||
const AZ::Aabb terrainAabb = terrain ? terrain->GetTerrainAabb() : AZ::Aabb::CreateFromPoint(AZ::Vector3::CreateZero());
|
||||
const AZ::Vector2 terrainGridResolution = terrain ? terrain->GetTerrainGridResolution() : AZ::Vector2::CreateOne();
|
||||
|
||||
const int terrainSizeInMeters = static_cast<int>(terrainAabb.GetXExtent());
|
||||
const int terrainUnitSizeInMeters = static_cast<int>(terrainGridResolution.GetX());
|
||||
info->setAttr("HeightmapSize", terrainSizeInMeters / terrainUnitSizeInMeters);
|
||||
info->setAttr("HeightmapUnitSize", terrainUnitSizeInMeters);
|
||||
//! Default Max Height value.
|
||||
constexpr int HEIGHTMAP_MAX_HEIGHT = 150; //This is the default max height in CHeightmap
|
||||
info->setAttr("HeightmapMaxHeight", HEIGHTMAP_MAX_HEIGHT);
|
||||
info->setAttr("WaterLevel", pEditor->Get3DEngine()->GetWaterLevel());
|
||||
|
||||
// Serialize surface types.
|
||||
CXmlArchive xmlAr;
|
||||
xmlAr.bLoading = false;
|
||||
xmlAr.root = node;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CGameExporter::ExportLevelResourceList(const QString& path)
|
||||
{
|
||||
|
||||
@@ -91,9 +91,7 @@ private:
|
||||
void ExportLevelData(const QString& path, bool bExportMission = true);
|
||||
void ExportLevelInfo(const QString& path);
|
||||
|
||||
void ExportVisAreas(const char* pszGamePath, EEndian eExportEndian);
|
||||
void ExportOcclusionMesh(const char* pszGamePath);
|
||||
void ExportMapInfo(XmlNodeRef& node);
|
||||
|
||||
void ExportLevelResourceList(const QString& path);
|
||||
void ExportLevelUsedResourceList(const QString& path);
|
||||
|
||||
@@ -1,16 +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 "EdGeometry.h"
|
||||
@@ -1,84 +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_GEOMETRY_EDGEOMETRY_H
|
||||
#define CRYINCLUDE_EDITOR_GEOMETRY_EDGEOMETRY_H
|
||||
#pragma once
|
||||
|
||||
struct IIndexedMesh;
|
||||
struct DisplayContext;
|
||||
struct HitContext;
|
||||
struct SSubObjSelectionModifyContext;
|
||||
class CObjectArchive;
|
||||
|
||||
// Basic supported geometry types.
|
||||
enum EEdGeometryType
|
||||
{
|
||||
GEOM_TYPE_MESH = 0, // Mesh geometry.
|
||||
GEOM_TYPE_BRUSH, // Solid brush geometry.
|
||||
GEOM_TYPE_PATCH, // Bezier patch surface geometry.
|
||||
GEOM_TYPE_NURB, // Nurbs surface geometry.
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Description:
|
||||
// CEdGeometry is a base class for all supported editable geometries.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
class CRYEDIT_API CEdGeometry
|
||||
: public CRefCountBase
|
||||
{
|
||||
public:
|
||||
CEdGeometry() {};
|
||||
|
||||
// Query the type of the geometry mesh.
|
||||
virtual EEdGeometryType GetType() const = 0;
|
||||
|
||||
// Serialize geometry.
|
||||
virtual void Serialize(CObjectArchive& ar) = 0;
|
||||
|
||||
// Return geometry axis aligned bounding box.
|
||||
virtual void GetBounds(AABB& box) = 0;
|
||||
|
||||
// Clones Geometry, returns exact copy of the original geometry.
|
||||
virtual CEdGeometry* Clone() = 0;
|
||||
|
||||
// Access to the indexed mesh.
|
||||
// Return false if geometry can not be represented by an indexed mesh.
|
||||
virtual IIndexedMesh* GetIndexedMesh(size_t idx = 0) = 0;
|
||||
virtual IStatObj* GetIStatObj() const = 0;
|
||||
virtual void GetTM(Matrix34* pTM, size_t idx = 0) = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Advanced geometry interface for SubObject selection and modification.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void SetModified(bool bModified = true) = 0;
|
||||
virtual bool IsModified() const = 0;
|
||||
virtual bool StartSubObjSelection(const Matrix34& nodeWorldTM, int elemType, int nFlags) = 0;
|
||||
virtual void EndSubObjSelection() = 0;
|
||||
|
||||
// Display geometry for sub object selection.
|
||||
virtual void Display(DisplayContext& dc) = 0;
|
||||
|
||||
// Sub geometry hit testing and selection.
|
||||
virtual bool HitTest(HitContext& hit) = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void ModifySelection(SSubObjSelectionModifyContext& modCtx, bool isUndo = true) = 0;
|
||||
// Called when selection modification is accepted.
|
||||
virtual void AcceptModifySelection() = 0;
|
||||
|
||||
protected:
|
||||
~CEdGeometry() {};
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_GEOMETRY_EDGEOMETRY_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,194 +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.
|
||||
|
||||
// Description : Editor structure that wraps access to IStatObj
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_GEOMETRY_EDMESH_H
|
||||
#define CRYINCLUDE_EDITOR_GEOMETRY_EDMESH_H
|
||||
#pragma once
|
||||
|
||||
#include "EdGeometry.h"
|
||||
#include "Objects/SubObjSelection.h"
|
||||
#include "TriMesh.h"
|
||||
|
||||
// Flags that can be set on CEdMesh.
|
||||
enum CEdMeshFlags
|
||||
{
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Description:
|
||||
// CEdMesh is a Geometry kind representing simple mesh.
|
||||
// Holds IStatObj interface from the 3D Engine.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
class CRYEDIT_API CEdMesh
|
||||
: public CEdGeometry
|
||||
{
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// CEdGeometry implementation.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual EEdGeometryType GetType() const { return GEOM_TYPE_MESH; };
|
||||
virtual void Serialize(CObjectArchive& ar);
|
||||
|
||||
virtual void GetBounds(AABB& box);
|
||||
virtual CEdGeometry* Clone();
|
||||
virtual IIndexedMesh* GetIndexedMesh(size_t idx = 0);
|
||||
virtual void GetTM(Matrix34* pTM, size_t idx = 0);
|
||||
virtual void SetModified(bool bModified = true);
|
||||
virtual bool IsModified() const { return m_bModified; };
|
||||
virtual bool StartSubObjSelection(const Matrix34& nodeWorldTM, int elemType, int nFlags);
|
||||
virtual void EndSubObjSelection();
|
||||
virtual void Display(DisplayContext& dc);
|
||||
virtual bool HitTest(HitContext& hit);
|
||||
bool GetSelectionReferenceFrame(Matrix34& refFrame);
|
||||
virtual void ModifySelection(SSubObjSelectionModifyContext& modCtx, bool isUndo = true);
|
||||
virtual void AcceptModifySelection();
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
~CEdMesh();
|
||||
|
||||
// Return filename of mesh.
|
||||
const QString& GetFilename() const { return m_filename; };
|
||||
void SetFilename(const QString& filename);
|
||||
|
||||
//! Reload geometry of mesh.
|
||||
void ReloadGeometry();
|
||||
void AddUser();
|
||||
void RemoveUser();
|
||||
int GetUserCount() const { return m_nUserCount; };
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetFlags(int nFlags) { m_nFlags = nFlags; };
|
||||
int GetFlags() { return m_nFlags; }
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//! Access stored IStatObj.
|
||||
IStatObj* GetIStatObj() const { return m_pStatObj; }
|
||||
|
||||
//! Returns true if filename and geomname refer to the same object as this one.
|
||||
bool IsSameObject(const char* filename);
|
||||
|
||||
//! RenderMesh.
|
||||
void Render(SRendParams& rp, const SRenderingPassInfo& passInfo);
|
||||
|
||||
//! Make new CEdMesh, if same IStatObj loaded, and CEdMesh for this IStatObj is allocated.
|
||||
//! This instance of CEdMesh will be returned.
|
||||
static CEdMesh* LoadMesh(const char* filename);
|
||||
|
||||
// Creates a new mesh not from a file.
|
||||
// Create a new StatObj and IndexedMesh.
|
||||
static CEdMesh* CreateMesh(const char* name);
|
||||
|
||||
//! Reload all geometries.
|
||||
static void ReloadAllGeometries();
|
||||
static void ReleaseAll();
|
||||
|
||||
//! Check if default object was loaded.
|
||||
bool IsDefaultObject();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Copy EdMesh data to the specified mesh.
|
||||
void CopyToMesh(CTriMesh& toMesh, int nCopyFlags);
|
||||
// Copy EdMesh data from the specified mesh.
|
||||
void CopyFromMesh(CTriMesh& fromMesh, int nCopyFlags, bool bUndo);
|
||||
|
||||
// Retrieve mesh class.
|
||||
CTriMesh* GetMesh();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void InvalidateMesh();
|
||||
void SetWorldTM(const Matrix34& worldTM);
|
||||
|
||||
// Save mesh into the file.
|
||||
// Optionally can provide pointer to the pak file where to save files into.
|
||||
void SaveToCGF(const char* sFilename, CPakFile* pPakFile = NULL, _smart_ptr<IMaterial> pMaterial = NULL);
|
||||
|
||||
// Draw debug representation of this mesh.
|
||||
void DebugDraw(const SGeometryDebugDrawInfo& info, float fExtrdueScale = 0.01f);
|
||||
|
||||
private:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CEdMesh(IStatObj* pGeom);
|
||||
CEdMesh();
|
||||
void UpdateSubObjCache();
|
||||
void UpdateIndexedMeshFromCache(bool bFast);
|
||||
void OnSelectionChange();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct SSubObjHitTestEnvironment
|
||||
{
|
||||
Vec3 vWSCameraPos;
|
||||
Vec3 vWSCameraVector;
|
||||
Vec3 vOSCameraVector;
|
||||
|
||||
bool bHitTestNearest;
|
||||
bool bHitTestSelected;
|
||||
bool bSelectOnHit;
|
||||
bool bAdd;
|
||||
bool bRemove;
|
||||
bool bSelectValue;
|
||||
bool bHighlightOnly;
|
||||
bool bIgnoreBackfacing;
|
||||
};
|
||||
struct SSubObjHitTestResult
|
||||
{
|
||||
CTriMesh::EStream stream; // To What stream of the TriMesh this result apply.
|
||||
MeshElementsArray elems; // List of hit elements.
|
||||
float minDistance; // Minimal distance to the hit.
|
||||
SSubObjHitTestResult() { minDistance = FLT_MAX; }
|
||||
};
|
||||
bool HitTestVertex(HitContext& hit, SSubObjHitTestEnvironment& env, SSubObjHitTestResult& result);
|
||||
bool HitTestEdge(HitContext& hit, SSubObjHitTestEnvironment& env, SSubObjHitTestResult& result);
|
||||
bool HitTestFace(HitContext& hit, SSubObjHitTestEnvironment& env, SSubObjHitTestResult& result);
|
||||
|
||||
// Return`s true if selection changed.
|
||||
bool SelectSubObjElements(SSubObjHitTestEnvironment& env, SSubObjHitTestResult& result);
|
||||
bool IsHitTestResultSelected(SSubObjHitTestResult& result);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! CGF filename.
|
||||
QString m_filename;
|
||||
IStatObj* m_pStatObj;
|
||||
int m_nUserCount;
|
||||
int m_nFlags;
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
typedef std::map<QString, CEdMesh*, stl::less_stricmp<QString> > MeshMap;
|
||||
static MeshMap m_meshMap;
|
||||
|
||||
// This cache is created when sub object selection is needed.
|
||||
struct SubObjCache
|
||||
{
|
||||
// Cache of data in geometry.
|
||||
// World space mesh.
|
||||
CTriMesh* pTriMesh;
|
||||
Matrix34 worldTM;
|
||||
Matrix34 invWorldTM;
|
||||
CBitArray m_tempBitArray;
|
||||
bool bNoDisplay;
|
||||
|
||||
SubObjCache()
|
||||
: pTriMesh(0)
|
||||
, bNoDisplay(false) {};
|
||||
};
|
||||
SubObjCache* m_pSubObjCache;
|
||||
bool m_bModified;
|
||||
|
||||
std::vector<IIndexedMesh*> m_tempIndexedMeshes;
|
||||
std::vector<Matrix34> m_tempMatrices;
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_GEOMETRY_EDMESH_H
|
||||
@@ -136,31 +136,10 @@ Matrix34 CGrid::GetMatrix() const
|
||||
Ang3 angles = Ang3(rotationAngles.x * gf_PI / 180.0, rotationAngles.y * gf_PI / 180.0, rotationAngles.z * gf_PI / 180.0);
|
||||
|
||||
tm = Matrix33::CreateRotationXYZ(angles);
|
||||
|
||||
if (gSettings.snap.bGridGetFromSelected)
|
||||
{
|
||||
CSelectionGroup* sel = GetIEditor()->GetSelection();
|
||||
if (sel->GetCount() > 0)
|
||||
{
|
||||
CBaseObject* obj = sel->GetObject(0);
|
||||
tm = obj->GetWorldTM();
|
||||
tm.OrthonormalizeFast();
|
||||
tm.SetTranslation(Vec3(0, 0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (GetIEditor()->GetReferenceCoordSys() == COORDS_LOCAL)
|
||||
{
|
||||
tm.SetIdentity();
|
||||
|
||||
CSelectionGroup* sel = GetIEditor()->GetSelection();
|
||||
if (sel->GetCount() > 0)
|
||||
{
|
||||
CBaseObject* obj = sel->GetObject(0);
|
||||
tm = obj->GetWorldTM();
|
||||
tm.OrthonormalizeFast();
|
||||
tm.SetTranslation(Vec3(0, 0, 0));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -39,8 +39,6 @@ CGridSettingsDialog::CGridSettingsDialog(QWidget* pParent /*=NULL*/)
|
||||
|
||||
connect(ui->m_userDefined, &QCheckBox::clicked, this, &CGridSettingsDialog::OnBnUserDefined);
|
||||
connect(ui->m_getFromObject, &QCheckBox::clicked, this, &CGridSettingsDialog::OnBnGetFromObject);
|
||||
connect(ui->m_getAnglesFromObject, &QPushButton::clicked, this, &CGridSettingsDialog::OnBnGetAngles);
|
||||
connect(ui->m_getTranslationFromObject, &QPushButton::clicked, this, &CGridSettingsDialog::OnBnGetTranslation);
|
||||
|
||||
auto doubleSpinBoxValueChanged = static_cast<void(QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged);
|
||||
|
||||
@@ -115,39 +113,6 @@ void CGridSettingsDialog::OnBnGetFromObject()
|
||||
EnableGridPropertyControls(ui->m_userDefined->isChecked(), ui->m_getFromObject->isChecked());
|
||||
}
|
||||
|
||||
void CGridSettingsDialog::OnBnGetAngles()
|
||||
{
|
||||
CSelectionGroup* sel = GetIEditor()->GetSelection();
|
||||
if (sel->GetCount() > 0)
|
||||
{
|
||||
CBaseObject* obj = sel->GetObject(0);
|
||||
Matrix34 tm = obj->GetWorldTM();
|
||||
AffineParts ap;
|
||||
ap.SpectralDecompose(tm);
|
||||
|
||||
Vec3 rotation = Vec3(RAD2DEG(Ang3::GetAnglesXYZ(Matrix33(ap.rot))));
|
||||
|
||||
ui->m_angleX->setValue(rotation.x);
|
||||
ui->m_angleY->setValue(rotation.y);
|
||||
ui->m_angleZ->setValue(rotation.z);
|
||||
}
|
||||
}
|
||||
|
||||
void CGridSettingsDialog::OnBnGetTranslation()
|
||||
{
|
||||
CSelectionGroup* sel = GetIEditor()->GetSelection();
|
||||
if (sel->GetCount() > 0)
|
||||
{
|
||||
CBaseObject* obj = sel->GetObject(0);
|
||||
Matrix34 tm = obj->GetWorldTM();
|
||||
Vec3 translation = tm.GetTranslation();
|
||||
|
||||
ui->m_translationX->setValue(translation.x);
|
||||
ui->m_translationY->setValue(translation.y);
|
||||
ui->m_translationZ->setValue(translation.z);
|
||||
}
|
||||
}
|
||||
|
||||
void CGridSettingsDialog::EnableGridPropertyControls(const bool isUserDefined, const bool isGetFromObject)
|
||||
{
|
||||
ui->m_getFromObject->setEnabled(isUserDefined == true);
|
||||
|
||||
@@ -51,8 +51,6 @@ private slots:
|
||||
void accept() override;
|
||||
void OnBnUserDefined();
|
||||
void OnBnGetFromObject();
|
||||
void OnBnGetAngles();
|
||||
void OnBnGetTranslation();
|
||||
void OnValueUpdate();
|
||||
|
||||
private:
|
||||
|
||||
@@ -85,7 +85,6 @@ namespace WinWidget
|
||||
}
|
||||
|
||||
struct ISystem;
|
||||
struct I3DEngine;
|
||||
struct IRenderer;
|
||||
struct AABB;
|
||||
struct IEventLoopHook;
|
||||
@@ -137,7 +136,6 @@ enum EEditorNotifyEvent
|
||||
eNotify_OnEndLayerExport, // Sent after a layer have been exported.
|
||||
eNotify_OnCloseScene, // Send when the document is about to close.
|
||||
eNotify_OnSceneClosed, // Send when the document is closed.
|
||||
eNotify_OnMissionChange, // Send when the current mission changes.
|
||||
eNotify_OnBeginLoad, // Sent when the document is start to load.
|
||||
eNotify_OnEndLoad, // Sent when the document loading is finished
|
||||
|
||||
@@ -180,8 +178,6 @@ enum EEditorNotifyEvent
|
||||
|
||||
eNotify_OnDisplayRenderUpdate, // Sent when editor finish terrain texture generation.
|
||||
|
||||
eNotify_OnTimeOfDayChange, // Time of day parameters where modified.
|
||||
|
||||
eNotify_OnDataBaseUpdate, // DataBase Library was modified.
|
||||
|
||||
eNotify_OnLayerImportBegin, //layer import was started
|
||||
@@ -241,8 +237,6 @@ struct IDocListener
|
||||
virtual void OnLoadDocument() = 0;
|
||||
//! Called when document is being closed.
|
||||
virtual void OnCloseDocument() = 0;
|
||||
//! Called when mission changes.
|
||||
virtual void OnMissionChange() = 0;
|
||||
};
|
||||
|
||||
//! Derive from this class if you want to register for getting global editor notifications.
|
||||
@@ -431,7 +425,6 @@ struct IEditor
|
||||
virtual void DeleteThis() = 0;
|
||||
//! Access to Editor ISystem interface.
|
||||
virtual ISystem* GetSystem() = 0;
|
||||
virtual I3DEngine* Get3DEngine() = 0;
|
||||
virtual IRenderer* GetRenderer() = 0;
|
||||
//! Access to class factory.
|
||||
virtual IEditorClassFactory* GetClassFactory() = 0;
|
||||
@@ -739,8 +732,6 @@ struct IEditor
|
||||
typedef AZStd::function<void(QMenu*, const CBaseObject*)> TContextMenuExtensionFunc;
|
||||
virtual void RegisterObjectContextMenuExtension(TContextMenuExtensionFunc func) = 0;
|
||||
|
||||
virtual void SetCurrentMissionTime(float time) = 0;
|
||||
|
||||
virtual SSystemGlobalEnvironment* GetEnv() = 0;
|
||||
virtual IImageUtil* GetImageUtil() = 0; // Vladimir@conffx
|
||||
virtual SEditorSettings* GetEditorSettings() = 0;
|
||||
|
||||
@@ -71,7 +71,6 @@ AZ_POP_DISABLE_WARNING
|
||||
#include "BackgroundTaskManager.h"
|
||||
#include "BackgroundScheduleManager.h"
|
||||
#include "EditorFileMonitor.h"
|
||||
#include "Mission.h"
|
||||
#include "MainStatusBar.h"
|
||||
|
||||
#include "SettingsBlock.h"
|
||||
@@ -116,29 +115,6 @@ static CCryEditDoc * theDocument;
|
||||
|
||||
#undef GetCommandLine
|
||||
|
||||
namespace
|
||||
{
|
||||
bool SelectionContainsComponentEntities()
|
||||
{
|
||||
bool result = false;
|
||||
CSelectionGroup* pSelection = GetIEditor()->GetObjectManager()->GetSelection();
|
||||
if (pSelection)
|
||||
{
|
||||
CBaseObject* selectedObj = nullptr;
|
||||
for (int selectionCounter = 0; selectionCounter < pSelection->GetCount(); ++selectionCounter)
|
||||
{
|
||||
selectedObj = pSelection->GetObject(selectionCounter);
|
||||
if (selectedObj->GetType() == OBJTYPE_AZENTITY)
|
||||
{
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
const char* CEditorImpl::m_crashLogFileName = "SessionStatus/editor_statuses.json";
|
||||
|
||||
CEditorImpl::CEditorImpl()
|
||||
@@ -464,15 +440,6 @@ ISystem* CEditorImpl::GetSystem()
|
||||
return m_pSystem;
|
||||
}
|
||||
|
||||
I3DEngine* CEditorImpl::Get3DEngine()
|
||||
{
|
||||
if (gEnv)
|
||||
{
|
||||
return gEnv->p3DEngine;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IRenderer* CEditorImpl::GetRenderer()
|
||||
{
|
||||
if (gEnv)
|
||||
@@ -1739,13 +1706,6 @@ void CEditorImpl::RegisterObjectContextMenuExtension(TContextMenuExtensionFunc f
|
||||
m_objectContextMenuExtensions.push_back(func);
|
||||
}
|
||||
|
||||
void CEditorImpl::SetCurrentMissionTime(float time)
|
||||
{
|
||||
if (CMission* pMission = GetIEditor()->GetDocument()->GetCurrentMission())
|
||||
{
|
||||
pMission->SetTime(time);
|
||||
}
|
||||
}
|
||||
// Vladimir@Conffx
|
||||
SSystemGlobalEnvironment* CEditorImpl::GetEnv()
|
||||
{
|
||||
|
||||
@@ -116,7 +116,6 @@ public:
|
||||
bool IsInitialized() const{ return m_bInitialized; }
|
||||
bool SaveDocument();
|
||||
ISystem* GetSystem();
|
||||
I3DEngine* Get3DEngine();
|
||||
IRenderer* GetRenderer();
|
||||
void WriteToConsole(const char* string) { CLogFile::WriteLine(string); };
|
||||
void WriteToConsole(const QString& string) { CLogFile::WriteLine(string); };
|
||||
@@ -321,7 +320,6 @@ public:
|
||||
void OnObjectContextMenuOpened(QMenu* pMenu, const CBaseObject* pObject);
|
||||
virtual void RegisterObjectContextMenuExtension(TContextMenuExtensionFunc func) override;
|
||||
|
||||
virtual void SetCurrentMissionTime(float time);
|
||||
virtual SSystemGlobalEnvironment* GetEnv() override;
|
||||
virtual IBaseLibraryManager* GetMaterialManagerLibrary() override; // Vladimir@Conffx
|
||||
virtual IEditorMaterialManager* GetIEditorMaterialManager() override; // Vladimir@Conffx
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
#include "IconManager.h"
|
||||
|
||||
#include <AzFramework/API/AtomActiveInterface.h>
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
|
||||
// AzToolsFramework
|
||||
@@ -26,6 +25,7 @@
|
||||
#include "Util/Image.h"
|
||||
#include "Util/ImageUtil.h"
|
||||
|
||||
#include <IStatObj.h>
|
||||
|
||||
#define HELPER_MATERIAL "Objects/Helper"
|
||||
|
||||
@@ -77,12 +77,11 @@ void CIconManager::Done()
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CIconManager::Reset()
|
||||
{
|
||||
I3DEngine* pEngine = GetIEditor()->Get3DEngine();
|
||||
// Do not unload objects. but clears them.
|
||||
int i;
|
||||
for (i = 0; i < sizeof(m_objects) / sizeof(m_objects[0]); i++)
|
||||
{
|
||||
if (m_objects[i] && pEngine)
|
||||
if (m_objects[i])
|
||||
{
|
||||
m_objects[i]->Release();
|
||||
}
|
||||
@@ -115,71 +114,6 @@ int CIconManager::GetIconTexture(const char* iconName)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (AZ::Interface<AzFramework::AtomActiveInterface>::Get())
|
||||
{
|
||||
ITexture* texture = GetIEditor()->GetRenderer() ? GetIEditor()->GetRenderer()->EF_LoadTexture(iconName) : nullptr;
|
||||
if (texture)
|
||||
{
|
||||
id = texture->GetTextureID();
|
||||
m_textures[iconName] = id;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QString ext = Path::GetExt(iconName);
|
||||
QString actualName = iconName;
|
||||
|
||||
char iconPath[AZ_MAX_PATH_LEN] = { 0 };
|
||||
gEnv->pFileIO->ResolvePath(actualName.toUtf8().data(), iconPath, AZ_MAX_PATH_LEN);
|
||||
|
||||
// if we can't find it at the resolved path, try the devroot if necessary:
|
||||
if (!gEnv->pFileIO->Exists(iconPath))
|
||||
{
|
||||
if (iconName[0] != '@') // it has no specified alias
|
||||
{
|
||||
if (QString::compare(ext, "dds", Qt::CaseInsensitive) != 0) // if its a DDS, it comes out of processed files in @assets@, and assets is assumed by default (legacy renderer)
|
||||
{
|
||||
// check for a source file
|
||||
AZStd::string iconFullPath;
|
||||
bool pathFound = false;
|
||||
using AssetSysReqBus = AzToolsFramework::AssetSystemRequestBus;
|
||||
AssetSysReqBus::BroadcastResult(pathFound, &AssetSysReqBus::Events::GetFullSourcePathFromRelativeProductPath, iconName, iconFullPath);
|
||||
|
||||
if (pathFound)
|
||||
{
|
||||
azstrncpy(iconPath, AZ_MAX_PATH_LEN, iconFullPath.c_str(), iconFullPath.length() + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CImageEx image;
|
||||
// Load icon.
|
||||
if (CImageUtil::LoadImage(iconPath, image))
|
||||
{
|
||||
IRenderer* pRenderer(GetIEditor()->GetRenderer());
|
||||
if (pRenderer->GetRenderType() != eRT_DX11)
|
||||
{
|
||||
image.SwapRedAndBlue();
|
||||
}
|
||||
|
||||
if (QString::compare(ext, "bmp", Qt::CaseInsensitive) == 0 || QString::compare(ext, "jpg", Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
int sz = image.GetWidth() * image.GetHeight();
|
||||
uint8* buf = (uint8*)image.GetData();
|
||||
for (int i = 0; i < sz; i++)
|
||||
{
|
||||
uint32 alpha = max(max(buf[i * 4], buf[i * 4 + 1]), buf[i * 4 + 2]);
|
||||
alpha *= 2;
|
||||
buf[i * 4 + 3] = (alpha > 255) ? 255 : alpha;
|
||||
}
|
||||
}
|
||||
|
||||
id = pRenderer->DownLoadToVideoMemory((unsigned char*)image.GetData(), image.GetWidth(), image.GetHeight(), eTF_R8G8B8A8, eTF_R8G8B8A8, 0, 0, 0);
|
||||
m_textures[iconName] = id;
|
||||
}
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -196,39 +130,10 @@ int CIconManager::GetIconTexture(EIcon icon)
|
||||
return m_icons[icon];
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
_smart_ptr<IMaterial> CIconManager::GetHelperMaterial()
|
||||
IStatObj* CIconManager::GetObject(EStatObject)
|
||||
{
|
||||
if (!m_pHelperMtl)
|
||||
{
|
||||
m_pHelperMtl = GetIEditor()->Get3DEngine()->GetMaterialManager()->LoadMaterial(HELPER_MATERIAL);
|
||||
}
|
||||
return m_pHelperMtl;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IStatObj* CIconManager::GetObject(EStatObject object)
|
||||
{
|
||||
assert(object >= 0 && object < eStatObject_COUNT);
|
||||
|
||||
if (m_objects[object])
|
||||
{
|
||||
return m_objects[object];
|
||||
}
|
||||
|
||||
// Try to load this object.
|
||||
m_objects[object] = GetIEditor()->Get3DEngine()->LoadStatObjUnsafeManualRef(g_ObjectNames[object], NULL, NULL, false);
|
||||
if (!m_objects[object])
|
||||
{
|
||||
CLogFile::FormatLine("Error: Load Failed: %s", g_ObjectNames[object]);
|
||||
}
|
||||
m_objects[object]->AddRef();
|
||||
if (GetHelperMaterial())
|
||||
{
|
||||
m_objects[object]->SetMaterial(GetHelperMaterial());
|
||||
}
|
||||
return m_objects[object];
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -51,7 +51,6 @@ public:
|
||||
|
||||
virtual IStatObj* GetObject(EStatObject object);
|
||||
virtual int GetIconTexture(const char* iconName);
|
||||
virtual _smart_ptr<IMaterial> GetHelperMaterial();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Icon bitmaps.
|
||||
@@ -64,14 +63,11 @@ public:
|
||||
virtual void OnNewDocument() { Reset(); };
|
||||
virtual void OnLoadDocument() { Reset(); };
|
||||
virtual void OnCloseDocument() { Reset(); };
|
||||
virtual void OnMissionChange() { Reset(); };
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private:
|
||||
StdMap<QString, int> m_textures;
|
||||
|
||||
_smart_ptr<IMaterial> m_pHelperMtl;
|
||||
|
||||
IStatObj* m_objects[eStatObject_COUNT];
|
||||
int m_icons[eIcon_COUNT];
|
||||
|
||||
|
||||
@@ -61,7 +61,6 @@ struct IIconManager
|
||||
virtual IStatObj* GetObject(EStatObject object) = 0;
|
||||
virtual int GetIconTexture(EIcon icon) = 0;
|
||||
virtual int GetIconTexture(const char* iconName) = 0;
|
||||
virtual _smart_ptr<IMaterial> GetHelperMaterial() = 0;
|
||||
virtual QImage* GetIconBitmap(const char* filename, bool& haveAlpha, uint32 effects = 0) = 0;
|
||||
// Register an Icon for the specific command
|
||||
virtual void RegisterCommandIcon([[maybe_unused]] const char* filename, [[maybe_unused]] int nCommandId) {}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <QTextDocumentFragment>
|
||||
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
#include <AzFramework/API/AtomActiveInterface.h>
|
||||
#include <AzQtComponents/Components/Style.h> // for AzQtComponents::Style
|
||||
|
||||
// Editor
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
namespace SandboxEditor
|
||||
{
|
||||
|
||||
LegacyViewportCameraControllerInstance::LegacyViewportCameraControllerInstance(AzFramework::ViewportId viewportId)
|
||||
: AzFramework::MultiViewportControllerInstanceInterface(viewportId)
|
||||
LegacyViewportCameraControllerInstance::LegacyViewportCameraControllerInstance(AzFramework::ViewportId viewportId, LegacyViewportCameraController* controller)
|
||||
: AzFramework::MultiViewportControllerInstanceInterface<LegacyViewportCameraController>(viewportId, controller)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -28,11 +28,14 @@ namespace AzFramework
|
||||
|
||||
namespace SandboxEditor
|
||||
{
|
||||
class LegacyViewportCameraControllerInstance;
|
||||
using LegacyViewportCameraController = AzFramework::MultiViewportController<LegacyViewportCameraControllerInstance>;
|
||||
|
||||
class LegacyViewportCameraControllerInstance final
|
||||
: public AzFramework::MultiViewportControllerInstanceInterface
|
||||
: public AzFramework::MultiViewportControllerInstanceInterface<LegacyViewportCameraController>
|
||||
{
|
||||
public:
|
||||
explicit LegacyViewportCameraControllerInstance(AzFramework::ViewportId viewport);
|
||||
LegacyViewportCameraControllerInstance(AzFramework::ViewportId viewport, LegacyViewportCameraController* controller);
|
||||
|
||||
bool HandleInputChannelEvent(const AzFramework::ViewportControllerInputEvent& event) override;
|
||||
void ResetInputChannels() override;
|
||||
@@ -69,5 +72,4 @@ namespace SandboxEditor
|
||||
bool m_capturingCursor = false;
|
||||
};
|
||||
|
||||
using LegacyViewportCameraController = AzFramework::MultiViewportController<LegacyViewportCameraControllerInstance>;
|
||||
} //namespace SandboxEditor
|
||||
|
||||
@@ -32,7 +32,6 @@ public:
|
||||
public:
|
||||
MOCK_METHOD0(DeleteThis, void());
|
||||
MOCK_METHOD0(GetSystem, ISystem*());
|
||||
MOCK_METHOD0(Get3DEngine, I3DEngine* ());
|
||||
MOCK_METHOD0(GetRenderer, IRenderer* ());
|
||||
MOCK_METHOD0(GetClassFactory, IEditorClassFactory* ());
|
||||
MOCK_METHOD0(GetCommandManager, CEditorCommandManager*());
|
||||
@@ -191,7 +190,6 @@ public:
|
||||
MOCK_METHOD0(GetBackgroundScheduleManager, struct IBackgroundScheduleManager* ());
|
||||
MOCK_METHOD1(ShowStatusText, void(bool ));
|
||||
MOCK_METHOD1(RegisterObjectContextMenuExtension, void(TContextMenuExtensionFunc ));
|
||||
MOCK_METHOD1(SetCurrentMissionTime, void(float ));
|
||||
MOCK_METHOD0(GetEnv, SSystemGlobalEnvironment* ());
|
||||
MOCK_METHOD0(GetImageUtil, IImageUtil* ());
|
||||
MOCK_METHOD0(GetEditorSettings, SEditorSettings* ());
|
||||
|
||||
@@ -44,7 +44,6 @@ namespace LyViewPane
|
||||
static const char* const TerrainTool = "Terrain Tool";
|
||||
static const char* const TerrainTextureLayers = "Terrain Texture Layers";
|
||||
static const char* const ParticleEditor = "Particle Editor";
|
||||
static const char* const TimeOfDayEditor = "Time Of Day";
|
||||
static const char* const AudioControlsEditor = "Audio Controls Editor";
|
||||
static const char* const SubstanceEditor = "Substance Editor";
|
||||
static const char* const VegetationEditor = "Vegetation Editor";
|
||||
|
||||
@@ -42,7 +42,6 @@ AZ_POP_DISABLE_WARNING
|
||||
#include <AzFramework/Input/Devices/Mouse/InputDeviceMouse.h>
|
||||
#include <AzFramework/Network/SocketConnection.h>
|
||||
#include <AzFramework/Asset/AssetSystemComponent.h>
|
||||
#include <AzFramework/API/AtomActiveInterface.h>
|
||||
|
||||
// AzToolsFramework
|
||||
#include <AzToolsFramework/Application/Ticker.h>
|
||||
@@ -91,7 +90,6 @@ AZ_POP_DISABLE_WARNING
|
||||
|
||||
#include "TrackView/TrackViewDialog.h"
|
||||
#include "ErrorReportDialog.h"
|
||||
#include "TimeOfDayDialog.h"
|
||||
|
||||
#include "Dialogs/PythonScriptsDialog.h"
|
||||
#include "EngineSettingsManager.h"
|
||||
@@ -885,9 +883,6 @@ void MainWindow::InitActions()
|
||||
.SetStatusTip(tr("Restore saved state (Fetch)"));
|
||||
|
||||
// Modify actions
|
||||
am->AddAction(ID_EDIT_RENAMEOBJECT, tr("Rename Object(s)..."))
|
||||
.SetStatusTip(tr("Rename Object"));
|
||||
|
||||
am->AddAction(ID_EDITMODE_MOVE, tr("Move"))
|
||||
.SetIcon(Style::icon("Move"))
|
||||
.SetApplyHoverEffect()
|
||||
@@ -1082,8 +1077,6 @@ void MainWindow::InitActions()
|
||||
// Tools actions
|
||||
am->AddAction(ID_RELOAD_TEXTURES, tr("Reload Textures/Shaders"))
|
||||
.SetStatusTip(tr("Reload all textures."));
|
||||
am->AddAction(ID_RELOAD_GEOMETRY, tr("Reload Geometry"))
|
||||
.SetStatusTip(tr("Reload all geometries."));
|
||||
am->AddAction(ID_TOOLS_ENABLEFILECHANGEMONITORING, tr("Enable File Change Monitoring"));
|
||||
am->AddAction(ID_CLEAR_REGISTRY, tr("Clear Registry Data"))
|
||||
.SetStatusTip(tr("Clear Registry Data"));
|
||||
@@ -1093,7 +1086,7 @@ void MainWindow::InitActions()
|
||||
QAction* saveLevelStatsAction =
|
||||
am->AddAction(ID_TOOLS_LOGMEMORYUSAGE, tr("Save Level Statistics"))
|
||||
.SetStatusTip(tr("Logs Editor memory usage."));
|
||||
if( saveLevelStatsAction && AZ::Interface<AzFramework::AtomActiveInterface>::Get())
|
||||
if( saveLevelStatsAction )
|
||||
{
|
||||
saveLevelStatsAction->setEnabled(false);
|
||||
}
|
||||
@@ -1189,13 +1182,6 @@ void MainWindow::InitActions()
|
||||
.SetIcon(Style::icon("Audio"))
|
||||
.SetApplyHoverEffect();
|
||||
|
||||
if (!AZ::Interface<AzFramework::AtomActiveInterface>::Get())
|
||||
{
|
||||
am->AddAction(ID_TERRAIN_TIMEOFDAYBUTTON, tr("Time of Day Editor"))
|
||||
.SetToolTip(tr("Open Time of Day"))
|
||||
.SetApplyHoverEffect();
|
||||
}
|
||||
|
||||
am->AddAction(ID_OPEN_UICANVASEDITOR, tr(LyViewPane::UiEditor))
|
||||
.SetToolTip(tr("Open UI Editor"))
|
||||
.SetApplyHoverEffect();
|
||||
@@ -1341,7 +1327,7 @@ QToolButton* MainWindow::CreateDebugModeButton()
|
||||
|
||||
QWidget* MainWindow::CreateSpacerRightWidget()
|
||||
{
|
||||
QWidget* spacer = new QWidget();
|
||||
QWidget* spacer = new QWidget(this);
|
||||
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
spacer->setVisible(true);
|
||||
return spacer;
|
||||
@@ -1363,12 +1349,6 @@ void MainWindow::InitEnvironmentModeMenu(CVarMenu* environmentModeMenu)
|
||||
environmentModeMenu->AddCVarToggleItem({ "r_ssdo", tr("Hide Screen Space Directional Occlusion"), 0, 1 });
|
||||
environmentModeMenu->AddCVarToggleItem({ "e_DynamicLights", tr("Hide All Dynamic Lights"), 0, 1 });
|
||||
environmentModeMenu->AddSeparator();
|
||||
environmentModeMenu->AddCVarValuesItem("e_TimeOfDay", tr("Time of Day"),
|
||||
{
|
||||
{tr("Day (1:00 pm)"), 13},
|
||||
{tr("Night (9:00 pm)"), 21}
|
||||
}, 9);
|
||||
environmentModeMenu->AddSeparator();
|
||||
environmentModeMenu->AddCVarToggleItem({ "e_Entities", tr("Hide Entities"), 0, 1 });
|
||||
environmentModeMenu->AddSeparator();
|
||||
environmentModeMenu->AddCVarToggleItem({ "e_Vegetation", tr("Hide Vegetation"), 0, 1 });
|
||||
@@ -1652,10 +1632,6 @@ void MainWindow::RegisterStdViewClasses()
|
||||
AzAssetBrowserWindow::RegisterViewClass();
|
||||
AssetEditorWindow::RegisterViewClass();
|
||||
|
||||
if (!AZ::Interface<AzFramework::AtomActiveInterface>::Get())
|
||||
{
|
||||
CTimeOfDayDialog::RegisterViewClass();
|
||||
}
|
||||
#ifdef ThumbnailDemo
|
||||
ThumbnailsSampleWidget::RegisterViewClass();
|
||||
#endif
|
||||
|
||||
@@ -1,364 +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.
|
||||
|
||||
// Description : CMission class implementation.
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "Mission.h"
|
||||
|
||||
// cryCommon
|
||||
#include <CryCommon/ITimeOfDay.h>
|
||||
#include <CryCommon/I3DEngine.h>
|
||||
|
||||
// Editor
|
||||
#include "CryEditDoc.h"
|
||||
#include "GameEngine.h"
|
||||
#include "Include/IObjectManager.h"
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
const char* kTimeOfDayFile = "TimeOfDay.xml";
|
||||
const char* kTimeOfDayRoot = "TimeOfDay";
|
||||
const char* kEnvironmentFile = "Environment.xml";
|
||||
const char* kEnvironmentRoot = "Environment";
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CMission::CMission(CCryEditDoc* doc)
|
||||
{
|
||||
m_doc = doc;
|
||||
m_objects = XmlHelpers::CreateXmlNode("Objects");
|
||||
m_layers = XmlHelpers::CreateXmlNode("ObjectLayers");
|
||||
//m_exportData = XmlNodeRef( "ExportData" );
|
||||
m_timeOfDay = XmlHelpers::CreateXmlNode("TimeOfDay");
|
||||
m_environment = XmlHelpers::CreateXmlNode("Environment");
|
||||
CXmlTemplate::SetValues(m_doc->GetEnvironmentTemplate(), m_environment);
|
||||
|
||||
m_time = 12; // 12 PM by default.
|
||||
|
||||
m_numCGFObjects = 0;
|
||||
|
||||
m_reentrancyProtector = false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CMission::~CMission()
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CMission* CMission::Clone()
|
||||
{
|
||||
CMission* m = new CMission(m_doc);
|
||||
m->SetName(m_name);
|
||||
m->SetDescription(m_description);
|
||||
m->m_objects = m_objects->clone();
|
||||
m->m_layers = m_layers->clone();
|
||||
m->m_environment = m_environment->clone();
|
||||
m->m_time = m_time;
|
||||
return m;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMission::Serialize(CXmlArchive& ar, bool bParts)
|
||||
{
|
||||
if (ar.bLoading)
|
||||
{
|
||||
// Load.
|
||||
ar.root->getAttr("Name", m_name);
|
||||
ar.root->getAttr("Description", m_description);
|
||||
|
||||
XmlNodeRef objects = ar.root->findChild("Objects");
|
||||
if (objects)
|
||||
{
|
||||
m_objects = objects;
|
||||
}
|
||||
|
||||
XmlNodeRef layers = ar.root->findChild("ObjectLayers");
|
||||
if (layers)
|
||||
{
|
||||
m_layers = layers;
|
||||
}
|
||||
|
||||
SerializeTimeOfDay(ar);
|
||||
|
||||
m_Animations = ar.root->findChild("MovieData");
|
||||
|
||||
SerializeEnvironment(ar);
|
||||
}
|
||||
else
|
||||
{
|
||||
ar.root->setAttr("Name", m_name.toUtf8().data());
|
||||
ar.root->setAttr("Description", m_description.toUtf8().data());
|
||||
|
||||
QString timeStr;
|
||||
int nHour = floor(m_time);
|
||||
int nMins = (m_time - floor(m_time)) * 60.0f;
|
||||
timeStr = QStringLiteral("%1:%2").arg(nHour, 2, 10, QLatin1Char('0')).arg(nMins, 2, 10, QLatin1Char('0'));
|
||||
ar.root->setAttr("MissionTime", timeStr.toUtf8().data());
|
||||
|
||||
// Saving.
|
||||
XmlNodeRef layers = m_layers->clone();
|
||||
layers->setTag("ObjectLayers");
|
||||
ar.root->addChild(layers);
|
||||
|
||||
///XmlNodeRef objects = m_objects->clone();
|
||||
m_objects->setTag("Objects");
|
||||
ar.root->addChild(m_objects);
|
||||
|
||||
if (bParts)
|
||||
{
|
||||
SerializeTimeOfDay(ar);
|
||||
SerializeEnvironment(ar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMission::Export(XmlNodeRef& root, XmlNodeRef& objectsNode)
|
||||
{
|
||||
// Also save exported objects data.
|
||||
root->setAttr("Name", m_name.toUtf8().data());
|
||||
root->setAttr("Description", m_description.toUtf8().data());
|
||||
|
||||
QString timeStr;
|
||||
int nHour = floor(m_time);
|
||||
int nMins = (m_time - floor(m_time)) * 60.0f;
|
||||
timeStr = QStringLiteral("%1:%2").arg(nHour, 2, 10, QLatin1Char('0')).arg(nMins, 2, 10, QLatin1Char('0'));
|
||||
root->setAttr("Time", timeStr.toUtf8().data());
|
||||
|
||||
// Saving.
|
||||
//XmlNodeRef objects = m_exportData->clone();
|
||||
//objects->setTag( "Objects" );
|
||||
//root->addChild( objects );
|
||||
|
||||
XmlNodeRef envNode = m_environment->clone();
|
||||
root->addChild(envNode);
|
||||
|
||||
m_timeOfDay->setAttr("Time", m_time);
|
||||
root->addChild(m_timeOfDay);
|
||||
|
||||
IObjectManager* pObjMan = GetIEditor()->GetObjectManager();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Serialize objects.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QString path = QDir::toNativeSeparators(QFileInfo(m_doc->GetLevelPathName()).absolutePath());
|
||||
if (!path.endsWith(QDir::separator()))
|
||||
path += QDir::separator();
|
||||
|
||||
objectsNode = root->newChild("Objects");
|
||||
pObjMan->Export(path, objectsNode, true); // Export shared.
|
||||
pObjMan->Export(path, objectsNode, false); // Export not shared.
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMission::SyncContent(bool bRetrieve, bool bIgnoreObjects, [[maybe_unused]] bool bSkipLoadingAI /* = false */)
|
||||
{
|
||||
// The function may take a longer time when executing objMan->Serialize, which uses CWaitProgress internally
|
||||
// Adding a sync flag to prevent the function from being re-entered after the data is modified by OnEnvironmentChange
|
||||
if (m_reentrancyProtector)
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_reentrancyProtector = true;
|
||||
|
||||
// Save data from current Document to Mission.
|
||||
IObjectManager* objMan = GetIEditor()->GetObjectManager();
|
||||
if (bRetrieve)
|
||||
{
|
||||
// Activating this mission.
|
||||
CGameEngine* gameEngine = GetIEditor()->GetGameEngine();
|
||||
|
||||
if (!bIgnoreObjects)
|
||||
{
|
||||
// Retrieve data from Mission and put to document.
|
||||
XmlNodeRef root = XmlHelpers::CreateXmlNode("Root");
|
||||
root->addChild(m_objects);
|
||||
root->addChild(m_layers);
|
||||
objMan->Serialize(root, true, SERIALIZE_ONLY_NOTSHARED);
|
||||
}
|
||||
|
||||
m_doc->GetFogTemplate() = m_environment;
|
||||
|
||||
CXmlTemplate::GetValues(m_doc->GetEnvironmentTemplate(), m_environment);
|
||||
|
||||
gameEngine->ReloadEnvironment();
|
||||
|
||||
objMan->SendEvent(EVENT_MISSION_CHANGE);
|
||||
m_doc->ChangeMission();
|
||||
|
||||
if (GetIEditor()->Get3DEngine())
|
||||
{
|
||||
m_numCGFObjects = GetIEditor()->Get3DEngine()->GetLoadedObjectCount();
|
||||
|
||||
// Load time of day.
|
||||
GetIEditor()->Get3DEngine()->GetTimeOfDay()->Serialize(m_timeOfDay, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save time of day.
|
||||
if (GetIEditor()->Get3DEngine())
|
||||
{
|
||||
m_timeOfDay = XmlHelpers::CreateXmlNode("TimeOfDay");
|
||||
GetIEditor()->Get3DEngine()->GetTimeOfDay()->Serialize(m_timeOfDay, false);
|
||||
}
|
||||
|
||||
if (!bIgnoreObjects)
|
||||
{
|
||||
XmlNodeRef root = XmlHelpers::CreateXmlNode("Root");
|
||||
objMan->Serialize(root, false, SERIALIZE_ONLY_NOTSHARED);
|
||||
m_objects = root->findChild("Objects");
|
||||
XmlNodeRef layers = root->findChild("ObjectLayers");
|
||||
if (layers)
|
||||
{
|
||||
m_layers = layers;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_reentrancyProtector = false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMission::OnEnvironmentChange()
|
||||
{
|
||||
// Only execute the reload function if there is no ongoing SyncContent.
|
||||
if (m_reentrancyProtector)
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_reentrancyProtector = true;
|
||||
m_environment = XmlHelpers::CreateXmlNode("Environment");
|
||||
CXmlTemplate::SetValues(m_doc->GetEnvironmentTemplate(), m_environment);
|
||||
m_reentrancyProtector = false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMission::AddObjectsNode(XmlNodeRef& node)
|
||||
{
|
||||
for (int i = 0; i < node->getChildCount(); i++)
|
||||
{
|
||||
m_objects->addChild(node->getChild(i)->clone());
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMission::SetLayersNode(XmlNodeRef& node)
|
||||
{
|
||||
m_layers = node->clone();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMission::SaveParts()
|
||||
{
|
||||
// Save Time of Day
|
||||
{
|
||||
CTempFileHelper helper((GetIEditor()->GetLevelDataFolder() + kTimeOfDayFile).toUtf8().data());
|
||||
|
||||
m_timeOfDay->saveToFile(helper.GetTempFilePath().toUtf8().data());
|
||||
|
||||
if (!helper.UpdateFile(false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Save Environment
|
||||
{
|
||||
CTempFileHelper helper((GetIEditor()->GetLevelDataFolder() + kEnvironmentFile).toUtf8().data());
|
||||
|
||||
XmlNodeRef root = m_environment->clone();
|
||||
root->setTag(kEnvironmentRoot);
|
||||
root->saveToFile(helper.GetTempFilePath().toUtf8().data());
|
||||
|
||||
if (!helper.UpdateFile(false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMission::LoadParts()
|
||||
{
|
||||
// Load Time of Day
|
||||
{
|
||||
QString filename = GetIEditor()->GetLevelDataFolder() + kTimeOfDayFile;
|
||||
XmlNodeRef root = XmlHelpers::LoadXmlFromFile(filename.toUtf8().data());
|
||||
if (root && !_stricmp(root->getTag(), kTimeOfDayRoot))
|
||||
{
|
||||
m_timeOfDay = root;
|
||||
m_timeOfDay->getAttr("Time", m_time);
|
||||
}
|
||||
}
|
||||
|
||||
// Load Environment
|
||||
{
|
||||
QString filename = GetIEditor()->GetLevelDataFolder() + kEnvironmentFile;
|
||||
XmlNodeRef root = XmlHelpers::LoadXmlFromFile(filename.toUtf8().data());
|
||||
if (root && !_stricmp(root->getTag(), kEnvironmentRoot))
|
||||
{
|
||||
m_environment = root;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMission::SerializeTimeOfDay(CXmlArchive& ar)
|
||||
{
|
||||
if (ar.bLoading)
|
||||
{
|
||||
XmlNodeRef todNode = ar.root->findChild("TimeOfDay");
|
||||
if (todNode)
|
||||
{
|
||||
m_timeOfDay = todNode;
|
||||
todNode->getAttr("Time", m_time);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_timeOfDay = XmlHelpers::CreateXmlNode("TimeOfDay");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_timeOfDay->setAttr("Time", m_time);
|
||||
ar.root->addChild(m_timeOfDay);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CMission::SerializeEnvironment(CXmlArchive& ar)
|
||||
{
|
||||
if (ar.bLoading)
|
||||
{
|
||||
XmlNodeRef env = ar.root->findChild("Environment");
|
||||
if (env)
|
||||
{
|
||||
m_environment = env;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
XmlNodeRef env = m_environment->clone();
|
||||
env->setTag("Environment");
|
||||
ar.root->addChild(env);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,105 +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.
|
||||
|
||||
// Description : Mission class definition.
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
/*!
|
||||
CMission represent single Game Mission on same map.
|
||||
Multiple Missions share same map, and stored in one .cry or .ly file.
|
||||
|
||||
*/
|
||||
class CMission
|
||||
{
|
||||
public:
|
||||
//! Ctor of mission.
|
||||
CMission(CCryEditDoc* doc);
|
||||
//! Dtor of mission.
|
||||
virtual ~CMission();
|
||||
|
||||
void SetName(const QString& name) { m_name = name; }
|
||||
const QString& GetName() const { return m_name; }
|
||||
|
||||
void SetDescription(const QString& dsc) { m_description = dsc; }
|
||||
const QString& GetDescription() const { return m_description; }
|
||||
|
||||
XmlNodeRef GetEnvironment() { return m_environment; };
|
||||
|
||||
void SetTime(float time) { m_time = time; };
|
||||
float GetTime() const { return m_time; };
|
||||
|
||||
//! Called when this mission must be synchonized with current data in Document.
|
||||
//! if bRetrieve is true, data is retrieved from Mission to global structures.
|
||||
void SyncContent(bool bRetrieve, bool bIgnoreObjects, bool bSkipLoadingAI = false);
|
||||
|
||||
//! Create clone of this mission.
|
||||
CMission* Clone();
|
||||
|
||||
//! Serialize mission.
|
||||
void Serialize(CXmlArchive& ar, bool bParts = true);
|
||||
|
||||
//! Serialize time of day
|
||||
void SerializeTimeOfDay(CXmlArchive& ar);
|
||||
|
||||
//! Serialize environment
|
||||
void SerializeEnvironment(CXmlArchive& ar);
|
||||
|
||||
//! Save some elements of mission to separate files
|
||||
void SaveParts();
|
||||
|
||||
//! Load some elements of mission from separate files
|
||||
void LoadParts();
|
||||
|
||||
//! Export mission to game.
|
||||
void Export(XmlNodeRef& root, XmlNodeRef& objectsNode);
|
||||
|
||||
//! Add shared objects to mission objects.
|
||||
void AddObjectsNode(XmlNodeRef& node);
|
||||
void SetLayersNode(XmlNodeRef& node);
|
||||
|
||||
void OnEnvironmentChange();
|
||||
int GetNumCGFObjects() const { return m_numCGFObjects; };
|
||||
|
||||
private:
|
||||
//! Document owner of this mission.
|
||||
CCryEditDoc* m_doc;
|
||||
|
||||
QString m_name;
|
||||
QString m_description;
|
||||
|
||||
//! Mission time;
|
||||
float m_time;
|
||||
|
||||
//! Root node of objects defined only in this mission.
|
||||
XmlNodeRef m_objects;
|
||||
|
||||
//! Object layers.
|
||||
XmlNodeRef m_layers;
|
||||
|
||||
//! Exported data of this mission.
|
||||
XmlNodeRef m_exportData;
|
||||
|
||||
//! Environment settings of this mission.
|
||||
XmlNodeRef m_environment;
|
||||
|
||||
XmlNodeRef m_Animations; // backward compatibility.
|
||||
|
||||
XmlNodeRef m_timeOfDay;
|
||||
|
||||
int m_numCGFObjects;
|
||||
|
||||
bool m_reentrancyProtector;
|
||||
};
|
||||
|
||||
@@ -1,961 +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 "ModelViewport.h"
|
||||
|
||||
// Qt
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
|
||||
// CryCommon
|
||||
#include <CryCommon/IViewSystem.h>
|
||||
|
||||
#include "CryPhysicsDeprecation.h"
|
||||
|
||||
|
||||
// Editor
|
||||
#include "ThumbnailGenerator.h" // for CThumbnailGenerator
|
||||
#include "FileTypeUtils.h" // for IsPreviewableFileType
|
||||
#include "ErrorRecorder.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
uint32 g_ypos = 0;
|
||||
|
||||
#define SKYBOX_NAME "InfoRedGal"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CModelViewport
|
||||
|
||||
CModelViewport::CModelViewport(const char* settingsPath, QWidget* parent)
|
||||
: CRenderViewport(tr("Model View"), parent)
|
||||
{
|
||||
m_settingsPath = QString::fromLatin1(settingsPath);
|
||||
|
||||
m_bPaused = false;
|
||||
|
||||
m_Camera.SetFrustum(800, 600, 3.14f / 4.0f, 0.02f, 10000);
|
||||
|
||||
m_bInRotateMode = false;
|
||||
m_bInMoveMode = false;
|
||||
|
||||
m_object = 0;
|
||||
|
||||
|
||||
m_weaponModel = 0;
|
||||
|
||||
m_camRadius = 10;
|
||||
|
||||
m_moveSpeed = 0.1f;
|
||||
m_LightRotationRadian = 0.0f;
|
||||
|
||||
m_weaponIK = false;
|
||||
|
||||
m_pRESky = 0;
|
||||
m_pSkyboxName = 0;
|
||||
m_pSkyBoxShader = NULL;
|
||||
|
||||
m_attachBone = QStringLiteral("weapon_bone");
|
||||
|
||||
// Init variable.
|
||||
mv_objectAmbientColor = Vec3(0.25f, 0.25f, 0.25f);
|
||||
mv_backgroundColor = Vec3(0.25f, 0.25f, 0.25f);
|
||||
|
||||
mv_lightDiffuseColor = Vec3(0.70f, 0.70f, 0.70f);
|
||||
mv_lightMultiplier = 3.0f;
|
||||
mv_lightOrbit = 15.0f;
|
||||
mv_lightRadius = 400.0f;
|
||||
mv_lightSpecMultiplier = 1.0f;
|
||||
|
||||
mv_showPhysics = false;
|
||||
|
||||
m_GridOrigin = Vec3(ZERO);
|
||||
m_arrAnimatedCharacterPath.resize(0x200, ZERO);
|
||||
m_arrSmoothEntityPath.resize(0x200, ZERO);
|
||||
|
||||
m_arrRunStrafeSmoothing.resize(0x100);
|
||||
SetPlayerPos();
|
||||
|
||||
// cache all the variable callbacks, must match order of enum defined in header
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CModelViewport::OnCharPhysics, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CModelViewport::OnLightColor, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CModelViewport::OnLightMultiplier, this, AZStd::placeholders::_1));
|
||||
m_onSetCallbacksCache.push_back(AZStd::bind(&CModelViewport::OnShowShaders, this, AZStd::placeholders::_1));
|
||||
|
||||
//--------------------------------------------------
|
||||
// Register variables.
|
||||
//--------------------------------------------------
|
||||
m_vars.AddVariable(mv_showPhysics, "Display Physics");
|
||||
m_vars.AddVariable(mv_useCharPhysics, "Use Character Physics", &m_onSetCallbacksCache[VariableCallbackIndex::OnCharPhysics]);
|
||||
mv_useCharPhysics = true;
|
||||
m_vars.AddVariable(mv_showGrid, "ShowGrid");
|
||||
mv_showGrid = true;
|
||||
m_vars.AddVariable(mv_showBase, "ShowBase");
|
||||
mv_showBase = false;
|
||||
m_vars.AddVariable(mv_showLocator, "ShowLocator");
|
||||
mv_showLocator = 0;
|
||||
m_vars.AddVariable(mv_InPlaceMovement, "InPlaceMovement");
|
||||
mv_InPlaceMovement = false;
|
||||
m_vars.AddVariable(mv_StrafingControl, "StrafingControl");
|
||||
mv_StrafingControl = false;
|
||||
|
||||
m_vars.AddVariable(mv_lighting, "Lighting");
|
||||
mv_lighting = true;
|
||||
m_vars.AddVariable(mv_animateLights, "AnimLights");
|
||||
|
||||
m_vars.AddVariable(mv_backgroundColor, "BackgroundColor", &m_onSetCallbacksCache[VariableCallbackIndex::OnLightColor], IVariable::DT_COLOR);
|
||||
m_vars.AddVariable(mv_objectAmbientColor, "ObjectAmbient", &m_onSetCallbacksCache[VariableCallbackIndex::OnLightColor], IVariable::DT_COLOR);
|
||||
|
||||
m_vars.AddVariable(mv_lightDiffuseColor, "LightDiffuse", &m_onSetCallbacksCache[VariableCallbackIndex::OnLightColor], IVariable::DT_COLOR);
|
||||
m_vars.AddVariable(mv_lightMultiplier, "Light Multiplier", &m_onSetCallbacksCache[VariableCallbackIndex::OnLightMultiplier], IVariable::DT_SIMPLE);
|
||||
m_vars.AddVariable(mv_lightSpecMultiplier, "Light Specular Multiplier", &m_onSetCallbacksCache[VariableCallbackIndex::OnLightMultiplier], IVariable::DT_SIMPLE);
|
||||
m_vars.AddVariable(mv_lightRadius, "Light Radius", &m_onSetCallbacksCache[VariableCallbackIndex::OnLightMultiplier], IVariable::DT_SIMPLE);
|
||||
m_vars.AddVariable(mv_lightOrbit, "Light Orbit", &m_onSetCallbacksCache[VariableCallbackIndex::OnLightMultiplier], IVariable::DT_SIMPLE);
|
||||
|
||||
m_vars.AddVariable(mv_showWireframe1, "ShowWireframe1");
|
||||
m_vars.AddVariable(mv_showWireframe2, "ShowWireframe2");
|
||||
m_vars.AddVariable(mv_showTangents, "ShowTangents");
|
||||
m_vars.AddVariable(mv_showBinormals, "ShowBinormals");
|
||||
m_vars.AddVariable(mv_showNormals, "ShowNormals");
|
||||
|
||||
m_vars.AddVariable(mv_showSkeleton, "ShowSkeleton");
|
||||
m_vars.AddVariable(mv_showJointNames, "ShowJointNames");
|
||||
m_vars.AddVariable(mv_showJointsValues, "ShowJointsValues");
|
||||
m_vars.AddVariable(mv_showStartLocation, "ShowInvStartLocation");
|
||||
m_vars.AddVariable(mv_showMotionParam, "ShowMotionParam");
|
||||
m_vars.AddVariable(mv_printDebugText, "PrintDebugText");
|
||||
|
||||
m_vars.AddVariable(mv_UniformScaling, "UniformScaling");
|
||||
mv_UniformScaling = 1.0f;
|
||||
mv_UniformScaling.SetLimits(0.01f, 2.0f);
|
||||
m_vars.AddVariable(mv_forceLODNum, "ForceLODNum");
|
||||
mv_forceLODNum = 0;
|
||||
mv_forceLODNum.SetLimits(0, 10);
|
||||
m_vars.AddVariable(mv_showShaders, "ShowShaders", &m_onSetCallbacksCache[VariableCallbackIndex::OnShowShaders]);
|
||||
m_vars.AddVariable(mv_AttachCamera, "AttachCamera");
|
||||
|
||||
m_vars.AddVariable(mv_fov, "FOV");
|
||||
mv_fov = 60;
|
||||
mv_fov.SetLimits(1, 120);
|
||||
|
||||
RestoreDebugOptions();
|
||||
|
||||
m_camRadius = 10;
|
||||
|
||||
//YPR_Angle = Ang3(0,-1.0f,0);
|
||||
//SetViewTM( Matrix34(CCamera::CreateOrientationYPR(YPR_Angle), Vec3(0,-m_camRadius,0)) );
|
||||
Vec3 camPos = Vec3(10, 10, 10);
|
||||
Matrix34 tm = Matrix33::CreateRotationVDir((Vec3(0, 0, 0) - camPos).GetNormalized());
|
||||
tm.SetTranslation(camPos);
|
||||
SetViewTM(tm);
|
||||
|
||||
|
||||
m_AABB.Reset();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::SaveDebugOptions() const
|
||||
{
|
||||
QSettings settings;
|
||||
for (auto g : m_settingsPath.split('\\'))
|
||||
settings.beginGroup(g);
|
||||
|
||||
CVarBlock* vb = GetVarObject()->GetVarBlock();
|
||||
int32 vbCount = vb->GetNumVariables();
|
||||
|
||||
settings.setValue("iDebugOptionCount", vbCount);
|
||||
|
||||
char keyType[64], keyValue[64];
|
||||
for (int32 i = 0; i < vbCount; ++i)
|
||||
{
|
||||
IVariable* var = vb->GetVariable(i);
|
||||
IVariable::EType vType = var->GetType();
|
||||
sprintf_s(keyType, "DebugOption_%s_type", var->GetName().toUtf8().data());
|
||||
sprintf_s(keyValue, "DebugOption_%s_value", var->GetName().toUtf8().data());
|
||||
switch (vType)
|
||||
{
|
||||
case IVariable::UNKNOWN:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case IVariable::INT:
|
||||
{
|
||||
int32 value = 0;
|
||||
var->Get(value);
|
||||
settings.setValue(keyType, IVariable::INT);
|
||||
settings.setValue(keyValue, value);
|
||||
|
||||
break;
|
||||
}
|
||||
case IVariable::BOOL:
|
||||
{
|
||||
bool value = 0;
|
||||
var->Get(value);
|
||||
settings.setValue(keyType, IVariable::BOOL);
|
||||
settings.setValue(keyValue, value);
|
||||
break;
|
||||
}
|
||||
case IVariable::FLOAT:
|
||||
{
|
||||
f32 value = 0;
|
||||
var->Get(value);
|
||||
settings.setValue(keyType, IVariable::FLOAT);
|
||||
settings.setValue(keyValue, value);
|
||||
break;
|
||||
}
|
||||
case IVariable::VECTOR:
|
||||
{
|
||||
Vec3 value;
|
||||
var->Get(value);
|
||||
f32 valueArray[3];
|
||||
valueArray[0] = value.x;
|
||||
valueArray[1] = value.y;
|
||||
valueArray[2] = value.z;
|
||||
settings.setValue(keyType, IVariable::VECTOR);
|
||||
settings.setValue(keyValue, QByteArray(reinterpret_cast<const char*>(&value), 3 * sizeof(f32)));
|
||||
|
||||
break;
|
||||
}
|
||||
case IVariable::QUAT:
|
||||
{
|
||||
Quat value;
|
||||
var->Get(value);
|
||||
f32 valueArray[4];
|
||||
valueArray[0] = value.w;
|
||||
valueArray[1] = value.v.x;
|
||||
valueArray[2] = value.v.y;
|
||||
valueArray[3] = value.v.z;
|
||||
|
||||
settings.setValue(keyType, IVariable::QUAT);
|
||||
settings.setValue(keyValue, QByteArray(reinterpret_cast<const char*>(&value), 4 * sizeof(f32)));
|
||||
|
||||
break;
|
||||
}
|
||||
case IVariable::STRING:
|
||||
{
|
||||
QString value;
|
||||
var->Get(value);
|
||||
settings.setValue(keyType, IVariable::STRING);
|
||||
settings.setValue(keyValue, value);
|
||||
|
||||
break;
|
||||
}
|
||||
case IVariable::ARRAY:
|
||||
{
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::RestoreDebugOptions()
|
||||
{
|
||||
QSettings settings;
|
||||
for (auto g : m_settingsPath.split('\\'))
|
||||
settings.beginGroup(g);
|
||||
|
||||
QString strRead = "";
|
||||
int32 iRead = 0;
|
||||
BOOL bRead = FALSE;
|
||||
f32 fRead = .0f;
|
||||
QByteArray pbtData;
|
||||
|
||||
CVarBlock* vb = m_vars.GetVarBlock();
|
||||
int32 vbCount = vb->GetNumVariables();
|
||||
|
||||
char keyType[64], keyValue[64];
|
||||
for (int32 i = 0; i < vbCount; ++i)
|
||||
{
|
||||
IVariable* var = vb->GetVariable(i);
|
||||
sprintf_s(keyType, "DebugOption_%s_type", var->GetName().toUtf8().data());
|
||||
|
||||
int32 iType = settings.value(keyType, 0).toInt();
|
||||
|
||||
sprintf_s(keyValue, "DebugOption_%s_value", var->GetName().toUtf8().data());
|
||||
switch (iType)
|
||||
{
|
||||
case IVariable::UNKNOWN:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case IVariable::INT:
|
||||
{
|
||||
iRead = settings.value(keyValue, 0).toInt();
|
||||
var->Set(iRead);
|
||||
break;
|
||||
}
|
||||
case IVariable::BOOL:
|
||||
{
|
||||
bRead = settings.value(keyValue, FALSE).toBool();
|
||||
var->Set(bRead);
|
||||
break;
|
||||
}
|
||||
case IVariable::FLOAT:
|
||||
{
|
||||
fRead = settings.value(keyValue).toDouble();
|
||||
var->Set(fRead);
|
||||
break;
|
||||
}
|
||||
case IVariable::VECTOR:
|
||||
{
|
||||
pbtData = settings.value(keyValue).toByteArray();
|
||||
assert(pbtData.count() == 3 * sizeof(f32));
|
||||
f32* pfRead = reinterpret_cast<f32*>(pbtData.data());
|
||||
|
||||
Vec3 vecRead(pfRead[0], pfRead[1], pfRead[2]);
|
||||
var->Set(vecRead);
|
||||
break;
|
||||
}
|
||||
case IVariable::QUAT:
|
||||
{
|
||||
pbtData = settings.value(keyValue).toByteArray();
|
||||
assert(pbtData.count() == 4 * sizeof(f32));
|
||||
f32* pfRead = reinterpret_cast<f32*>(pbtData.data());
|
||||
|
||||
Quat valueRead(pfRead[0], pfRead[1], pfRead[2], pfRead[3]);
|
||||
var->Set(valueRead);
|
||||
break;
|
||||
}
|
||||
case IVariable::STRING:
|
||||
{
|
||||
strRead = settings.value(keyValue, "").toString();
|
||||
var->Set(strRead);
|
||||
break;
|
||||
}
|
||||
case IVariable::ARRAY:
|
||||
{
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CModelViewport::~CModelViewport()
|
||||
{
|
||||
OnDestroy();
|
||||
ReleaseObject();
|
||||
|
||||
GetIEditor()->FlushUndo();
|
||||
|
||||
SaveDebugOptions();
|
||||
|
||||
// helper offset??
|
||||
CRY_PHYSICS_REPLACEMENT_ASSERT();
|
||||
GetIEditor()->SetConsoleVar("ca_UsePhysics", 1);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CModelViewport message handlers
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::ReleaseObject()
|
||||
{
|
||||
if (m_object)
|
||||
{
|
||||
m_object->Release();
|
||||
m_object = NULL;
|
||||
}
|
||||
|
||||
if (m_weaponModel)
|
||||
{
|
||||
m_weaponModel->Release();
|
||||
m_weaponModel = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::LoadObject(const QString& fileName, [[maybe_unused]] float scale)
|
||||
{
|
||||
m_bPaused = false;
|
||||
|
||||
// Load object.
|
||||
QString file = Path::MakeGamePath(fileName);
|
||||
|
||||
bool reload = false;
|
||||
if (m_loadedFile == file)
|
||||
{
|
||||
reload = true;
|
||||
}
|
||||
m_loadedFile = file;
|
||||
|
||||
SetName(tr("Model View - %1").arg(file));
|
||||
|
||||
ReleaseObject();
|
||||
|
||||
// Enables display of warning after model have been loaded.
|
||||
CErrorsRecorder errRecorder;
|
||||
|
||||
if (IsPreviewableFileType(file.toUtf8().data()))
|
||||
{
|
||||
const QString fileExt = QFileInfo(file).completeSuffix();
|
||||
// Try Load character.
|
||||
const bool isSKEL = (0 == fileExt.compare(CRY_SKEL_FILE_EXT, Qt::CaseInsensitive));
|
||||
const bool isSKIN = (0 == fileExt.compare(CRY_SKIN_FILE_EXT, Qt::CaseInsensitive));
|
||||
const bool isCGA = (0 == fileExt.compare(CRY_ANIM_GEOMETRY_FILE_EXT, Qt::CaseInsensitive));
|
||||
const bool isCDF = (0 == fileExt.compare(CRY_CHARACTER_DEFINITION_FILE_EXT, Qt::CaseInsensitive));
|
||||
if (isSKEL || isSKIN || isCGA || isCDF)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadStaticObject(file);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::warning(this, tr("Preview Error"), tr("Preview of this file type not supported."));
|
||||
return;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
if (!reload)
|
||||
{
|
||||
Vec3 v = m_AABB.max - m_AABB.min;
|
||||
float radius = v.GetLength() / 2.0f;
|
||||
m_camRadius = radius * 2;
|
||||
}
|
||||
|
||||
if (GetIEditor()->IsInPreviewMode())
|
||||
{
|
||||
Physicalize();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::LoadStaticObject(const QString& file)
|
||||
{
|
||||
if (m_object)
|
||||
{
|
||||
m_object->Release();
|
||||
}
|
||||
|
||||
// Load Static object.
|
||||
m_object = m_engine->LoadStatObjUnsafeManualRef(file.toUtf8().data(), 0, 0, false);
|
||||
|
||||
if (!m_object)
|
||||
{
|
||||
CLogFile::WriteLine("Loading of object failed.");
|
||||
return;
|
||||
}
|
||||
m_object->AddRef();
|
||||
|
||||
// Generate thumbnail for this cgf.
|
||||
CThumbnailGenerator thumbGen;
|
||||
thumbGen.GenerateForFile(file);
|
||||
|
||||
m_AABB.min = m_object->GetBoxMin();
|
||||
m_AABB.max = m_object->GetBoxMax();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnRender()
|
||||
{
|
||||
FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
|
||||
|
||||
const QRect rc = contentsRect();
|
||||
ProcessKeys();
|
||||
if (m_renderer)
|
||||
{
|
||||
PreWidgetRendering();
|
||||
|
||||
m_Camera.SetFrustum(m_Camera.GetViewSurfaceX(), m_Camera.GetViewSurfaceZ(), m_Camera.GetFov(), 0.02f, 10000, m_Camera.GetPixelAspectRatio());
|
||||
const int w = rc.width();
|
||||
const int h = rc.height();
|
||||
m_Camera.SetFrustum(w, h, DEG2RAD(mv_fov), 0.0101f, 10000.0f);
|
||||
|
||||
if (GetIEditor()->IsInPreviewMode())
|
||||
{
|
||||
GetISystem()->SetViewCamera(m_Camera);
|
||||
}
|
||||
|
||||
Vec3 clearColor = mv_backgroundColor;
|
||||
m_renderer->SetClearColor(clearColor);
|
||||
m_renderer->SetCamera(m_Camera);
|
||||
|
||||
auto colorf = ColorF(clearColor, 1.0f);
|
||||
m_renderer->ClearTargetsImmediately(FRT_CLEAR | FRT_CLEAR_IMMEDIATE, colorf);
|
||||
m_renderer->ResetToDefault();
|
||||
|
||||
SRenderingPassInfo passInfo = SRenderingPassInfo::CreateGeneralPassRenderingInfo(m_Camera, SRenderingPassInfo::DEFAULT_FLAGS, true);
|
||||
|
||||
{
|
||||
CScopedWireFrameMode scopedWireFrame(m_renderer, mv_showWireframe1 ? R_WIREFRAME_MODE : R_SOLID_MODE);
|
||||
DrawModel(passInfo);
|
||||
}
|
||||
|
||||
PostWidgetRendering();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::DrawSkyBox(const SRenderingPassInfo& passInfo)
|
||||
{
|
||||
CRenderObject* pObj = m_renderer->EF_GetObject_Temp(passInfo.ThreadID());
|
||||
pObj->m_II.m_Matrix.SetTranslationMat(GetViewTM().GetTranslation());
|
||||
|
||||
if (m_pSkyboxName)
|
||||
{
|
||||
SShaderItem skyBoxShaderItem(m_pSkyBoxShader);
|
||||
m_renderer->EF_AddEf(m_pRESky, skyBoxShaderItem, pObj, passInfo, EFSLIST_GENERAL, 1, SRendItemSorter::CreateRendItemSorter(passInfo));
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnAnimBack()
|
||||
{
|
||||
// TODO: Add your command handler code here
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnAnimFastBack()
|
||||
{
|
||||
// TODO: Add your command handler code here
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnAnimFastForward()
|
||||
{
|
||||
// TODO: Add your command handler code here
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnAnimFront()
|
||||
{
|
||||
// TODO: Add your command handler code here
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnAnimPlay()
|
||||
{
|
||||
// TODO: Add your command handler code here
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::mouseDoubleClickEvent(QMouseEvent* event)
|
||||
{
|
||||
// TODO: Add your message handler code here and/or call default
|
||||
|
||||
CRenderViewport::mouseDoubleClickEvent(event);
|
||||
if (event->button() != Qt::LeftButton)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Matrix34 tm;
|
||||
tm.SetIdentity();
|
||||
SetViewTM(tm);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnLightColor([[maybe_unused]] IVariable* var)
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnShowNormals([[maybe_unused]] IVariable* var)
|
||||
{
|
||||
bool enable = mv_showNormals;
|
||||
GetIEditor()->SetConsoleVar("r_ShowNormals", (enable) ? 1 : 0);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnShowTangents([[maybe_unused]] IVariable* var)
|
||||
{
|
||||
bool enable = mv_showTangents;
|
||||
GetIEditor()->SetConsoleVar("r_ShowTangents", (enable) ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnCharPhysics([[maybe_unused]] IVariable* var)
|
||||
{
|
||||
bool enable = mv_useCharPhysics;
|
||||
GetIEditor()->SetConsoleVar("ca_UsePhysics", enable);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnShowShaders([[maybe_unused]] IVariable* var)
|
||||
{
|
||||
bool bEnable = mv_showShaders;
|
||||
GetIEditor()->SetConsoleVar("r_ProfileShaders", bEnable);
|
||||
}
|
||||
|
||||
void CModelViewport::OnDestroy()
|
||||
{
|
||||
ReleaseObject();
|
||||
if (m_pRESky)
|
||||
{
|
||||
m_pRESky->Release(false);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnActivate()
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnDeactivate()
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::Update()
|
||||
{
|
||||
FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
|
||||
|
||||
CRenderViewport::Update();
|
||||
|
||||
DrawInfo();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::DrawInfo() const
|
||||
{
|
||||
if (GetIEditor()->Get3DEngine())
|
||||
{
|
||||
ICVar* pDisplayInfo = gEnv->pConsole->GetCVar("r_DisplayInfo");
|
||||
if (pDisplayInfo && pDisplayInfo->GetIVal() != 0)
|
||||
{
|
||||
const float fps = gEnv->pTimer->GetFrameRate();
|
||||
const float x = (float)gEnv->pRenderer->GetWidth() - 5.0f;
|
||||
|
||||
gEnv->p3DEngine->DrawTextRightAligned(x, 1, "FPS: %.2f", fps);
|
||||
|
||||
int nPolygons, nShadowVolPolys;
|
||||
gEnv->pRenderer->GetPolyCount(nPolygons, nShadowVolPolys);
|
||||
int nDrawCalls = gEnv->pRenderer->GetCurrentNumberOfDrawCalls();
|
||||
gEnv->p3DEngine->DrawTextRightAligned(x, 20, "Tris:%2d,%03d - DP:%d", nPolygons / 1000, nPolygons % 1000, nDrawCalls);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CModelViewport::CanDrop([[maybe_unused]] const QPoint& point, IDataBaseItem* pItem)
|
||||
{
|
||||
if (!pItem)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::Drop([[maybe_unused]] const QPoint& point, [[maybe_unused]] IDataBaseItem* pItem)
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::Physicalize()
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::RePhysicalize()
|
||||
{
|
||||
Physicalize();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::SetPaused(bool bPaused)
|
||||
{
|
||||
//return;
|
||||
if (m_bPaused != bPaused)
|
||||
{
|
||||
m_bPaused = bPaused;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::DrawModel(const SRenderingPassInfo& passInfo)
|
||||
{
|
||||
FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
|
||||
|
||||
m_vCamPos = GetCamera().GetPosition();
|
||||
const QRect rc = contentsRect();
|
||||
//GetISystem()->SetViewCamera( m_Camera );
|
||||
IRenderAuxGeom* pAuxGeom = m_renderer->GetIRenderAuxGeom();
|
||||
m_renderer->BeginSpawningGeneratingRendItemJobs(passInfo.ThreadID());
|
||||
m_renderer->BeginSpawningShadowGeneratingRendItemJobs(passInfo.ThreadID());
|
||||
m_renderer->EF_ClearSkinningDataPool();
|
||||
m_renderer->EF_StartEf(passInfo);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Draw lights.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
if (mv_lighting == true)
|
||||
{
|
||||
pAuxGeom->DrawSphere(m_VPLight.m_Origin, 0.2f, ColorB(255, 255, 0, 255));
|
||||
}
|
||||
|
||||
gEnv->pConsole->GetCVar("ca_DrawWireframe")->Set(mv_showWireframe2);
|
||||
gEnv->pConsole->GetCVar("ca_DrawTangents")->Set(mv_showTangents);
|
||||
gEnv->pConsole->GetCVar("ca_DrawBinormals")->Set(mv_showBinormals);
|
||||
gEnv->pConsole->GetCVar("ca_DrawNormals")->Set(mv_showNormals);
|
||||
|
||||
DrawLights(passInfo);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//----- Render Static Object (handled by 3DEngine) ----
|
||||
//-----------------------------------------------------------------------------
|
||||
// calculate LOD
|
||||
|
||||
f32 fDistance = GetViewTM().GetTranslation().GetLength();
|
||||
SRendParams rp;
|
||||
rp.fDistance = fDistance;
|
||||
|
||||
Matrix34 tm;
|
||||
tm.SetIdentity();
|
||||
rp.pMatrix = &tm;
|
||||
rp.pPrevMatrix = &tm;
|
||||
|
||||
Vec3 vAmbient;
|
||||
mv_objectAmbientColor.Get(vAmbient);
|
||||
|
||||
rp.AmbientColor.r = vAmbient.x * mv_lightMultiplier;
|
||||
rp.AmbientColor.g = vAmbient.y * mv_lightMultiplier;
|
||||
rp.AmbientColor.b = vAmbient.z * mv_lightMultiplier;
|
||||
rp.AmbientColor.a = 1;
|
||||
|
||||
rp.nDLightMask = 7;
|
||||
if (mv_lighting == false)
|
||||
{
|
||||
rp.nDLightMask = 0;
|
||||
}
|
||||
|
||||
rp.dwFObjFlags = 0;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//----- Render Static Object (handled by 3DEngine) ----
|
||||
//-----------------------------------------------------------------------------
|
||||
if (m_object)
|
||||
{
|
||||
m_object->Render(rp, passInfo);
|
||||
if (mv_showGrid)
|
||||
{
|
||||
DrawFloorGrid(Quat(IDENTITY), Vec3(ZERO), Matrix33(IDENTITY));
|
||||
}
|
||||
|
||||
if (mv_showBase)
|
||||
{
|
||||
DrawCoordSystem(IDENTITY, 10.0f);
|
||||
}
|
||||
}
|
||||
|
||||
m_renderer->EF_EndEf3D(SHDF_STREAM_SYNC, -1, -1, passInfo);
|
||||
}
|
||||
|
||||
|
||||
void CModelViewport::DrawLights(const SRenderingPassInfo& passInfo)
|
||||
{
|
||||
if (mv_animateLights)
|
||||
{
|
||||
m_LightRotationRadian += m_AverageFrameTime;
|
||||
}
|
||||
|
||||
if (m_LightRotationRadian > gf_PI)
|
||||
{
|
||||
m_LightRotationRadian = -gf_PI;
|
||||
}
|
||||
|
||||
Matrix33 LightRot33 = Matrix33::CreateRotationZ(m_LightRotationRadian);
|
||||
|
||||
Vec3 LPos0 = Vec3(-mv_lightOrbit, mv_lightOrbit, mv_lightOrbit);
|
||||
m_VPLight.SetPosition(LightRot33 * LPos0 + m_PhysicalLocation.t);
|
||||
Vec3 d = mv_lightDiffuseColor;
|
||||
m_VPLight.SetLightColor(ColorF(d.x * mv_lightMultiplier, d.y * mv_lightMultiplier, d.z * mv_lightMultiplier, 0));
|
||||
m_VPLight.SetSpecularMult(mv_lightSpecMultiplier);
|
||||
m_VPLight.m_fRadius = mv_lightRadius;
|
||||
m_VPLight.m_Flags = DLF_SUN | DLF_DIRECTIONAL;
|
||||
|
||||
if (mv_lighting == true)
|
||||
{
|
||||
m_renderer->EF_ADDDlight(&m_VPLight, passInfo);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::PlayAnimation([[maybe_unused]] const char* szName)
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::DrawFloorGrid(const Quat& m33, const Vec3& vPhysicalLocation, const Matrix33& rGridRot)
|
||||
{
|
||||
if (!m_renderer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float XR = 45;
|
||||
float YR = 45;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
IRenderAuxGeom* pAuxGeom = m_renderer->GetIRenderAuxGeom();
|
||||
pAuxGeom->SetRenderFlags(e_Def3DPublicRenderflags);
|
||||
|
||||
Vec3 axis = m33.GetColumn0();
|
||||
|
||||
Matrix33 SlopeMat33 = rGridRot;
|
||||
uint32 GroundAlign = 1;
|
||||
if (GroundAlign == 0)
|
||||
{
|
||||
SlopeMat33 = Matrix33::CreateRotationAA(m_absCurrentSlope, axis);
|
||||
}
|
||||
|
||||
|
||||
m_GridOrigin = Vec3(floorf(vPhysicalLocation.x), floorf(vPhysicalLocation.y), vPhysicalLocation.z);
|
||||
|
||||
|
||||
Matrix33 ScaleMat33 = IDENTITY;
|
||||
Vec3 rh = Matrix33::CreateRotationY(m_absCurrentSlope) * Vec3(1.0f, 0.0f, 0.0f);
|
||||
if (rh.x)
|
||||
{
|
||||
Vec3 xback = SlopeMat33.GetRow(0);
|
||||
Vec3 yback = SlopeMat33.GetRow(1);
|
||||
f32 ratiox = 1.0f / Vec3(xback.x, xback.y, 0.0f).GetLength();
|
||||
f32 ratioy = 1.0f / Vec3(yback.x, yback.y, 0.0f).GetLength();
|
||||
|
||||
f32 ratio = 1.0f / rh.x;
|
||||
// Vec3 h=Vec3((m_GridOrigin.x-vPhysicalLocation.x)*ratiox,(m_GridOrigin.y-vPhysicalLocation.y)*ratioy,0.0f);
|
||||
Vec3 h = Vec3(m_GridOrigin.x - vPhysicalLocation.x, m_GridOrigin.y - vPhysicalLocation.y, 0.0f);
|
||||
Vec3 nh = SlopeMat33 * h;
|
||||
m_GridOrigin.z += nh.z * ratio;
|
||||
|
||||
ScaleMat33 = Matrix33::CreateScale(Vec3(ratiox, ratioy, 0.0f));
|
||||
|
||||
// float color1[4] = {0,1,0,1};
|
||||
// m_renderer->Draw2dLabel(12,g_ypos,1.6f,color1,false,"h: %f %f %f h.z: %f ratio: %f ratiox: %f ratioy: %f",h.x,h.y,h.z, nh.z,ratio,ratiox,ratioy);
|
||||
// g_ypos+=18;
|
||||
}
|
||||
|
||||
Matrix33 _m33;
|
||||
_m33.SetIdentity();
|
||||
AABB aabb1 = AABB(Vec3(-0.03f, -YR, -0.001f), Vec3(0.03f, YR, 0.001f));
|
||||
OBB _obb1 = OBB::CreateOBBfromAABB(SlopeMat33, aabb1);
|
||||
AABB aabb2 = AABB(Vec3(-XR, -0.03f, -0.001f), Vec3(XR, 0.03f, 0.001f));
|
||||
OBB _obb2 = OBB::CreateOBBfromAABB(SlopeMat33, aabb2);
|
||||
|
||||
SlopeMat33 = SlopeMat33 * ScaleMat33;
|
||||
// Draw grid.
|
||||
float step = 0.25f;
|
||||
for (float x = -XR; x < XR; x += step)
|
||||
{
|
||||
Vec3 p0 = Vec3(x, -YR, 0);
|
||||
Vec3 p1 = Vec3(x, YR, 0);
|
||||
//pAuxGeom->DrawLine( SlopeMat33*p0,RGBA8(0x7f,0x7f,0x7f,0x00), SlopeMat33*p1,RGBA8(0x7f,0x7f,0x7f,0x00) );
|
||||
int32 intx = int32(x);
|
||||
if (fabsf(intx - x) < 0.001f)
|
||||
{
|
||||
pAuxGeom->DrawOBB(_obb1, SlopeMat33 * Vec3(x, 0.0f, 0.0f) + m_GridOrigin, 1, RGBA8(0x9f, 0x9f, 0x9f, 0x00), eBBD_Faceted);
|
||||
}
|
||||
else
|
||||
{
|
||||
pAuxGeom->DrawLine(SlopeMat33 * p0 + m_GridOrigin, RGBA8(0x7f, 0x7f, 0x7f, 0x00), SlopeMat33 * p1 + m_GridOrigin, RGBA8(0x7f, 0x7f, 0x7f, 0x00));
|
||||
}
|
||||
}
|
||||
|
||||
for (float y = -YR; y < YR; y += step)
|
||||
{
|
||||
Vec3 p0 = Vec3(-XR, y, 0);
|
||||
Vec3 p1 = Vec3(XR, y, 0);
|
||||
// pAuxGeom->DrawLine( SlopeMat33*p0,RGBA8(0x7f,0x7f,0x7f,0x00), SlopeMat33*p1,RGBA8(0x7f,0x7f,0x7f,0x00) );
|
||||
int32 inty = int32(y);
|
||||
if (fabsf(inty - y) < 0.001f)
|
||||
{
|
||||
pAuxGeom->DrawOBB(_obb2, SlopeMat33 * Vec3(0.0f, y, 0.0f) + m_GridOrigin, 1, RGBA8(0x9f, 0x9f, 0x9f, 0x00), eBBD_Faceted);
|
||||
}
|
||||
else
|
||||
{
|
||||
pAuxGeom->DrawLine(SlopeMat33 * p0 + m_GridOrigin, RGBA8(0x7f, 0x7f, 0x7f, 0x00), SlopeMat33 * p1 + m_GridOrigin, RGBA8(0x7f, 0x7f, 0x7f, 0x00));
|
||||
}
|
||||
}
|
||||
|
||||
// TODO - the grid should probably be an IRenderNode at some point
|
||||
// flushing grid geometry now so it will not override transparent
|
||||
// objects later in the render pipeline.
|
||||
pAuxGeom->Commit();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------
|
||||
void CModelViewport::DrawCoordSystem(const QuatT& location, f32 length)
|
||||
{
|
||||
IRenderAuxGeom* pAuxGeom = m_renderer->GetIRenderAuxGeom();
|
||||
SAuxGeomRenderFlags renderFlags(e_Def3DPublicRenderflags);
|
||||
pAuxGeom->SetRenderFlags(renderFlags);
|
||||
|
||||
Vec3 absAxisX = location.q.GetColumn0();
|
||||
Vec3 absAxisY = location.q.GetColumn1();
|
||||
Vec3 absAxisZ = location.q.GetColumn2();
|
||||
|
||||
const f32 scale = 3.0f;
|
||||
const f32 size = 0.009f;
|
||||
AABB xaabb = AABB(Vec3(-length * scale, -size * scale, -size * scale), Vec3(length * scale, size * scale, size * scale));
|
||||
AABB yaabb = AABB(Vec3(-size * scale, -length * scale, -size * scale), Vec3(size * scale, length * scale, size * scale));
|
||||
AABB zaabb = AABB(Vec3(-size * scale, -size * scale, -length * scale), Vec3(size * scale, size * scale, length * scale));
|
||||
|
||||
OBB obb;
|
||||
obb = OBB::CreateOBBfromAABB(Matrix33(location.q), xaabb);
|
||||
pAuxGeom->DrawOBB(obb, location.t, 1, RGBA8(0xff, 0x00, 0x00, 0xff), eBBD_Extremes_Color_Encoded);
|
||||
pAuxGeom->DrawCone(location.t + absAxisX * length * scale, absAxisX, 0.03f * scale, 0.15f * scale, RGBA8(0xff, 0x00, 0x00, 0xff));
|
||||
|
||||
obb = OBB::CreateOBBfromAABB(Matrix33(location.q), yaabb);
|
||||
pAuxGeom->DrawOBB(obb, location.t, 1, RGBA8(0x00, 0xff, 0x00, 0xff), eBBD_Extremes_Color_Encoded);
|
||||
pAuxGeom->DrawCone(location.t + absAxisY * length * scale, absAxisY, 0.03f * scale, 0.15f * scale, RGBA8(0x00, 0xff, 0x00, 0xff));
|
||||
|
||||
obb = OBB::CreateOBBfromAABB(Matrix33(location.q), zaabb);
|
||||
pAuxGeom->DrawOBB(obb, location.t, 1, RGBA8(0x00, 0x00, 0xff, 0xff), eBBD_Extremes_Color_Encoded);
|
||||
pAuxGeom->DrawCone(location.t + absAxisZ * length * scale, absAxisZ, 0.03f * scale, 0.15f * scale, RGBA8(0x00, 0x00, 0xff, 0xff));
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::OnLightMultiplier([[maybe_unused]] IVariable* var)
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CModelViewport::SetSelected(bool const bSelect)
|
||||
{
|
||||
// If a modelviewport gets activated, and listeners will be activated, disable the main viewport listener and re-enable when you lose focus.
|
||||
if (gEnv->pSystem)
|
||||
{
|
||||
IViewSystem* const pIViewSystem = gEnv->pSystem->GetIViewSystem();
|
||||
|
||||
if (pIViewSystem)
|
||||
{
|
||||
pIViewSystem->SetControlAudioListeners(!bSelect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include <moc_ModelViewport.cpp>
|
||||
@@ -1,258 +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.
|
||||
|
||||
#pragma once
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Crytek Engine Source File.
|
||||
// Copyright (C), Crytek Studios, 2001.
|
||||
// -------------------------------------------------------------------------
|
||||
// File name: ModelViewport.h
|
||||
// Version: v1.00
|
||||
// Created: 8/10/2001 by Timur.
|
||||
// Compilers: Visual C++ 6.0
|
||||
// Description:
|
||||
// -------------------------------------------------------------------------
|
||||
// History:
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef CRYINCLUDE_EDITOR_MODELVIEWPORT_H
|
||||
#define CRYINCLUDE_EDITOR_MODELVIEWPORT_H
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include "RenderViewport.h"
|
||||
#include "Util/Variable.h"
|
||||
#endif
|
||||
|
||||
struct IPhysicalEntity;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
// CModelViewport window
|
||||
class SANDBOX_API CModelViewport
|
||||
: public CRenderViewport
|
||||
{
|
||||
AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
Q_OBJECT
|
||||
// Construction
|
||||
public:
|
||||
CModelViewport(const char* settingsPath = "Settings\\CharacterEditorUserOptions", QWidget* parent = nullptr);
|
||||
virtual ~CModelViewport();
|
||||
|
||||
virtual EViewportType GetType() const { return ET_ViewportModel; }
|
||||
virtual void SetType([[maybe_unused]] EViewportType type) { assert(type == ET_ViewportModel); };
|
||||
|
||||
virtual void LoadObject(const QString& obj, float scale);
|
||||
|
||||
virtual void OnActivate();
|
||||
virtual void OnDeactivate();
|
||||
|
||||
virtual bool CanDrop(const QPoint& point, IDataBaseItem* pItem);
|
||||
virtual void Drop(const QPoint& point, IDataBaseItem* pItem);
|
||||
|
||||
virtual void SetSelected(bool const bSelect);
|
||||
|
||||
// Callbacks.
|
||||
void OnShowShaders(IVariable* var);
|
||||
void OnShowNormals(IVariable* var);
|
||||
void OnShowTangents(IVariable* var);
|
||||
|
||||
void OnShowPortals(IVariable* var);
|
||||
void OnShowShadowVolumes(IVariable* var);
|
||||
void OnShowTextureUsage(IVariable* var);
|
||||
void OnCharPhysics(IVariable* var);
|
||||
void OnShowOcclusion(IVariable* var);
|
||||
|
||||
void OnLightColor(IVariable* var);
|
||||
void OnLightMultiplier(IVariable* var);
|
||||
void OnDisableVisibility(IVariable* var);
|
||||
|
||||
IStatObj* GetStaticObject(){ return m_object; }
|
||||
|
||||
void GetOnDisableVisibility(IVariable* var);
|
||||
|
||||
const CVarObject* GetVarObject() const { return &m_vars; }
|
||||
CVarObject* GetVarObject() { return &m_vars; }
|
||||
|
||||
virtual void Update();
|
||||
|
||||
|
||||
void UseWeaponIK([[maybe_unused]] bool val) { m_weaponIK = true; }
|
||||
|
||||
void ReleaseObject();
|
||||
void RePhysicalize();
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
Vec3 m_GridOrigin;
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
void SetPaused(bool bPaused);
|
||||
bool GetPaused() {return m_bPaused; }
|
||||
|
||||
bool IsCameraAttached() const{ return mv_AttachCamera; }
|
||||
|
||||
virtual void PlayAnimation(const char* szName);
|
||||
|
||||
const QString& GetLoadedFileName() const { return m_loadedFile; }
|
||||
|
||||
void Physicalize();
|
||||
|
||||
protected:
|
||||
|
||||
void LoadStaticObject(const QString& file);
|
||||
|
||||
// Called to render stuff.
|
||||
virtual void OnRender();
|
||||
|
||||
virtual void DrawFloorGrid(const Quat& tmRotation, const Vec3& MotionTranslation, const Matrix33& rGridRot);
|
||||
void DrawCoordSystem(const QuatT& q, f32 length);
|
||||
|
||||
void SaveDebugOptions() const;
|
||||
void RestoreDebugOptions();
|
||||
|
||||
virtual void DrawModel(const SRenderingPassInfo& passInfo);
|
||||
virtual void DrawLights(const SRenderingPassInfo& passInfo);
|
||||
virtual void DrawSkyBox(const SRenderingPassInfo& passInfo);
|
||||
|
||||
void DrawInfo() const;
|
||||
|
||||
void SetConsoleVar(const char* var, int value);
|
||||
|
||||
void OnEditorNotifyEvent(EEditorNotifyEvent event)
|
||||
{
|
||||
if (event != eNotify_OnBeginGameMode)
|
||||
{
|
||||
// the base class responds to this by forcing itself to be the current context.
|
||||
// we don't want that to be the case for previewer viewports.
|
||||
CRenderViewport::OnEditorNotifyEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
IStatObj* m_object;
|
||||
IStatObj* m_weaponModel;
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
QString m_attachBone;
|
||||
AABB m_AABB;
|
||||
|
||||
struct BBox
|
||||
{
|
||||
OBB obb;
|
||||
Vec3 pos;
|
||||
ColorB col;
|
||||
};
|
||||
std::vector<BBox> m_arrBBoxes;
|
||||
|
||||
// Camera control.
|
||||
float m_camRadius;
|
||||
|
||||
// True to show grid.
|
||||
bool m_bGrid;
|
||||
bool m_bBase;
|
||||
|
||||
QString m_settingsPath;
|
||||
|
||||
bool m_weaponIK;
|
||||
|
||||
QString m_loadedFile;
|
||||
CDLight m_VPLight;
|
||||
|
||||
f32 m_LightRotationRadian;
|
||||
|
||||
class CRESky* m_pRESky;
|
||||
struct ICVar* m_pSkyboxName;
|
||||
IShader* m_pSkyBoxShader;
|
||||
|
||||
//---------------------------------------------------
|
||||
//--- debug options ---
|
||||
//---------------------------------------------------
|
||||
CVariable<bool> mv_showGrid;
|
||||
CVariable<bool> mv_showBase;
|
||||
CVariable<bool> mv_showLocator;
|
||||
CVariable<bool> mv_InPlaceMovement;
|
||||
CVariable<bool> mv_StrafingControl;
|
||||
|
||||
CVariable<bool> mv_showWireframe1; //draw wireframe instead of solid-geometry.
|
||||
CVariable<bool> mv_showWireframe2; //this one is software-wireframe rendered on top of the solid geometry
|
||||
CVariable<bool> mv_showTangents;
|
||||
CVariable<bool> mv_showBinormals;
|
||||
CVariable<bool> mv_showNormals;
|
||||
|
||||
CVariable<bool> mv_showSkeleton;
|
||||
CVariable<bool> mv_showJointNames;
|
||||
CVariable<bool> mv_showJointsValues;
|
||||
CVariable<bool> mv_showStartLocation;
|
||||
CVariable<bool> mv_showMotionParam;
|
||||
CVariable<float> mv_UniformScaling;
|
||||
|
||||
CVariable<bool> mv_printDebugText;
|
||||
CVariable<bool> mv_AttachCamera;
|
||||
|
||||
CVariable<bool> mv_showShaders;
|
||||
|
||||
CVariable<bool> mv_lighting;
|
||||
CVariable<bool> mv_animateLights;
|
||||
|
||||
CVariable<Vec3> mv_backgroundColor;
|
||||
CVariable<Vec3> mv_objectAmbientColor;
|
||||
|
||||
CVariable<Vec3> mv_lightDiffuseColor;
|
||||
CVariable<float> mv_lightMultiplier;
|
||||
CVariable<float> mv_lightSpecMultiplier;
|
||||
CVariable<float> mv_lightRadius;
|
||||
CVariable<float> mv_lightOrbit;
|
||||
|
||||
CVariable<float> mv_fov;
|
||||
CVariable<bool> mv_showPhysics;
|
||||
CVariable<bool> mv_useCharPhysics;
|
||||
CVariable<bool> mv_showPhysicsTetriders;
|
||||
CVariable<int> mv_forceLODNum;
|
||||
|
||||
CVariableArray mv_advancedTable;
|
||||
|
||||
CVarObject m_vars;
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
public slots:
|
||||
virtual void OnAnimPlay();
|
||||
virtual void OnAnimBack();
|
||||
virtual void OnAnimFastBack();
|
||||
virtual void OnAnimFastForward();
|
||||
virtual void OnAnimFront();
|
||||
protected:
|
||||
bool m_bPaused;
|
||||
|
||||
void OnDestroy();
|
||||
void mouseDoubleClickEvent(QMouseEvent* event) override;
|
||||
|
||||
private:
|
||||
struct VariableCallbackIndex
|
||||
{
|
||||
enum : unsigned char
|
||||
{
|
||||
OnCharPhysics = 0,
|
||||
OnLightColor,
|
||||
OnLightMultiplier,
|
||||
OnShowShaders,
|
||||
|
||||
// must be at the end
|
||||
Count,
|
||||
};
|
||||
};
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
AZStd::fixed_vector< IVariable::OnSetCallback, VariableCallbackIndex::Count > m_onSetCallbacksCache;
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_MODELVIEWPORT_H
|
||||
@@ -1,24 +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"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -16,14 +16,24 @@
|
||||
#include <Atom/RPI.Public/ViewportContextBus.h>
|
||||
#include <AzCore/Console/IConsole.h>
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
#include <AzFramework/Input/Devices/Keyboard/InputDeviceKeyboard.h>
|
||||
#include <AzFramework/Input/Devices/Mouse/InputDeviceMouse.h>
|
||||
#include <AzFramework/Viewport/ScreenGeometry.h>
|
||||
#include <AzFramework/Windowing/WindowBus.h>
|
||||
#include <AzToolsFramework/Viewport/ViewportMessages.h>
|
||||
|
||||
AZ_CVAR(bool, ed_newCameraSystemDebug, false, nullptr, AZ::ConsoleFunctorFlags::Null, "Enable debug drawing for the new camera system");
|
||||
|
||||
namespace SandboxEditor
|
||||
{
|
||||
static void DrawPreviewAxis(AzFramework::DebugDisplayRequests& display, const AZ::Transform& transform, const float axisLength)
|
||||
{
|
||||
display.SetColor(AZ::Colors::Red);
|
||||
display.DrawLine(transform.GetTranslation(), transform.GetTranslation() + transform.GetBasisX().GetNormalizedSafe() * axisLength);
|
||||
display.SetColor(AZ::Colors::Green);
|
||||
display.DrawLine(transform.GetTranslation(), transform.GetTranslation() + transform.GetBasisY().GetNormalizedSafe() * axisLength);
|
||||
display.SetColor(AZ::Colors::Blue);
|
||||
display.DrawLine(transform.GetTranslation(), transform.GetTranslation() + transform.GetBasisZ().GetNormalizedSafe() * axisLength);
|
||||
}
|
||||
|
||||
static AZ::RPI::ViewportContextPtr RetrieveViewportContext(const AzFramework::ViewportId viewportId)
|
||||
{
|
||||
auto viewportContextManager = AZ::Interface<AZ::RPI::ViewportContextRequestsInterface>::Get();
|
||||
@@ -41,50 +51,42 @@ namespace SandboxEditor
|
||||
return viewportContext;
|
||||
}
|
||||
|
||||
ModernViewportCameraControllerInstance::ModernViewportCameraControllerInstance(const AzFramework::ViewportId viewportId)
|
||||
: MultiViewportControllerInstanceInterface(viewportId)
|
||||
void ModernViewportCameraController::SetCameraListBuilderCallback(const CameraListBuilder& builder)
|
||||
{
|
||||
// LYN-2315 TODO - move setup out of constructor, pass cameras in
|
||||
auto firstPersonRotateCamera = AZStd::make_shared<AzFramework::RotateCameraInput>(AzFramework::InputDeviceMouse::Button::Right);
|
||||
auto firstPersonPanCamera = AZStd::make_shared<AzFramework::PanCameraInput>(AzFramework::LookPan);
|
||||
auto firstPersonTranslateCamera = AZStd::make_shared<AzFramework::TranslateCameraInput>(AzFramework::LookTranslation);
|
||||
auto firstPersonWheelCamera = AZStd::make_shared<AzFramework::ScrollTranslationCameraInput>();
|
||||
m_cameraListBuilder = builder;
|
||||
}
|
||||
|
||||
auto orbitCamera = AZStd::make_shared<AzFramework::OrbitCameraInput>();
|
||||
auto orbitRotateCamera = AZStd::make_shared<AzFramework::RotateCameraInput>(AzFramework::InputDeviceMouse::Button::Left);
|
||||
auto orbitTranslateCamera = AZStd::make_shared<AzFramework::TranslateCameraInput>(AzFramework::OrbitTranslation);
|
||||
auto orbitDollyWheelCamera = AZStd::make_shared<AzFramework::OrbitDollyScrollCameraInput>();
|
||||
auto orbitDollyMoveCamera = AZStd::make_shared<AzFramework::OrbitDollyCursorMoveCameraInput>();
|
||||
auto orbitPanCamera = AZStd::make_shared<AzFramework::PanCameraInput>(AzFramework::OrbitPan);
|
||||
orbitCamera->m_orbitCameras.AddCamera(orbitRotateCamera);
|
||||
orbitCamera->m_orbitCameras.AddCamera(orbitTranslateCamera);
|
||||
orbitCamera->m_orbitCameras.AddCamera(orbitDollyWheelCamera);
|
||||
orbitCamera->m_orbitCameras.AddCamera(orbitDollyMoveCamera);
|
||||
orbitCamera->m_orbitCameras.AddCamera(orbitPanCamera);
|
||||
|
||||
m_cameraSystem.m_cameras.AddCamera(firstPersonRotateCamera);
|
||||
m_cameraSystem.m_cameras.AddCamera(firstPersonPanCamera);
|
||||
m_cameraSystem.m_cameras.AddCamera(firstPersonTranslateCamera);
|
||||
m_cameraSystem.m_cameras.AddCamera(firstPersonWheelCamera);
|
||||
m_cameraSystem.m_cameras.AddCamera(orbitCamera);
|
||||
|
||||
if (const auto viewportContext = RetrieveViewportContext(viewportId))
|
||||
void ModernViewportCameraController::SetupCameras(AzFramework::Cameras& cameras)
|
||||
{
|
||||
if (m_cameraListBuilder)
|
||||
{
|
||||
// set position but not orientation
|
||||
m_targetCamera.m_lookAt = viewportContext->GetCameraTransform().GetTranslation();
|
||||
m_cameraListBuilder(cameras);
|
||||
}
|
||||
}
|
||||
|
||||
// LYN-2315 TODO https://www.geometrictools.com/Documentation/EulerAngles.pdf
|
||||
ModernViewportCameraControllerInstance::ModernViewportCameraControllerInstance(const AzFramework::ViewportId viewportId, ModernViewportCameraController* controller)
|
||||
: MultiViewportControllerInstanceInterface<ModernViewportCameraController>(viewportId, controller)
|
||||
{
|
||||
controller->SetupCameras(m_cameraSystem.m_cameras);
|
||||
|
||||
m_camera = m_targetCamera;
|
||||
if (auto viewportContext = RetrieveViewportContext(GetViewportId()))
|
||||
{
|
||||
auto handleCameraChange = [this](const AZ::Matrix4x4& matrix) {
|
||||
UpdateCameraFromTransform(
|
||||
m_targetCamera,
|
||||
AZ::Transform::CreateFromMatrix3x3AndTranslation(AZ::Matrix3x3::CreateFromMatrix4x4(matrix), matrix.GetTranslation()));
|
||||
};
|
||||
|
||||
m_cameraViewMatrixChangeHandler = AZ::RPI::ViewportContext::MatrixChangedEvent::Handler(handleCameraChange);
|
||||
|
||||
viewportContext->ConnectViewMatrixChangedHandler(m_cameraViewMatrixChangeHandler);
|
||||
}
|
||||
|
||||
AzFramework::ViewportDebugDisplayEventBus::Handler::BusConnect(AzToolsFramework::GetEntityContextId());
|
||||
AzFramework::ModernViewportCameraControllerRequestBus::Handler::BusConnect(viewportId);
|
||||
}
|
||||
|
||||
ModernViewportCameraControllerInstance::~ModernViewportCameraControllerInstance()
|
||||
{
|
||||
AzFramework::ModernViewportCameraControllerRequestBus::Handler::BusDisconnect();
|
||||
AzFramework::ViewportDebugDisplayEventBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
@@ -93,6 +95,28 @@ namespace SandboxEditor
|
||||
AzFramework::WindowSize windowSize;
|
||||
AzFramework::WindowRequestBus::EventResult(
|
||||
windowSize, event.m_windowHandle, &AzFramework::WindowRequestBus::Events::GetClientAreaSize);
|
||||
|
||||
if (m_cameraMode == CameraMode::Control)
|
||||
{
|
||||
if (AzFramework::InputDeviceKeyboard::IsKeyboardDevice(event.m_inputChannel.GetInputDevice().GetInputDeviceId()))
|
||||
{
|
||||
if (event.m_inputChannel.GetInputChannelId() == AzFramework::InputDeviceKeyboard::Key::AlphanumericR)
|
||||
{
|
||||
m_transformEnd = m_camera.Transform();
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (event.m_inputChannel.GetInputChannelId() == AzFramework::InputDeviceKeyboard::Key::AlphanumericP)
|
||||
{
|
||||
m_animationT = 0.0f;
|
||||
m_cameraMode = CameraMode::Animation;
|
||||
m_transformStart = m_camera.Transform();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return m_cameraSystem.HandleEvents(AzFramework::BuildInputEvent(event.m_inputChannel, windowSize));
|
||||
}
|
||||
|
||||
@@ -100,26 +124,49 @@ namespace SandboxEditor
|
||||
{
|
||||
if (auto viewportContext = RetrieveViewportContext(GetViewportId()))
|
||||
{
|
||||
m_targetCamera = m_cameraSystem.StepCamera(m_targetCamera, event.m_deltaTime.count());
|
||||
m_camera =
|
||||
AzFramework::SmoothCamera(m_camera, m_targetCamera, m_smoothProps, event.m_deltaTime.count());
|
||||
if (m_cameraMode == CameraMode::Control)
|
||||
{
|
||||
m_targetCamera = m_cameraSystem.StepCamera(m_targetCamera, event.m_deltaTime.count());
|
||||
m_camera = AzFramework::SmoothCamera(m_camera, m_targetCamera, event.m_deltaTime.count());
|
||||
|
||||
viewportContext->SetCameraTransform(m_camera.Transform());
|
||||
viewportContext->SetCameraTransform(m_camera.Transform());
|
||||
}
|
||||
else if (m_cameraMode == CameraMode::Animation)
|
||||
{
|
||||
const auto smootherStepFn = [](const float t) { return t * t * t * (t * (t * 6.0f - 15.0f) + 10.0f); };
|
||||
const float transitionT = smootherStepFn(m_animationT);
|
||||
|
||||
const AZ::Transform current = AZ::Transform::CreateFromQuaternionAndTranslation(
|
||||
m_transformStart.GetRotation().Slerp(m_transformEnd.GetRotation(), transitionT),
|
||||
m_transformStart.GetTranslation().Lerp(m_transformEnd.GetTranslation(), transitionT));
|
||||
|
||||
const AZ::Vector3 eulerAngles = AzFramework::EulerAngles(AZ::Matrix3x3::CreateFromTransform(current));
|
||||
m_camera.m_pitch = eulerAngles.GetX();
|
||||
m_camera.m_yaw = eulerAngles.GetZ();
|
||||
m_camera.m_lookAt = current.GetTranslation();
|
||||
m_targetCamera = m_camera;
|
||||
|
||||
if (m_animationT >= 1.0f)
|
||||
{
|
||||
m_cameraMode = CameraMode::Control;
|
||||
}
|
||||
|
||||
m_animationT = AZ::GetClamp(m_animationT + event.m_deltaTime.count(), 0.0f, 1.0f);
|
||||
|
||||
viewportContext->SetCameraTransform(current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ModernViewportCameraControllerInstance::DisplayViewport(
|
||||
[[maybe_unused]] const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay)
|
||||
{
|
||||
if (ed_newCameraSystemDebug)
|
||||
if (const float alpha = AZStd::min(-m_camera.m_lookDist / 5.0f, 1.0f); alpha > AZ::Constants::FloatEpsilon)
|
||||
{
|
||||
debugDisplay.SetColor(AZ::Colors::White);
|
||||
debugDisplay.DrawWireSphere(m_targetCamera.m_lookAt, 0.5f);
|
||||
debugDisplay.SetColor(1.0f, 1.0f, 1.0f, alpha);
|
||||
debugDisplay.DrawWireSphere(m_camera.m_lookAt, 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
void ModernViewportCameraControllerInstance::SetTargetCameraTransform(const AZ::Transform& transform)
|
||||
{
|
||||
m_targetCamera.m_lookAt = transform.GetTranslation();
|
||||
DrawPreviewAxis(debugDisplay, m_transformEnd, 2.0f);
|
||||
}
|
||||
} // namespace SandboxEditor
|
||||
|
||||
@@ -12,19 +12,36 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Atom/RPI.Public/ViewportContext.h>
|
||||
#include <AzFramework/Entity/EntityDebugDisplayBus.h>
|
||||
#include <AzFramework/Viewport/CameraInput.h>
|
||||
#include <AzFramework/Viewport/MultiViewportController.h>
|
||||
|
||||
namespace SandboxEditor
|
||||
{
|
||||
class ModernViewportCameraControllerInstance final : public AzFramework::MultiViewportControllerInstanceInterface,
|
||||
private AzFramework::ViewportDebugDisplayEventBus::Handler,
|
||||
private AzFramework::ModernViewportCameraControllerRequestBus::Handler
|
||||
class ModernViewportCameraControllerInstance;
|
||||
class ModernViewportCameraController
|
||||
: public AzFramework::MultiViewportController<ModernViewportCameraControllerInstance>
|
||||
{
|
||||
public:
|
||||
explicit ModernViewportCameraControllerInstance(AzFramework::ViewportId viewportId);
|
||||
~ModernViewportCameraControllerInstance();
|
||||
using CameraListBuilder = AZStd::function<void(AzFramework::Cameras&)>;
|
||||
//! Sets the camera list builder callback used to populate new ModernViewportCameraControllerInstances
|
||||
void SetCameraListBuilderCallback(const CameraListBuilder& builder);
|
||||
|
||||
//! Sets up a camera list based on this controller's CameraListBuilderCallback
|
||||
void SetupCameras(AzFramework::Cameras& cameras);
|
||||
|
||||
private:
|
||||
CameraListBuilder m_cameraListBuilder;
|
||||
};
|
||||
|
||||
class ModernViewportCameraControllerInstance final
|
||||
: public AzFramework::MultiViewportControllerInstanceInterface<ModernViewportCameraController>
|
||||
, private AzFramework::ViewportDebugDisplayEventBus::Handler
|
||||
{
|
||||
public:
|
||||
explicit ModernViewportCameraControllerInstance(AzFramework::ViewportId viewportId, ModernViewportCameraController* controller);
|
||||
~ModernViewportCameraControllerInstance() override;
|
||||
|
||||
// MultiViewportControllerInstanceInterface overrides ...
|
||||
bool HandleInputChannelEvent(const AzFramework::ViewportControllerInputEvent& event) override;
|
||||
@@ -33,15 +50,22 @@ namespace SandboxEditor
|
||||
// AzFramework::ViewportDebugDisplayEventBus overrides ...
|
||||
void DisplayViewport(const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay) override;
|
||||
|
||||
// ModernViewportCameraControllerRequestBus overrides ...
|
||||
void SetTargetCameraTransform(const AZ::Transform& transform) override;
|
||||
|
||||
private:
|
||||
enum class CameraMode
|
||||
{
|
||||
Control,
|
||||
Animation
|
||||
};
|
||||
|
||||
AzFramework::Camera m_camera;
|
||||
AzFramework::Camera m_targetCamera;
|
||||
AzFramework::SmoothProps m_smoothProps;
|
||||
AzFramework::CameraSystem m_cameraSystem;
|
||||
};
|
||||
|
||||
using ModernViewportCameraController = AzFramework::MultiViewportController<ModernViewportCameraControllerInstance>;
|
||||
AZ::Transform m_transformStart = AZ::Transform::CreateIdentity();
|
||||
AZ::Transform m_transformEnd = AZ::Transform::CreateIdentity();
|
||||
float m_animationT = 0.0f;
|
||||
CameraMode m_cameraMode = CameraMode::Control;
|
||||
|
||||
AZ::RPI::ViewportContext::MatrixChangedEvent::Handler m_cameraViewMatrixChangeHandler;
|
||||
};
|
||||
} // namespace SandboxEditor
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#include "ViewManager.h"
|
||||
#include "IEditorImpl.h"
|
||||
#include "GameEngine.h"
|
||||
#include <IEntityRenderState.h>
|
||||
#include <IStatObj.h>
|
||||
// To use the Andrew's algorithm in order to make convex hull from the points, this header is needed.
|
||||
#include "Util/GeometryUtil.h"
|
||||
|
||||
@@ -821,9 +823,8 @@ void CBaseObject::GetLocalBounds(AABB& box)
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CBaseObject::SetModified(bool boModifiedTransformOnly)
|
||||
void CBaseObject::SetModified(bool)
|
||||
{
|
||||
((CObjectManager*)GetObjectManager())->OnObjectModified(this, false, boModifiedTransformOnly);
|
||||
}
|
||||
|
||||
void CBaseObject::DrawDefault(DisplayContext& dc, const QColor& labelColor)
|
||||
|
||||
@@ -35,7 +35,6 @@ class CUndoBaseObject;
|
||||
class CObjectManager;
|
||||
class CGizmo;
|
||||
class CObjectArchive;
|
||||
class CEdGeometry;
|
||||
struct SSubObjSelectionModifyContext;
|
||||
struct SRayHitInfo;
|
||||
class ISubObjectSelectionReferenceFrameCalculator;
|
||||
@@ -580,10 +579,6 @@ public:
|
||||
virtual void ModifySubObjSelection([[maybe_unused]] SSubObjSelectionModifyContext& modCtx) {};
|
||||
virtual void AcceptSubObjectModify() {};
|
||||
|
||||
// Request a geometry pointer from the object.
|
||||
// Return NULL if geometry can not be retrieved or object does not support geometries.
|
||||
virtual CEdGeometry* GetGeometry() { return 0; };
|
||||
|
||||
//! In This function variables of the object must be initialized.
|
||||
virtual void InitVariables() {};
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ struct IDisplayViewport;
|
||||
struct IRenderer;
|
||||
struct IRenderAuxGeom;
|
||||
struct IIconManager;
|
||||
struct I3DEngine;
|
||||
class CDisplaySettings;
|
||||
class CCamera;
|
||||
|
||||
@@ -70,7 +69,6 @@ struct SANDBOX_API DisplayContext
|
||||
IRenderer* renderer;
|
||||
IRenderAuxGeom* pRenderAuxGeom;
|
||||
IIconManager* pIconManager;
|
||||
I3DEngine* engine;
|
||||
CCamera* camera;
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
AABB box; // Bounding box of volume that need to be repainted.
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
#include "Include/IIconManager.h"
|
||||
#include "Include/IDisplayViewport.h"
|
||||
|
||||
#include <I3DEngine.h>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QPoint>
|
||||
|
||||
@@ -32,7 +30,6 @@ DisplayContext::DisplayContext()
|
||||
{
|
||||
view = 0;
|
||||
renderer = 0;
|
||||
engine = 0;
|
||||
flags = 0;
|
||||
settings = 0;
|
||||
pIconManager = 0;
|
||||
@@ -981,27 +978,8 @@ void DisplayContext::RenderObject(int objectType, const Vec3& pos, float scale)
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void DisplayContext::RenderObject(int objectType, const Matrix34& tm)
|
||||
void DisplayContext::RenderObject(int, const Matrix34&)
|
||||
{
|
||||
IStatObj* object = pIconManager ? pIconManager->GetObject((EStatObject)objectType) : 0;
|
||||
if (object)
|
||||
{
|
||||
float color[4];
|
||||
color[0] = m_color4b.r * (1.0f / 255.0f);
|
||||
color[1] = m_color4b.g * (1.0f / 255.0f);
|
||||
color[2] = m_color4b.b * (1.0f / 255.0f);
|
||||
color[3] = m_color4b.a * (1.0f / 255.0f);
|
||||
|
||||
SRenderingPassInfo passInfo = SRenderingPassInfo::CreateGeneralPassRenderingInfo(GetIEditor()->GetSystem()->GetViewCamera());
|
||||
|
||||
Matrix34 xform = m_matrixStack[m_currentMatrix] * tm;
|
||||
SRendParams rp;
|
||||
rp.pMatrix = &xform;
|
||||
rp.AmbientColor = ColorF(color[0], color[1], color[2], 1);
|
||||
rp.fAlpha = color[3];
|
||||
|
||||
object->Render(rp, passInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
#include "HitContext.h"
|
||||
#include "Objects/SelectionGroup.h"
|
||||
|
||||
#include <IEntityRenderState.h>
|
||||
#include <IStatObj.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! Undo Entity Link
|
||||
@@ -1926,55 +1928,6 @@ void CEntityObject::OnContextMenu(QMenu* pMenu)
|
||||
CBaseObject::OnContextMenu(pMenu);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IOpticsElementBasePtr CEntityObject::GetOpticsElement()
|
||||
{
|
||||
CDLight* pLight = GetLightProperty();
|
||||
if (pLight == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return pLight->GetLensOpticsElement();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CEntityObject::SetOpticsName(const QString& opticsFullName)
|
||||
{
|
||||
if (opticsFullName.isEmpty())
|
||||
{
|
||||
CDLight* pLight = GetLightProperty();
|
||||
if (pLight)
|
||||
{
|
||||
pLight->SetLensOpticsElement(NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CDLight* CEntityObject::GetLightProperty() const
|
||||
{
|
||||
const PodArray<ILightSource*>* pLightEntities = GetIEditor()->Get3DEngine()->GetLightEntities();
|
||||
if (pLightEntities == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
for (int i = 0, iLightSize(pLightEntities->Count()); i < iLightSize; ++i)
|
||||
{
|
||||
ILightSource* pLightSource = pLightEntities->GetAt(i);
|
||||
if (pLightSource == NULL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
CDLight& lightProperty = pLightSource->GetLightProperties();
|
||||
if (GetName() != lightProperty.m_sName)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
return &lightProperty;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CEntityObject::PreInitLightProperty()
|
||||
{
|
||||
|
||||
@@ -214,8 +214,6 @@ public:
|
||||
QString GetLightAnimation() const;
|
||||
|
||||
IVariable* GetLightVariable(const char* name) const;
|
||||
IOpticsElementBasePtr GetOpticsElement();
|
||||
void SetOpticsName(const QString& opticsFullName);
|
||||
|
||||
void PreInitLightProperty();
|
||||
void UpdateLightProperty();
|
||||
@@ -230,8 +228,6 @@ public:
|
||||
void RegisterListener(IEntityObjectListener* pListener);
|
||||
void UnregisterListener(IEntityObjectListener* pListener);
|
||||
|
||||
CDLight* GetLightProperty() const;
|
||||
|
||||
protected:
|
||||
template <typename T>
|
||||
void SetEntityProperty(const char* name, T value);
|
||||
|
||||
@@ -400,8 +400,6 @@ void CObjectManager::DeleteObject(CBaseObject* obj)
|
||||
CUndo::Record(new CUndoBaseObjectDelete(obj));
|
||||
}
|
||||
|
||||
OnObjectModified(obj, true, false);
|
||||
|
||||
AABB objAAB;
|
||||
obj->GetBoundBox(objAAB);
|
||||
GetIEditor()->GetGameEngine()->OnAreaModified(objAAB);
|
||||
@@ -2477,17 +2475,6 @@ IGizmoManager* CObjectManager::GetGizmoManager()
|
||||
return m_gizmoManager;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CObjectManager::OnObjectModified(CBaseObject* pObject, [[maybe_unused]] bool bDelete, [[maybe_unused]] bool boModifiedTransformOnly)
|
||||
{
|
||||
if (IRenderNode* pRenderNode = pObject->GetEngineNode())
|
||||
{
|
||||
GetIEditor()->Get3DEngine()->OnObjectModified(pRenderNode, pRenderNode->GetRndFlags());
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CObjectManager::IsLightClass(CBaseObject* pObject)
|
||||
{
|
||||
|
||||
@@ -326,9 +326,6 @@ public:
|
||||
// Gathers all resources used by all objects.
|
||||
void GatherUsedResources(CUsedResources& resources);
|
||||
|
||||
// Called when object gets modified.
|
||||
void OnObjectModified(CBaseObject* pObject, bool bDelete, bool boModifiedTransformOnly);
|
||||
|
||||
virtual bool IsLightClass(CBaseObject* pObject);
|
||||
|
||||
virtual void FindAndRenameProperty2(const char* property2Name, const QString& oldValue, const QString& newValue);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "ViewManager.h"
|
||||
#include "Include/IObjectManager.h"
|
||||
|
||||
#include <IStatObj.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CSelectionGroup::CSelectionGroup()
|
||||
|
||||
@@ -1,42 +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 "PanelPreview.h"
|
||||
|
||||
// Qt
|
||||
#include <QBoxLayout>
|
||||
|
||||
// CPanelPreview dialog
|
||||
|
||||
CPanelPreview::CPanelPreview(QWidget* pParent /*=nullptr*/)
|
||||
: QWidget(pParent)
|
||||
, m_previewCtrl(new CPreviewModelCtrl(this))
|
||||
{
|
||||
QBoxLayout* layout = new QHBoxLayout;
|
||||
layout->setMargin(0);
|
||||
layout->addWidget(m_previewCtrl);
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CPanelPreview::LoadFile(const QString& filename)
|
||||
{
|
||||
if (!filename.isEmpty())
|
||||
{
|
||||
m_previewCtrl->EnableUpdate(false);
|
||||
m_previewCtrl->LoadFile(filename, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +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_PANELPREVIEW_H
|
||||
#define CRYINCLUDE_EDITOR_PANELPREVIEW_H
|
||||
#pragma once
|
||||
|
||||
// CPanelPreview dialog
|
||||
|
||||
#include "Controls/PreviewModelCtrl.h"
|
||||
|
||||
|
||||
class CPanelPreview
|
||||
: public QWidget
|
||||
{
|
||||
public:
|
||||
CPanelPreview(QWidget* pParent = nullptr); // standard constructor
|
||||
|
||||
void LoadFile(const QString& filename);
|
||||
|
||||
QSize sizeHint() const override
|
||||
{
|
||||
return QSize(130, 240);
|
||||
}
|
||||
|
||||
protected:
|
||||
CPreviewModelCtrl* m_previewCtrl;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_PANELPREVIEW_H
|
||||
@@ -42,7 +42,6 @@
|
||||
# include <AzFramework/Input/Buses/Notifications/RawInputNotificationBus_Platform.h>
|
||||
#endif // defined(AZ_PLATFORM_WINDOWS)
|
||||
#include <AzFramework/Input/Devices/Mouse/InputDeviceMouse.h> // for AzFramework::InputDeviceMouse
|
||||
#include <AzFramework/API/AtomActiveInterface.h>
|
||||
|
||||
// AzQtComponents
|
||||
#include <AzQtComponents/Utilities/QtWindowUtilities.h>
|
||||
@@ -56,7 +55,6 @@
|
||||
|
||||
|
||||
// CryCommon
|
||||
#include <CryCommon/I3DEngine.h>
|
||||
#include <CryCommon/HMDBus.h>
|
||||
|
||||
// AzFramework
|
||||
@@ -90,6 +88,10 @@
|
||||
|
||||
#include <QtGui/private/qhighdpiscaling_p.h>
|
||||
|
||||
#include <IEntityRenderState.h>
|
||||
#include <IPhysics.h>
|
||||
#include <IStatObj.h>
|
||||
|
||||
AZ_CVAR(
|
||||
bool, ed_visibility_use, true, nullptr, AZ::ConsoleFunctorFlags::Null,
|
||||
"Enable/disable using the new IVisibilitySystem for Entity visibility determination");
|
||||
@@ -250,10 +252,6 @@ CRenderViewport::~CRenderViewport()
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int CRenderViewport::OnCreate()
|
||||
{
|
||||
m_renderer = GetIEditor()->GetRenderer();
|
||||
m_engine = GetIEditor()->Get3DEngine();
|
||||
assert(m_engine);
|
||||
|
||||
CreateRenderContext();
|
||||
|
||||
return 0;
|
||||
@@ -275,13 +273,10 @@ void CRenderViewport::resizeEvent(QResizeEvent* event)
|
||||
|
||||
gEnv->pSystem->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_RESIZE, width(), height());
|
||||
|
||||
if (AZ::Interface<AzFramework::AtomActiveInterface>::Get())
|
||||
{
|
||||
// We queue the window resize event because the render overlay may be hidden.
|
||||
// If the render overlay is not visible, the native window that is backing it will
|
||||
// also be hidden, and it will not resize until it becomes visible.
|
||||
m_windowResizedEvent = true;
|
||||
}
|
||||
// We queue the window resize event because the render overlay may be hidden.
|
||||
// If the render overlay is not visible, the native window that is backing it will
|
||||
// also be hidden, and it will not resize until it becomes visible.
|
||||
m_windowResizedEvent = true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -1037,7 +1032,7 @@ void CRenderViewport::Update()
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_renderer || !m_engine || m_rcClient.isEmpty() || GetIEditor()->IsInMatEditMode())
|
||||
if (!m_renderer || m_rcClient.isEmpty() || GetIEditor()->IsInMatEditMode())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1105,7 +1100,7 @@ void CRenderViewport::Update()
|
||||
|
||||
AzFramework::DebugDisplayRequestBus::BusPtr debugDisplayBus;
|
||||
AzFramework::DebugDisplayRequestBus::Bind(
|
||||
debugDisplayBus, AzToolsFramework::ViewportInteraction::g_mainViewportEntityDebugDisplayId);
|
||||
debugDisplayBus, AzFramework::g_defaultSceneEntityDebugDisplayId);
|
||||
AZ_Assert(debugDisplayBus, "Invalid DebugDisplayRequestBus.");
|
||||
|
||||
AzFramework::DebugDisplayRequests* debugDisplay =
|
||||
@@ -1160,9 +1155,6 @@ void CRenderViewport::Update()
|
||||
|
||||
m_renderer->SetClearColor(Vec3(0.4f, 0.4f, 0.4f));
|
||||
|
||||
// 3D engine stats
|
||||
GetIEditor()->GetSystem()->RenderBegin();
|
||||
|
||||
InitDisplayContext();
|
||||
|
||||
OnRender();
|
||||
@@ -1188,8 +1180,6 @@ void CRenderViewport::Update()
|
||||
}
|
||||
}
|
||||
|
||||
GetIEditor()->GetSystem()->RenderEnd(m_bRenderStats);
|
||||
|
||||
gEnv->pSystem->SetViewCamera(CurCamera);
|
||||
}
|
||||
|
||||
@@ -1425,8 +1415,6 @@ void CRenderViewport::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__);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1499,7 +1487,7 @@ void CRenderViewport::OnRender()
|
||||
}
|
||||
}
|
||||
|
||||
m_Camera.SetFrustum(w, h, fov, fNearZ, gEnv->p3DEngine->GetMaxViewDistance());
|
||||
m_Camera.SetFrustum(w, h, fov, fNearZ);
|
||||
}
|
||||
|
||||
GetIEditor()->GetSystem()->SetViewCamera(m_Camera);
|
||||
@@ -1535,7 +1523,7 @@ void CRenderViewport::OnRender()
|
||||
|
||||
AzFramework::DebugDisplayRequestBus::BusPtr debugDisplayBus;
|
||||
AzFramework::DebugDisplayRequestBus::Bind(
|
||||
debugDisplayBus, AzToolsFramework::ViewportInteraction::g_mainViewportEntityDebugDisplayId);
|
||||
debugDisplayBus, AzFramework::g_defaultSceneEntityDebugDisplayId);
|
||||
AZ_Assert(debugDisplayBus, "Invalid DebugDisplayRequestBus.");
|
||||
|
||||
AzFramework::DebugDisplayRequests* debugDisplay =
|
||||
@@ -1553,14 +1541,6 @@ void CRenderViewport::OnRender()
|
||||
if (levelIsDisplayable)
|
||||
{
|
||||
m_renderer->SetViewport(0, 0, m_renderer->GetWidth(), m_renderer->GetHeight(), m_nCurViewportID);
|
||||
|
||||
if (!AZ::Interface<AzFramework::AtomActiveInterface>::Get())
|
||||
{
|
||||
m_engine->Tick();
|
||||
m_engine->Update();
|
||||
|
||||
m_engine->RenderWorld(SHDF_ALLOW_AO | SHDF_ALLOWPOSTPROCESS | SHDF_ALLOW_WATER | SHDF_ALLOWHDR | SHDF_ZPASS, SRenderingPassInfo::CreateGeneralPassRenderingInfo(m_Camera), __FUNCTION__);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1568,11 +1548,6 @@ void CRenderViewport::OnRender()
|
||||
m_renderer->ClearTargetsLater(FRT_CLEAR_COLOR, viewportBackgroundColor);
|
||||
DrawBackground();
|
||||
}
|
||||
|
||||
if (!m_renderer->IsStereoEnabled())
|
||||
{
|
||||
GetIEditor()->GetSystem()->RenderStatistics();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -1602,7 +1577,6 @@ void CRenderViewport::InitDisplayContext()
|
||||
displayContext.settings = GetIEditor()->GetDisplaySettings();
|
||||
displayContext.view = this;
|
||||
displayContext.renderer = m_renderer;
|
||||
displayContext.engine = m_engine;
|
||||
displayContext.box.min = Vec3(-100000.0f, -100000.0f, -100000.0f);
|
||||
displayContext.box.max = Vec3(100000.0f, 100000.0f, 100000.0f);
|
||||
displayContext.camera = &m_Camera;
|
||||
@@ -1681,7 +1655,7 @@ void CRenderViewport::RenderAll()
|
||||
|
||||
AzFramework::DebugDisplayRequestBus::BusPtr debugDisplayBus;
|
||||
AzFramework::DebugDisplayRequestBus::Bind(
|
||||
debugDisplayBus, AzToolsFramework::ViewportInteraction::g_mainViewportEntityDebugDisplayId);
|
||||
debugDisplayBus, AzFramework::g_defaultSceneEntityDebugDisplayId);
|
||||
AZ_Assert(debugDisplayBus, "Invalid DebugDisplayRequestBus.");
|
||||
|
||||
AzFramework::DebugDisplayRequests* debugDisplay =
|
||||
@@ -2043,14 +2017,14 @@ float CRenderViewport::AngleStep()
|
||||
return GetViewManager()->GetGrid()->GetAngleSnap();
|
||||
}
|
||||
|
||||
AZ::Vector3 CRenderViewport::PickTerrain(const QPoint& point)
|
||||
AZ::Vector3 CRenderViewport::PickTerrain(const AzFramework::ScreenPoint& point)
|
||||
{
|
||||
FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
|
||||
|
||||
return LYVec3ToAZVec3(ViewToWorld(point, nullptr, true));
|
||||
return LYVec3ToAZVec3(ViewToWorld(AzToolsFramework::ViewportInteraction::QPointFromScreenPoint(point), nullptr, true));
|
||||
}
|
||||
|
||||
AZ::EntityId CRenderViewport::PickEntity(const QPoint& point)
|
||||
AZ::EntityId CRenderViewport::PickEntity(const AzFramework::ScreenPoint& point)
|
||||
{
|
||||
FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
|
||||
|
||||
@@ -2059,7 +2033,7 @@ AZ::EntityId CRenderViewport::PickEntity(const QPoint& point)
|
||||
AZ::EntityId entityId;
|
||||
HitContext hitInfo;
|
||||
hitInfo.view = this;
|
||||
if (HitTest(point, hitInfo))
|
||||
if (HitTest(AzToolsFramework::ViewportInteraction::QPointFromScreenPoint(point), hitInfo))
|
||||
{
|
||||
if (hitInfo.object && (hitInfo.object->GetType() == OBJTYPE_AZENTITY))
|
||||
{
|
||||
@@ -2100,12 +2074,13 @@ void CRenderViewport::FindVisibleEntities(AZStd::vector<AZ::EntityId>& visibleEn
|
||||
}
|
||||
}
|
||||
|
||||
QPoint CRenderViewport::ViewportWorldToScreen(const AZ::Vector3& worldPosition)
|
||||
AzFramework::ScreenPoint CRenderViewport::ViewportWorldToScreen(const AZ::Vector3& worldPosition)
|
||||
{
|
||||
FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
|
||||
|
||||
PreWidgetRendering();
|
||||
const QPoint screenPosition = WorldToView(AZVec3ToLYVec3(worldPosition));
|
||||
const AzFramework::ScreenPoint screenPosition =
|
||||
AzToolsFramework::ViewportInteraction::ScreenPointFromQPoint(WorldToView(AZVec3ToLYVec3(worldPosition)));
|
||||
PostWidgetRendering();
|
||||
|
||||
return screenPosition;
|
||||
@@ -2478,7 +2453,6 @@ void CRenderViewport::ToggleCameraObject()
|
||||
{
|
||||
if (m_viewSourceType == ViewSourceType::SequenceCamera)
|
||||
{
|
||||
gEnv->p3DEngine->GetPostEffectBaseGroup()->SetParam("Dof_Active", 0.0f);
|
||||
ResetToViewSourceType(ViewSourceType::LegacyCamera);
|
||||
}
|
||||
else
|
||||
@@ -2800,11 +2774,6 @@ void CRenderViewport::SetViewTM(const Matrix34& viewTM, bool bMoveOnly)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CRenderViewport::RenderSelectedRegion()
|
||||
{
|
||||
if (!m_engine)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AABB box;
|
||||
GetIEditor()->GetSelectedRegion(box);
|
||||
if (box.IsEmpty())
|
||||
@@ -3396,19 +3365,9 @@ bool CRenderViewport::AdjustObjectPosition(const ray_hit& hit, Vec3& outNormal,
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CRenderViewport::RayRenderMeshIntersection(IRenderMesh* pRenderMesh, const Vec3& vInPos, const Vec3& vInDir, Vec3& vOutPos, Vec3& vOutNormal) const
|
||||
bool CRenderViewport::RayRenderMeshIntersection(IRenderMesh*, const Vec3&, const Vec3&, Vec3&, Vec3&) const
|
||||
{
|
||||
SRayHitInfo hitInfo;
|
||||
hitInfo.bUseCache = false;
|
||||
hitInfo.bInFirstHit = false;
|
||||
hitInfo.inRay.origin = vInPos;
|
||||
hitInfo.inRay.direction = vInDir.GetNormalized();
|
||||
hitInfo.inReferencePoint = vInPos;
|
||||
hitInfo.fMaxHitDistance = 0;
|
||||
bool bRes = GetIEditor()->Get3DEngine()->RenderMeshRayIntersection(pRenderMesh, hitInfo, nullptr);
|
||||
vOutPos = hitInfo.vHitPos;
|
||||
vOutNormal = hitInfo.vHitNormal;
|
||||
return bRes;
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -3659,11 +3618,8 @@ bool CRenderViewport::CreateRenderContext()
|
||||
{
|
||||
m_bRenderContextCreated = true;
|
||||
|
||||
if (AZ::Interface<AzFramework::AtomActiveInterface>::Get())
|
||||
{
|
||||
AzFramework::WindowRequestBus::Handler::BusConnect(renderOverlayHWND());
|
||||
AzFramework::WindowSystemNotificationBus::Broadcast(&AzFramework::WindowSystemNotificationBus::Handler::OnWindowCreated, renderOverlayHWND());
|
||||
}
|
||||
AzFramework::WindowRequestBus::Handler::BusConnect(renderOverlayHWND());
|
||||
AzFramework::WindowSystemNotificationBus::Broadcast(&AzFramework::WindowSystemNotificationBus::Handler::OnWindowCreated, renderOverlayHWND());
|
||||
|
||||
WIN_HWND oldContext = m_renderer->GetCurrentContextHWND();
|
||||
m_renderer->CreateContext(renderOverlayHWND());
|
||||
@@ -3696,7 +3652,6 @@ void CRenderViewport::SetDefaultCamera()
|
||||
return;
|
||||
}
|
||||
ResetToViewSourceType(ViewSourceType::None);
|
||||
gEnv->p3DEngine->GetPostEffectBaseGroup()->SetParam("Dof_Active", 0.0f);
|
||||
GetViewManager()->SetCameraObjectId(m_cameraObjectId);
|
||||
SetName(m_defaultViewName);
|
||||
SetViewTM(m_defaultViewTM);
|
||||
@@ -3875,23 +3830,8 @@ void CRenderViewport::SetViewAndMovementLockFromEntityPerspective(const AZ::Enti
|
||||
|
||||
bool CRenderViewport::GetActiveCameraPosition(AZ::Vector3& cameraPos)
|
||||
{
|
||||
if (m_pPrimaryViewport == this)
|
||||
{
|
||||
if (GetIEditor()->IsInGameMode())
|
||||
{
|
||||
const Vec3 camPos = m_engine->GetRenderingCamera().GetPosition();
|
||||
cameraPos = LYVec3ToAZVec3(camPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use viewTM, which is synced with the camera and guaranteed to be up-to-date
|
||||
cameraPos = LYVec3ToAZVec3(m_viewTM.GetTranslation());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
cameraPos = LYVec3ToAZVec3(m_viewTM.GetTranslation());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CRenderViewport::GetActiveCameraState(AzFramework::CameraState& cameraState)
|
||||
@@ -3900,9 +3840,7 @@ bool CRenderViewport::GetActiveCameraState(AzFramework::CameraState& cameraState
|
||||
{
|
||||
if (GetIEditor()->IsInGameMode())
|
||||
{
|
||||
const auto& renderingCamera = m_engine->GetRenderingCamera();
|
||||
cameraState = CameraStateFromCCamera(
|
||||
renderingCamera, renderingCamera.GetFov(), m_rcClient.width(), m_rcClient.height());
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3974,18 +3912,6 @@ void CRenderViewport::RenderConstructionPlane()
|
||||
Ang3 angles = Ang3(pGrid->rotationAngles.x * gf_PI / 180.0, pGrid->rotationAngles.y * gf_PI / 180.0, pGrid->rotationAngles.z * gf_PI / 180.0);
|
||||
Matrix34 tm = Matrix33::CreateRotationXYZ(angles);
|
||||
|
||||
if (gSettings.snap.bGridGetFromSelected)
|
||||
{
|
||||
CSelectionGroup* sel = GetIEditor()->GetSelection();
|
||||
if (sel->GetCount() > 0)
|
||||
{
|
||||
CBaseObject* obj = sel->GetObject(0);
|
||||
tm = obj->GetWorldTM();
|
||||
tm.OrthonormalizeFast();
|
||||
tm.SetTranslation(Vec3(0, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
u = tm * u;
|
||||
v = tm * v;
|
||||
}
|
||||
@@ -4040,11 +3966,6 @@ void CRenderViewport::RenderConstructionPlane()
|
||||
void CRenderViewport::RenderSnappingGrid()
|
||||
{
|
||||
// First, Check whether we should draw the grid or not.
|
||||
CSelectionGroup* pSelGroup = GetIEditor()->GetSelection();
|
||||
if (pSelGroup == nullptr || pSelGroup->GetCount() != 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
CGrid* pGrid = GetViewManager()->GetGrid();
|
||||
if (pGrid->IsEnabled() == false && pGrid->IsAngleSnapEnabled() == false)
|
||||
{
|
||||
|
||||
@@ -190,17 +190,24 @@ public:
|
||||
bool ShowGrid() override;
|
||||
bool AngleSnappingEnabled() override;
|
||||
float AngleStep() override;
|
||||
QPoint ViewportWorldToScreen(const AZ::Vector3& worldPosition) override;
|
||||
AZStd::optional<AZ::Vector3> ViewportScreenToWorld(const QPoint&, float) override { return {}; }
|
||||
AZStd::optional<AzToolsFramework::ViewportInteraction::ProjectedViewportRay> ViewportScreenToWorldRay(const QPoint&) override { return {}; }
|
||||
AzFramework::ScreenPoint ViewportWorldToScreen(const AZ::Vector3& worldPosition) override;
|
||||
AZStd::optional<AZ::Vector3> ViewportScreenToWorld(const AzFramework::ScreenPoint&, float) override
|
||||
{
|
||||
return {};
|
||||
}
|
||||
AZStd::optional<AzToolsFramework::ViewportInteraction::ProjectedViewportRay> ViewportScreenToWorldRay(
|
||||
const AzFramework::ScreenPoint&) override
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
// AzToolsFramework::ViewportFreezeRequestBus
|
||||
bool IsViewportInputFrozen() override;
|
||||
void FreezeViewportInput(bool freeze) override;
|
||||
|
||||
// AzToolsFramework::MainEditorViewportInteractionRequestBus
|
||||
AZ::EntityId PickEntity(const QPoint& point) override;
|
||||
AZ::Vector3 PickTerrain(const QPoint& point) override;
|
||||
AZ::EntityId PickEntity(const AzFramework::ScreenPoint& point) override;
|
||||
AZ::Vector3 PickTerrain(const AzFramework::ScreenPoint& point) override;
|
||||
float TerrainHeight(const AZ::Vector2& position) override;
|
||||
void FindVisibleEntities(AZStd::vector<AZ::EntityId>& visibleEntitiesOut) override;
|
||||
bool ShowingWorldSpace() override;
|
||||
@@ -431,7 +438,6 @@ protected:
|
||||
|
||||
//! Assigned renderer.
|
||||
IRenderer* m_renderer = nullptr;
|
||||
I3DEngine* m_engine = nullptr;
|
||||
bool m_bRenderContextCreated = false;
|
||||
bool m_bInRotateMode = false;
|
||||
bool m_bInMoveMode = false;
|
||||
@@ -518,10 +524,6 @@ protected:
|
||||
OBB m_GroundOBB;
|
||||
Vec3 m_GroundOBBPos;
|
||||
|
||||
//-------------------------------------------
|
||||
// Render options.
|
||||
bool m_bRenderStats = true;
|
||||
|
||||
// Index of camera objects.
|
||||
mutable GUID m_cameraObjectId = GUID_NULL;
|
||||
mutable AZ::EntityId m_viewEntityId;
|
||||
|
||||
@@ -75,7 +75,6 @@
|
||||
#define IDC_PLATFORM_SALEM 2759
|
||||
#define IDC_GROUPBOX_GLOBALTAGS 2916
|
||||
#define IDC_GROUPBOX_FRAGMENTTAGS 2917
|
||||
#define ID_RESOURCES_GENERATECGFTHUMBNAILS 32894
|
||||
#define ID_RESOURCES_REDUCEWORKINGSET 32896
|
||||
#define ID_EDIT_HIDE 32898
|
||||
#define ID_EDIT_UNHIDEALL 32899
|
||||
@@ -91,7 +90,6 @@
|
||||
#define ID_EXPORT_INDOORS 32915
|
||||
#define ID_VIEW_CYCLE2DVIEWPORT 32916
|
||||
#define ID_SNAPANGLE 32917
|
||||
#define ID_EDIT_RENAMEOBJECT 32925
|
||||
#define ID_CHANGEMOVESPEED_INCREASE 32928
|
||||
#define ID_CHANGEMOVESPEED_DECREASE 32929
|
||||
#define ID_CHANGEMOVESPEED_CHANGESTEP 32930
|
||||
@@ -134,7 +132,6 @@
|
||||
#define ID_FILE_EDITEDITORINI 33543
|
||||
#define ID_FILE_EDITLOGFILE 33544
|
||||
#define ID_PREFERENCES 33546
|
||||
#define ID_RELOAD_GEOMETRY 33549
|
||||
#define ID_REDO 33550
|
||||
#define ID_SWITCH_PHYSICS 33555
|
||||
#define ID_REF_COORDS_SYS 33556
|
||||
|
||||
@@ -252,8 +252,6 @@ SEditorSettings::SEditorSettings()
|
||||
gui.hSystemFontBold = QFont("Ms Shell Dlg 2", lfHeight, QFont::Bold);
|
||||
gui.hSystemFontItalic = QFont("Ms Shell Dlg 2", lfHeight, QFont::Normal, true);
|
||||
|
||||
bForceSkyUpdate = true;
|
||||
|
||||
backgroundUpdatePeriod = 0;
|
||||
g_TemporaryLevelName = nullptr;
|
||||
|
||||
@@ -647,8 +645,6 @@ void SEditorSettings::Save()
|
||||
SaveValue("Settings\\ObjectColors", "GeometryAlpha", objectColorSettings.fGeomAlpha);
|
||||
SaveValue("Settings\\ObjectColors", "ChildGeometryAlpha", objectColorSettings.fChildGeomAlpha);
|
||||
|
||||
SaveValue("Settings", "ForceSkyUpdate", gSettings.bForceSkyUpdate);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Smart file open settings
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -873,8 +869,6 @@ void SEditorSettings::Load()
|
||||
LoadValue("Settings\\ObjectColors", "GeometryAlpha", objectColorSettings.fGeomAlpha);
|
||||
LoadValue("Settings\\ObjectColors", "ChildGeometryAlpha", objectColorSettings.fChildGeomAlpha);
|
||||
|
||||
LoadValue("Settings", "ForceSkyUpdate", gSettings.bForceSkyUpdate);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Smart file open settings
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -467,8 +467,6 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
|
||||
bool bSettingsManagerMode;
|
||||
|
||||
bool bForceSkyUpdate;
|
||||
|
||||
bool bAutoSaveTagPoints;
|
||||
|
||||
bool bNavigationContinuousUpdate;
|
||||
|
||||
@@ -1,198 +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 "ThumbnailGenerator.h"
|
||||
|
||||
// Editor
|
||||
#include "Util/Image.h"
|
||||
#include "Util/ImageUtil.h" // for CUmageUtil
|
||||
#include "WaitProgress.h" // for CWaitProgress
|
||||
|
||||
#if defined(AZ_PLATFORM_MAC) || defined(AZ_PLATFORM_LINUX)
|
||||
#include <sys/types.h>
|
||||
#include <utime.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
CThumbnailGenerator::CThumbnailGenerator(void)
|
||||
{
|
||||
}
|
||||
|
||||
CThumbnailGenerator::~CThumbnailGenerator(void)
|
||||
{
|
||||
}
|
||||
|
||||
// Get directory contents.
|
||||
static bool scan_directory(const QString& root, const QString& path, const QString& file, QStringList& files, bool recursive)
|
||||
{
|
||||
QString fullPath = root + path + file;
|
||||
QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags;
|
||||
if (recursive)
|
||||
{
|
||||
flags = QDirIterator::Subdirectories;
|
||||
}
|
||||
QDirIterator dirIterator(fullPath, {file}, QDir::Files, flags);
|
||||
if (!dirIterator.hasNext())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Find the rest of the .c files.
|
||||
while (dirIterator.hasNext())
|
||||
{
|
||||
files.push_back(dirIterator.next());
|
||||
//FileInfo fi;
|
||||
//fi.attrib = c_file.attrib;
|
||||
//fi.name = path + c_file.name;
|
||||
/*
|
||||
// Add . after file name without extension.
|
||||
if (fi.name.find('.') == CString::npos) {
|
||||
fi.name.append( "." );
|
||||
}
|
||||
*/
|
||||
//fi.size = c_file.size;
|
||||
//fi.time = c_file.time_write;
|
||||
//files.push_back( fi );
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
#define FileTimeType FILETIME
|
||||
|
||||
inline void GetThumbFileTime(const char* fileName, FILETIME& time)
|
||||
{
|
||||
HANDLE hFile = CreateFile(fileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (INVALID_HANDLE_VALUE != hFile)
|
||||
{
|
||||
GetFileTime(hFile, NULL, NULL, &time);
|
||||
CloseHandle(hFile);
|
||||
}
|
||||
}
|
||||
|
||||
inline void SetThumbFileTime(const char* fileName, FILETIME& time)
|
||||
{
|
||||
HANDLE hFile = CreateFile(fileName, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (INVALID_HANDLE_VALUE != hFile)
|
||||
{
|
||||
SetFileTime(hFile, NULL, NULL, &time);
|
||||
CloseHandle(hFile);
|
||||
}
|
||||
}
|
||||
|
||||
inline bool ThumbFileTimeIsEqual(const FILETIME& ft1, const FILETIME& ft2)
|
||||
{
|
||||
return ft1.dwHighDateTime == ft2.dwHighDateTime && ft1.dwLowDateTime == ft2.dwLowDateTime;
|
||||
}
|
||||
#elif defined(AZ_PLATFORM_MAC) || defined(AZ_PLATFORM_LINUX)
|
||||
#define FileTimeType utimbuf
|
||||
|
||||
inline void GetThumbFileTime(const char* fileName, utimbuf& times)
|
||||
{
|
||||
struct stat sb;
|
||||
if (stat(fileName, &sb) == 0)
|
||||
{
|
||||
times.actime = sb.st_atime;
|
||||
times.modtime = sb.st_mtime;
|
||||
}
|
||||
}
|
||||
|
||||
inline void SetThumbFileTime(const char* fileName, const utimbuf& times)
|
||||
{
|
||||
utime(fileName, ×);
|
||||
}
|
||||
|
||||
inline bool ThumbFileTimeIsEqual(const utimbuf& ft1, const utimbuf& ft2)
|
||||
{
|
||||
return ft1.modtime == ft2.modtime;
|
||||
}
|
||||
#endif
|
||||
|
||||
void CThumbnailGenerator::GenerateForDirectory(const QString& path)
|
||||
{
|
||||
return;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QStringList files;
|
||||
//CString dir = GetIEditor()->GetPrimaryCDFolder();
|
||||
QString dir = path;
|
||||
scan_directory(dir, "", "*.*", files, true);
|
||||
|
||||
I3DEngine* engine = GetIEditor()->Get3DEngine();
|
||||
|
||||
int thumbSize = 128;
|
||||
CImageEx image;
|
||||
image.Allocate(thumbSize, thumbSize);
|
||||
|
||||
char drive[_MAX_DRIVE];
|
||||
char fdir[_MAX_DIR];
|
||||
char fname[_MAX_FNAME];
|
||||
char fext[_MAX_EXT];
|
||||
char bmpFile[1024];
|
||||
|
||||
GetIEditor()->ShowConsole(true);
|
||||
CWaitProgress wait("Generating CGF Thumbnails");
|
||||
for (int i = 0; i < files.size(); i++)
|
||||
{
|
||||
QString file = dir + files[i];
|
||||
_splitpath_s(file.toUtf8().data(), drive, fdir, fname, fext);
|
||||
|
||||
//if (_stricmp(fext,".cgf") != 0 && _stricmp(fext,".bld") != 0)
|
||||
if (_stricmp(fext, ".cgf") != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!wait.Step(100 * i / files.size()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
_makepath_s(bmpFile, drive, fdir, fname, ".tmb");
|
||||
|
||||
FileTimeType ft1, ft2;
|
||||
GetThumbFileTime(file.toUtf8().data(), ft1);
|
||||
GetThumbFileTime(bmpFile, ft2);
|
||||
// Both cgf and bmp have same time stamp.
|
||||
if (ThumbFileTimeIsEqual(ft1, ft2))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//CLogFile::FormatLine( "Generating thumbnail for %s...",file );
|
||||
|
||||
_smart_ptr<IStatObj> obj = engine->LoadStatObjAutoRef(file.toUtf8().data(), NULL, NULL, false);
|
||||
if (obj)
|
||||
{
|
||||
assert(!"IStatObj::MakeObjectPicture does not exist anymore");
|
||||
// obj->MakeObjectPicture( (unsigned char*)image.GetData(),thumbSize );
|
||||
|
||||
CImageUtil::SaveBitmap(bmpFile, image);
|
||||
SetThumbFileTime(bmpFile, ft1);
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
SetFileAttributes(bmpFile, FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_NOT_CONTENT_INDEXED);
|
||||
#endif
|
||||
obj->Release();
|
||||
}
|
||||
}
|
||||
//GetIEditor()->ShowConsole( false );
|
||||
}
|
||||
|
||||
void CThumbnailGenerator::GenerateForFile([[maybe_unused]] const QString& fileName)
|
||||
{
|
||||
}
|
||||
@@ -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.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_EDITOR_THUMBNAILGENERATOR_H
|
||||
#define CRYINCLUDE_EDITOR_THUMBNAILGENERATOR_H
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
class CThumbnailGenerator
|
||||
{
|
||||
public:
|
||||
CThumbnailGenerator(void);
|
||||
~CThumbnailGenerator(void);
|
||||
|
||||
void GenerateForDirectory(const QString& path);
|
||||
void GenerateForFile(const QString& fileName);
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_THUMBNAILGENERATOR_H
|
||||
@@ -1,34 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>TimeOfDay/main-00.png</file>
|
||||
<file>TimeOfDay/main-01.png</file>
|
||||
<file>TimeOfDay/main-02.png</file>
|
||||
<file>TimeOfDay/main-03.png</file>
|
||||
<file>TimeOfDay/main-04.png</file>
|
||||
<file>TimeOfDay/main-05.png</file>
|
||||
<file>TimeOfDay/main-06.png</file>
|
||||
<file>TimeOfDay/main-07.png</file>
|
||||
<file>TimeOfDay/main-08.png</file>
|
||||
<file>TimeOfDay/main-09.png</file>
|
||||
<file>TimeOfDay/main-10.png</file>
|
||||
<file>TimeOfDay/main-11.png</file>
|
||||
<file>TimeOfDay/main-12.png</file>
|
||||
<file>Common/spline_edit-00.png</file>
|
||||
<file>Common/spline_edit-01.png</file>
|
||||
<file>Common/spline_edit-02.png</file>
|
||||
<file>Common/spline_edit-03.png</file>
|
||||
<file>Common/spline_edit-04.png</file>
|
||||
<file>Common/spline_edit-05.png</file>
|
||||
<file>Common/spline_edit-06.png</file>
|
||||
<file>Common/spline_edit-07.png</file>
|
||||
<file>Common/spline_edit-08.png</file>
|
||||
<file>Common/spline_edit-09.png</file>
|
||||
<file>Common/spline_edit-10.png</file>
|
||||
<file>Common/spline_edit-11.png</file>
|
||||
<file>Common/spline_edit-12.png</file>
|
||||
<file>Common/spline_edit-13.png</file>
|
||||
<file>Common/spline_edit-14.png</file>
|
||||
<file>Common/spline_edit-15.png</file>
|
||||
<file>Common/spline_edit-16.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,182 +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_TIMEOFDAYDIALOG_H
|
||||
#define CRYINCLUDE_EDITOR_TIMEOFDAYDIALOG_H
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include "Controls/TimelineCtrl.h"
|
||||
#include <Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.h>
|
||||
#include "Undo/IUndoManagerListener.h"
|
||||
#include "LyViewPaneNames.h"
|
||||
#include <QMainWindow>
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class QResizeEvent;
|
||||
class CCurveEditorCtrl;
|
||||
class CHDRPane;
|
||||
|
||||
namespace Ui {
|
||||
class TimeOfDayDialog;
|
||||
}
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Window that holds effector info.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
class SANDBOX_API CTimeOfDayDialog
|
||||
: public QMainWindow
|
||||
, public IEditorNotifyListener
|
||||
, public ISystemEventListener
|
||||
, public IUndoManagerListener
|
||||
{
|
||||
AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
Q_OBJECT
|
||||
public:
|
||||
static const char* ClassName() { return LyViewPane::TimeOfDayEditor; }
|
||||
static const GUID& GetClassID();
|
||||
|
||||
CTimeOfDayDialog(QWidget* parent = nullptr);
|
||||
~CTimeOfDayDialog();
|
||||
|
||||
static void RegisterViewClass();
|
||||
void UpdateValues();
|
||||
|
||||
// overrides from ISystemEventListener
|
||||
void OnSystemEvent(ESystemEvent event, UINT_PTR wparam, UINT_PTR lparam) override;
|
||||
|
||||
protected:
|
||||
void OnBeforeSplineChange();
|
||||
void OnSplineChange(const QWidget* source);
|
||||
void OnPlayAnimFrom0();
|
||||
void OnChangeTimeAnimSpeed(double speed);
|
||||
|
||||
void OnImport();
|
||||
void OnExport();
|
||||
void OnExpandAll();
|
||||
void OnResetToDefaultValues();
|
||||
void OnCollapseAll();
|
||||
|
||||
void OnHold();
|
||||
void OnFetch();
|
||||
void OnUndo();
|
||||
void OnRedo();
|
||||
|
||||
void OnPropertySelected(IVariable* node);
|
||||
void OnSplineCtrlScrollZoom();
|
||||
void OnTimelineCtrlChange();
|
||||
|
||||
void Init();
|
||||
|
||||
void OnUpdateProperties(IVariable* var);
|
||||
|
||||
void CreateProperties();
|
||||
|
||||
void SetTime(float time);
|
||||
void SetTimeRange(float fTimeStart, float fTimeEnd, float fSpeed);
|
||||
float GetTime() const;
|
||||
|
||||
void RefreshPropertiesValues();
|
||||
void ResetSpline(IVariable* var);
|
||||
|
||||
IVariable* FindVariable(const char* name) const;
|
||||
|
||||
void CopyAllProperties();
|
||||
void PasteAllProperties();
|
||||
|
||||
void HdrPropertySelected(IVariable* v);
|
||||
void StartTimeChanged(const QTime& time);
|
||||
void EndTimeChanged(const QTime& time);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// IEditorNotifyListener
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual void OnEditorNotifyEvent(EEditorNotifyEvent event);
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// IUndoManagerListener
|
||||
void SignalNumUndoRedo(const unsigned int& numUndo, const unsigned int& numRedo) override;
|
||||
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
|
||||
private:
|
||||
void UpdateUI(bool updateProperties=true);
|
||||
void SetTimeFromActiveKey(bool useColorGradient = false);
|
||||
|
||||
bool m_alive = true;
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
QScopedPointer<Ui::TimeOfDayDialog> m_ui;
|
||||
|
||||
CHDRPane* m_pHDRPane;
|
||||
CVarBlockPtr m_pVars;
|
||||
|
||||
TimelineWidget* m_timelineCtrl;
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
float m_maxTime;
|
||||
};
|
||||
|
||||
class CHDRPane
|
||||
: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CHDRPane(CTimeOfDayDialog* pTODDlg);
|
||||
|
||||
ReflectedPropertyControl& properties() { return *m_propsCtrl; }
|
||||
CVarBlockPtr variables() { return m_pVars; }
|
||||
|
||||
void UpdateFilmCurve();
|
||||
|
||||
signals:
|
||||
void propertySelected(IVariable* variable);
|
||||
|
||||
protected:
|
||||
bool Init();
|
||||
void OnPropertySelected(IVariable*);
|
||||
|
||||
bool GetFilmCurveParams(float& shoulderScale, float& midScale, float& toeScale, float& whitePoint) const;
|
||||
|
||||
CTimeOfDayDialog* m_pTODDlg;
|
||||
CCurveEditorCtrl* m_filmCurveCtrl;
|
||||
ReflectedPropertyControl* m_propsCtrl;
|
||||
CVarBlockPtr m_pVars;
|
||||
};
|
||||
|
||||
/** Undo object stored when track is modified.
|
||||
*/
|
||||
class CUndoTimeOfDayObject
|
||||
: public IUndoObject
|
||||
{
|
||||
public:
|
||||
CUndoTimeOfDayObject();
|
||||
|
||||
protected:
|
||||
virtual int GetSize() { return sizeof(*this); }
|
||||
virtual QString GetDescription() { return "Time of Day"; };
|
||||
|
||||
virtual void Undo(bool bUndo);
|
||||
virtual void Redo();
|
||||
|
||||
private:
|
||||
void UpdateTimeOfDayDialog();
|
||||
|
||||
XmlNodeRef m_undo;
|
||||
XmlNodeRef m_redo;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_TIMEOFDAYDIALOG_H
|
||||
@@ -1,980 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TimeOfDayDialog</class>
|
||||
<widget class="QMainWindow" name="TimeOfDayDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1073</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<property name="dockOptions">
|
||||
<set>QMainWindow::AllowNestedDocks|QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks</set>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_3" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tangentsToAutoButton">
|
||||
<property name="toolTip">
|
||||
<string>Set In/Out Tangents to Auto</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="inTangentToZeroButton">
|
||||
<property name="toolTip">
|
||||
<string>Set In Tangent to Zero</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="inTangentToStepButton">
|
||||
<property name="toolTip">
|
||||
<string>Set In Tangent to Step</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="inTangentToLinearButton">
|
||||
<property name="toolTip">
|
||||
<string>Set In Tangent to Linear</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="outTangentToZerobutton">
|
||||
<property name="toolTip">
|
||||
<string>Set Out Tangent to Zero</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="outTangentToStepButton">
|
||||
<property name="toolTip">
|
||||
<string>Set Out Tangent to Step</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="outTangentToLinearButton">
|
||||
<property name="toolTip">
|
||||
<string>Set Out Tangent to Linear</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="fitSplinesHorizontalButton">
|
||||
<property name="toolTip">
|
||||
<string>Fit Splines to the Visible Width</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="fitSplinesVerticalButton">
|
||||
<property name="toolTip">
|
||||
<string>Fit Splines to the Visible Height</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="splineSnapGridX">
|
||||
<property name="toolTip">
|
||||
<string>Snap to time grid</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="splineSnapGridY">
|
||||
<property name="toolTip">
|
||||
<string>Snap to value grid</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="previousKeyButton">
|
||||
<property name="toolTip">
|
||||
<string>Previous Key</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="nextKeyButton">
|
||||
<property name="toolTip">
|
||||
<string>Next Key</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="removeAllExceptSelectedButton">
|
||||
<property name="toolTip">
|
||||
<string>Remove all Keys BUT This</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>69</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_4" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="CColorGradientCtrl" name="colorGradient" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="SplineWidget" name="spline" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_7" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
<string>Timeline</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string>23:59</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>00:00</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string>12:00</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="TimeOfDaySlider" name="timelineSlider" native="true">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::WheelFocus</enum>
|
||||
</property>
|
||||
<property name="maximum" stdset="0">
|
||||
<number>1439</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="windowTitle">
|
||||
<string>toolBar</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="floatable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="actionUndo"/>
|
||||
<addaction name="actionRedo"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionImportFile"/>
|
||||
<addaction name="actionExportFile"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionPlayPause"/>
|
||||
<addaction name="actionSetTimeTo0000"/>
|
||||
<addaction name="actionSetTimeTo0600"/>
|
||||
<addaction name="actionSetTimeTo1200"/>
|
||||
<addaction name="actionSetTimeTo1800"/>
|
||||
<addaction name="actionSetTimeTo2400"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionStartStopRecording"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionHold"/>
|
||||
<addaction name="actionFetch"/>
|
||||
</widget>
|
||||
<widget class="QDockWidget" name="hdrPaneDock">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>350</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="features">
|
||||
<set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
|
||||
</property>
|
||||
<property name="allowedAreas">
|
||||
<set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>HDR Settings</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>1</number>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="dockWidgetContents">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4"/>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QDockWidget" name="parametersDock">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>450</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="features">
|
||||
<set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
|
||||
</property>
|
||||
<property name="allowedAreas">
|
||||
<set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Parameters</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>2</number>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="dockWidgetContents_4">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<widget class="ReflectedPropertyControl" name="parameters" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QDockWidget" name="tasksDock">
|
||||
<property name="features">
|
||||
<set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
|
||||
</property>
|
||||
<property name="allowedAreas">
|
||||
<set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Time of Day Tasks</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>1</number>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="dockWidgetContents_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCollapsibleGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Tasks</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="ClickableLabel" name="importFromFileClickable">
|
||||
<property name="text">
|
||||
<string>Import From File</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ClickableLabel" name="exportToFileClickable">
|
||||
<property name="text">
|
||||
<string>Export To File</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ClickableLabel" name="resetValuesClickable">
|
||||
<property name="text">
|
||||
<string>Reset Values</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ClickableLabel" name="expandAllClickable">
|
||||
<property name="text">
|
||||
<string>Expand All</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ClickableLabel" name="collapseAllClickable">
|
||||
<property name="text">
|
||||
<string>Collapse All</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCollapsibleGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Time</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Current Time</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>currentTimeEdit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QTimeEdit" name="currentTimeEdit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Start Time</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>startTimeEdit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QTimeEdit" name="startTimeEdit"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>End Time</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>endTimeEdit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QTimeEdit" name="endTimeEdit"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Play Speed</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>playSpeedDoubleSpinBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="AzQtComponents::DoubleSpinBox" name="playSpeedDoubleSpinBox">
|
||||
<property name="singleStep">
|
||||
<double>0.001000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCollapsibleGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Update Tasks</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="ClickableLabel" name="playClickable">
|
||||
<property name="text">
|
||||
<string>Play</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ClickableLabel" name="stopClickable">
|
||||
<property name="text">
|
||||
<string>Stop</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="forceSkyUpdateCheckBox">
|
||||
<property name="text">
|
||||
<string>Force sky update</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>139</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<action name="actionUndo">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Undo</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Undo</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRedo">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Redo</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Redo</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionImportFile">
|
||||
<property name="text">
|
||||
<string>Import File</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Import File</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExportFile">
|
||||
<property name="text">
|
||||
<string>Export File</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Export File</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPlayPause">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Play/Pause</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Play/Pause</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSetTimeTo0000">
|
||||
<property name="text">
|
||||
<string>00</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Set Time to 00:00</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSetTimeTo0600">
|
||||
<property name="text">
|
||||
<string>06</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Set Time to 06:00</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSetTimeTo1200">
|
||||
<property name="text">
|
||||
<string>12</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Set Time to 12:00</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSetTimeTo1800">
|
||||
<property name="text">
|
||||
<string>18</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Set Time to 18:00</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSetTimeTo2400">
|
||||
<property name="text">
|
||||
<string>24</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Set Time to 23:59</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionStartStopRecording">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start/Stop Recording</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Start/Stop Recording</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionHold">
|
||||
<property name="text">
|
||||
<string>Hold</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Hold</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFetch">
|
||||
<property name="text">
|
||||
<string>Fetch</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Fetch</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ReflectedPropertyControl</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QCollapsibleGroupBox</class>
|
||||
<extends>QGroupBox</extends>
|
||||
<header>QtUI/QCollapsibleGroupBox.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ClickableLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>QtUI/ClickableLabel.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>SplineWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>Controls/SplineCtrlEx.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>CColorGradientCtrl</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>Controls/ColorGradientCtrl.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>AzQtComponents::DoubleSpinBox</class>
|
||||
<extends>QDoubleSpinBox</extends>
|
||||
<header>AzQtComponents/Components/Widgets/SpinBox.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>TimeOfDaySlider</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>Controls/TimeOfDaySlider.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>timelineSlider</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
// AzCore
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzFramework/API/AtomActiveInterface.h>
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
|
||||
// Qt
|
||||
|
||||
@@ -1505,12 +1505,6 @@ void CTrackViewDialog::OnEditorNotifyEvent(EEditorNotifyEvent event)
|
||||
m_bIgnoreUpdates = false;
|
||||
OnGameOrSimModeLock(false);
|
||||
break;
|
||||
case eNotify_OnMissionChange:
|
||||
if (!m_bIgnoreUpdates)
|
||||
{
|
||||
ReloadSequences();
|
||||
}
|
||||
break;
|
||||
case eNotify_OnReloadTrackView:
|
||||
if (!m_bIgnoreUpdates)
|
||||
{
|
||||
|
||||
@@ -832,32 +832,7 @@ void CTrackViewNodesCtrl::UpdateAnimNodeRecord(CRecord* record, CTrackViewAnimNo
|
||||
}
|
||||
else if (nodeType == AnimNodeType::Material)
|
||||
{
|
||||
// Check if a valid material can be found by the node name.
|
||||
_smart_ptr<IMaterial> pMaterial = nullptr;
|
||||
QString matName;
|
||||
int subMtlIndex = GetMatNameAndSubMtlIndexFromName(matName, animNode->GetName());
|
||||
pMaterial = gEnv->p3DEngine->GetMaterialManager()->FindMaterial(matName.toUtf8().data());
|
||||
if (pMaterial)
|
||||
{
|
||||
bool bMultiMat = pMaterial->GetSubMtlCount() > 0;
|
||||
bool bMultiMatWithoutValidIndex = bMultiMat && (subMtlIndex < 0 || subMtlIndex >= pMaterial->GetSubMtlCount());
|
||||
bool bLeafMatWithIndex = !bMultiMat && subMtlIndex != -1;
|
||||
if (bMultiMatWithoutValidIndex || bLeafMatWithIndex)
|
||||
{
|
||||
pMaterial = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pMaterial)
|
||||
{
|
||||
record->setForeground(0, TextColorForInvalidMaterial);
|
||||
}
|
||||
else
|
||||
{
|
||||
// set to default color from palette
|
||||
// materials that originally pointed to material groups and are changed to sub-materials need this to reset their color
|
||||
record->setForeground(0, palette().color(foregroundRole()));
|
||||
}
|
||||
record->setForeground(0, TextColorForInvalidMaterial);
|
||||
}
|
||||
|
||||
// Mark the active director and other directors properly.
|
||||
@@ -2163,43 +2138,6 @@ int CTrackViewNodesCtrl::ShowPopupMenuSingleSelection(SContextMenu& contextMenu,
|
||||
bAppended = true;
|
||||
}
|
||||
|
||||
// Sub material menu
|
||||
if (bOnNode && animNode->GetType() == AnimNodeType::Material)
|
||||
{
|
||||
QString matName;
|
||||
int subMtlIndex = GetMatNameAndSubMtlIndexFromName(matName, animNode->GetName());
|
||||
_smart_ptr<IMaterial> pMtl = gEnv->p3DEngine->GetMaterialManager()->FindMaterial(matName.toUtf8().data());
|
||||
bool bMultMatNode = pMtl ? pMtl->GetSubMtlCount() > 0 : false;
|
||||
|
||||
bool bMatAppended = false;
|
||||
|
||||
if (bMultMatNode)
|
||||
{
|
||||
for (int k = 0; k < pMtl->GetSubMtlCount(); ++k)
|
||||
{
|
||||
_smart_ptr<IMaterial> pSubMaterial = pMtl->GetSubMtl(k);
|
||||
|
||||
if (pSubMaterial)
|
||||
{
|
||||
QString subMaterialName = pSubMaterial->GetName();
|
||||
|
||||
if (!subMaterialName.isEmpty())
|
||||
{
|
||||
AddMenuSeperatorConditional(contextMenu.main, bAppended);
|
||||
QString subMatName = QString("[%1] %2").arg(k + 1).arg(subMaterialName);
|
||||
QAction* a = contextMenu.main.addAction(subMatName);
|
||||
a->setData(eMI_SelectSubmaterialBase + k);
|
||||
a->setCheckable(true);
|
||||
a->setChecked(k == subMtlIndex);
|
||||
bMatAppended = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bAppended = bAppended || bMatAppended;
|
||||
}
|
||||
|
||||
// Delete track menu
|
||||
if (bOnTrackNotSub)
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "Util/ImageTIF.h"
|
||||
#include "Objects/BaseObject.h"
|
||||
|
||||
#include <IEntityRenderState.h>
|
||||
|
||||
class CubemapSizeModel
|
||||
: public QAbstractListModel
|
||||
|
||||
@@ -2088,7 +2088,6 @@ void CFileUtil::GatherAssetFilenamesFromLevel(std::set<QString>& rOutFilenames,
|
||||
rOutFilenames.clear();
|
||||
CBaseObjectsArray objArr;
|
||||
CUsedResources usedRes;
|
||||
IMaterialManager* pMtlMan = GetIEditor()->Get3DEngine()->GetMaterialManager();
|
||||
|
||||
GetIEditor()->GetObjectManager()->GetObjects(objArr);
|
||||
|
||||
@@ -2116,66 +2115,6 @@ void CFileUtil::GatherAssetFilenamesFromLevel(std::set<QString>& rOutFilenames,
|
||||
rOutFilenames.insert(tmpStr);
|
||||
}
|
||||
}
|
||||
|
||||
uint32 mtlCount = 0;
|
||||
|
||||
pMtlMan->GetLoadedMaterials(NULL, mtlCount);
|
||||
|
||||
if (mtlCount > 0)
|
||||
{
|
||||
AZStd::vector<_smart_ptr<IMaterial>> arrMtls;
|
||||
|
||||
arrMtls.resize(mtlCount);
|
||||
pMtlMan->GetLoadedMaterials(&arrMtls, mtlCount);
|
||||
|
||||
for (size_t i = 0; i < mtlCount; ++i)
|
||||
{
|
||||
_smart_ptr<IMaterial> pMtl = arrMtls[i];
|
||||
|
||||
size_t subMtls = pMtl->GetSubMtlCount();
|
||||
|
||||
// for the main material
|
||||
IRenderShaderResources* pShaderRes = pMtl->GetShaderItem().m_pShaderResources;
|
||||
|
||||
// add the material filename
|
||||
rOutFilenames.insert(pMtl->GetName());
|
||||
|
||||
if (pShaderRes)
|
||||
{
|
||||
for ( auto iter= pShaderRes->GetTexturesResourceMap()->begin() ;
|
||||
iter!= pShaderRes->GetTexturesResourceMap()->end() ; ++iter )
|
||||
{
|
||||
SEfResTexture* pTex = &(iter->second);
|
||||
// add the texture filename
|
||||
rOutFilenames.insert(pTex->m_Name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
// for the submaterials
|
||||
for (size_t s = 0; s < subMtls; ++s)
|
||||
{
|
||||
_smart_ptr<IMaterial> pSubMtl = pMtl->GetSubMtl(s);
|
||||
|
||||
// fill up dependencies
|
||||
if (pSubMtl)
|
||||
{
|
||||
IRenderShaderResources* pShaderRes2 = pSubMtl->GetShaderItem().m_pShaderResources;
|
||||
|
||||
rOutFilenames.insert(pSubMtl->GetName());
|
||||
|
||||
if (pShaderRes2)
|
||||
{
|
||||
for (auto iter = pShaderRes2->GetTexturesResourceMap()->begin();
|
||||
iter != pShaderRes2->GetTexturesResourceMap()->end(); ++iter)
|
||||
{
|
||||
SEfResTexture* pTex = &(iter->second);
|
||||
rOutFilenames.insert(pTex->m_Name.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32 CFileUtil::GetAttributes(const char* filename, bool bUseSourceControl /*= true*/)
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
#include "KDTree.h"
|
||||
|
||||
#include <IStatObj.h>
|
||||
|
||||
class KDTreeNode
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -1,445 +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 "EditorDefs.h"
|
||||
|
||||
#include "VariableTypeInfo.h"
|
||||
#include "TypeInfo_impl.h"
|
||||
#include "IShader_info.h"
|
||||
|
||||
#ifndef AZ_MONOLITHIC_BUILD
|
||||
#include "I3DEngine_info.h"
|
||||
#endif
|
||||
|
||||
#include "Variable.h"
|
||||
#include "UIEnumsDatabase.h"
|
||||
|
||||
// CryCommon
|
||||
#include <CryTypeInfo.h>
|
||||
|
||||
|
||||
IVariable* CVariableTypeInfo::Create(CTypeInfo::CVarInfo const& VarInfo, void* pAddress, const void* pAddressDefault)
|
||||
{
|
||||
pAddress = VarInfo.GetAddress(pAddress);
|
||||
pAddressDefault = VarInfo.GetAddress(pAddressDefault);
|
||||
|
||||
EType eType = GetType(VarInfo.Type);
|
||||
if (eType == ARRAY)
|
||||
{
|
||||
return new CVariableTypeInfoStruct(VarInfo, pAddress, pAddressDefault);
|
||||
}
|
||||
|
||||
if (VarInfo.Type.EnumElem(0))
|
||||
{
|
||||
return new CVariableTypeInfoEnum(VarInfo, pAddress, pAddressDefault);
|
||||
}
|
||||
|
||||
ISplineInterpolator* pSpline = 0;
|
||||
if (VarInfo.Type.ToValue(pAddress, pSpline))
|
||||
{
|
||||
return new CVariableTypeInfoSpline(VarInfo, pAddress, pAddressDefault, pSpline);
|
||||
}
|
||||
|
||||
return new CVariableTypeInfo(VarInfo, pAddress, pAddressDefault, eType);
|
||||
}
|
||||
|
||||
CVariableTypeInfo::EType CVariableTypeInfo::GetType(CTypeInfo const& typeInfo)
|
||||
{
|
||||
// Translation to editor type values is currently done with some clunky type and name testing.
|
||||
if (typeInfo.HasSubVars())
|
||||
{
|
||||
if (typeInfo.IsType<Vec3>() && !typeInfo.NextSubVar(0)->Type.IsType<Vec3>())
|
||||
{
|
||||
// This is a vector type (and not a sub-classed vector type)
|
||||
return IVariable::VECTOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
return IVariable::ARRAY;
|
||||
}
|
||||
}
|
||||
else if (typeInfo.IsType<bool>())
|
||||
{
|
||||
return IVariable::BOOL;
|
||||
}
|
||||
else if (typeInfo.IsType<int>() || typeInfo.IsType<uint>())
|
||||
{
|
||||
return IVariable::INT;
|
||||
}
|
||||
else if (typeInfo.IsType<float>())
|
||||
{
|
||||
return IVariable::FLOAT;
|
||||
}
|
||||
return IVariable::STRING;
|
||||
}
|
||||
|
||||
CVariableTypeInfo::CVariableTypeInfo(CTypeInfo::CVarInfo const& VarInfo,
|
||||
void* pAddress, const void* pAddressDefault, EType eType)
|
||||
: m_pVarInfo(&VarInfo)
|
||||
, m_pData(pAddress)
|
||||
, m_pDefaultData(pAddressDefault)
|
||||
{
|
||||
SetName(SpacedName(VarInfo.GetName()));
|
||||
SetTypes(VarInfo.Type, eType);
|
||||
SetFlags(IVariable::UI_UNSORTED | IVariable::UI_HIGHLIGHT_EDITED);
|
||||
SetDescription(VarInfo.GetComment());
|
||||
}
|
||||
|
||||
void CVariableTypeInfo::SetTypes(CTypeInfo const& TypeInfo, EType eType)
|
||||
{
|
||||
m_pTypeInfo = &TypeInfo;
|
||||
m_eType = eType;
|
||||
|
||||
SetDataType(DT_SIMPLE);
|
||||
if (m_eType == VECTOR)
|
||||
{
|
||||
if (m_name == "Color")
|
||||
{
|
||||
SetDataType(DT_COLOR);
|
||||
}
|
||||
}
|
||||
else if (m_eType == STRING)
|
||||
{
|
||||
if (m_name == "Texture" || m_name == "Glow Map" || m_name == "Normal Map" || m_name == "Trail Fading")
|
||||
{
|
||||
SetDataType(DT_TEXTURE);
|
||||
}
|
||||
else if (m_name == "Geometry")
|
||||
{
|
||||
SetDataType(DT_OBJECT);
|
||||
}
|
||||
else if (m_name == "Start Trigger" || m_name == "Stop Trigger")
|
||||
{
|
||||
SetDataType(DT_AUDIO_TRIGGER);
|
||||
}
|
||||
else if (m_name == "GeomCache")
|
||||
{
|
||||
SetDataType(DT_GEOM_CACHE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// IVariable implementation.
|
||||
CVariableTypeInfo::EType CVariableTypeInfo::GetType() const
|
||||
{
|
||||
return m_eType;
|
||||
}
|
||||
|
||||
int CVariableTypeInfo::GetSize() const
|
||||
{
|
||||
return m_pTypeInfo->Size;
|
||||
}
|
||||
|
||||
void CVariableTypeInfo::GetLimits(float& fMin, float& fMax, float& fStep, bool& bHardMin, bool& bHardMax)
|
||||
{
|
||||
// Get hard limits from variable type, or vector element type.
|
||||
const CTypeInfo* pLimitType = m_pTypeInfo;
|
||||
if ((m_eType == VECTOR || m_eType == VECTOR2) && m_pTypeInfo->NextSubVar(0))
|
||||
{
|
||||
pLimitType = &m_pTypeInfo->NextSubVar(0)->Type;
|
||||
}
|
||||
bHardMin = pLimitType->GetLimit(eLimit_Min, fMin);
|
||||
bHardMax = pLimitType->GetLimit(eLimit_Max, fMax);
|
||||
pLimitType->GetLimit(eLimit_Step, fStep);
|
||||
|
||||
// Check var attrs for additional limits.
|
||||
if (m_pVarInfo->GetAttr("SoftMin", fMin))
|
||||
{
|
||||
bHardMin = false;
|
||||
}
|
||||
else if (m_pVarInfo->GetAttr("Min", fMin))
|
||||
{
|
||||
bHardMin = true;
|
||||
}
|
||||
|
||||
if (m_pVarInfo->GetAttr("SoftMax", fMax))
|
||||
{
|
||||
bHardMax = false;
|
||||
}
|
||||
else if (m_pVarInfo->GetAttr("Max", fMax))
|
||||
{
|
||||
bHardMax = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CVariableTypeInfo::Set(const char* value)
|
||||
{
|
||||
m_pTypeInfo->FromString(m_pData, value);
|
||||
OnSetValue(false);
|
||||
}
|
||||
|
||||
void CVariableTypeInfo::Set(const QString& value)
|
||||
{
|
||||
Set(value.toUtf8().data());
|
||||
}
|
||||
|
||||
void CVariableTypeInfo::Set(float value)
|
||||
{
|
||||
m_pTypeInfo->FromValue(m_pData, value);
|
||||
OnSetValue(false);
|
||||
}
|
||||
|
||||
void CVariableTypeInfo::Set(int value)
|
||||
{
|
||||
m_pTypeInfo->FromValue(m_pData, value);
|
||||
OnSetValue(false);
|
||||
}
|
||||
|
||||
void CVariableTypeInfo::Set(bool value)
|
||||
{
|
||||
m_pTypeInfo->FromValue(m_pData, value);
|
||||
OnSetValue(false);
|
||||
}
|
||||
|
||||
void CVariableTypeInfo::Set(const Vec2& value)
|
||||
{
|
||||
m_pTypeInfo->FromValue(m_pData, value);
|
||||
OnSetValue(false);
|
||||
}
|
||||
|
||||
void CVariableTypeInfo::Set(const Vec3& value)
|
||||
{
|
||||
m_pTypeInfo->FromValue(m_pData, value);
|
||||
OnSetValue(false);
|
||||
}
|
||||
|
||||
void CVariableTypeInfo::Get(QString& value) const
|
||||
{
|
||||
value = (const char*)m_pTypeInfo->ToString(m_pData);
|
||||
}
|
||||
|
||||
void CVariableTypeInfo::Get(float& value) const
|
||||
{
|
||||
m_pTypeInfo->ToValue(m_pData, value);
|
||||
}
|
||||
|
||||
void CVariableTypeInfo::Get(int& value) const
|
||||
{
|
||||
m_pTypeInfo->ToValue(m_pData, value);
|
||||
}
|
||||
|
||||
void CVariableTypeInfo::Get(bool& value) const
|
||||
{
|
||||
m_pTypeInfo->ToValue(m_pData, value);
|
||||
}
|
||||
|
||||
void CVariableTypeInfo::Get(Vec2& value) const
|
||||
{
|
||||
m_pTypeInfo->ToValue(m_pData, value);
|
||||
}
|
||||
|
||||
void CVariableTypeInfo::Get(Vec3& value) const
|
||||
{
|
||||
m_pTypeInfo->ToValue(m_pData, value);
|
||||
}
|
||||
|
||||
bool CVariableTypeInfo::HasDefaultValue() const
|
||||
{
|
||||
return m_pTypeInfo->ValueEqual(m_pData, m_pDefaultData);
|
||||
}
|
||||
|
||||
void CVariableTypeInfo::ResetToDefault()
|
||||
{
|
||||
QString strVal = m_pTypeInfo->ToString(m_pDefaultData).c_str();
|
||||
Set(strVal);
|
||||
}
|
||||
|
||||
IVariable* CVariableTypeInfo::Clone([[maybe_unused]] bool bRecursive) const
|
||||
{
|
||||
// Simply use a string var for universal conversion.
|
||||
IVariable* pClone = new CVariable<QString>();
|
||||
QString str;
|
||||
Get(str);
|
||||
pClone->Set(str);
|
||||
|
||||
//add extra information for the clone: Name, DataType
|
||||
pClone->SetName(GetName());
|
||||
pClone->SetDataType(GetDataType());
|
||||
//use UserData to save eType since String Variable's GetType always return STRING
|
||||
pClone->SetUserData(GetType());
|
||||
|
||||
return pClone;
|
||||
}
|
||||
|
||||
void CVariableTypeInfo::CopyValue(IVariable* fromVar)
|
||||
{
|
||||
assert(fromVar);
|
||||
QString str;
|
||||
fromVar->Get(str);
|
||||
Set(str);
|
||||
}
|
||||
|
||||
CVariableTypeInfoEnum::CTypeInfoEnumList::CTypeInfoEnumList(CTypeInfo const& info)
|
||||
: TypeInfo(info)
|
||||
{
|
||||
}
|
||||
|
||||
QString CVariableTypeInfoEnum::CTypeInfoEnumList::GetItemName(uint index)
|
||||
{
|
||||
return TypeInfo.EnumElem(index);
|
||||
}
|
||||
|
||||
CVariableTypeInfoEnum::CVariableTypeInfoEnum(CTypeInfo::CVarInfo const& VarInfo,
|
||||
void* pAddress, const void* pAddressDefault, IVarEnumList* pEnumList)
|
||||
: CVariableTypeInfo(VarInfo, pAddress, pAddressDefault, UNKNOWN)
|
||||
{
|
||||
// Use custom enum, or enum defined in TypeInfo.
|
||||
m_enumList = pEnumList ? pEnumList : new CTypeInfoEnumList(VarInfo.Type);
|
||||
}
|
||||
|
||||
IVarEnumList* CVariableTypeInfoEnum::GetEnumList() const
|
||||
{
|
||||
return m_enumList;
|
||||
}
|
||||
|
||||
CVariableTypeInfoSpline::CVariableTypeInfoSpline(CTypeInfo::CVarInfo const& VarInfo,
|
||||
void* pAddress, const void* pAddressDefault, ISplineInterpolator* pSpline)
|
||||
: CVariableTypeInfo(VarInfo, pAddress, pAddressDefault, STRING)
|
||||
, m_pSpline(pSpline)
|
||||
{
|
||||
if (m_pSpline && m_pSpline->GetNumDimensions() == 3)
|
||||
{
|
||||
SetDataType(DT_CURVE | DT_COLOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetDataType(DT_CURVE | DT_PERCENT);
|
||||
}
|
||||
}
|
||||
|
||||
CVariableTypeInfoSpline::~CVariableTypeInfoSpline()
|
||||
{
|
||||
delete m_pSpline;
|
||||
}
|
||||
|
||||
ISplineInterpolator* CVariableTypeInfoSpline::GetSpline()
|
||||
{
|
||||
//if m_pSpline wasn't created or the data used to create spline was changed, we need create the m_pSpline
|
||||
int flags = GetFlags();
|
||||
if (m_pSpline == nullptr || flags & UI_CREATE_SPLINE)
|
||||
{
|
||||
if (m_pSpline != nullptr)
|
||||
{
|
||||
delete m_pSpline;
|
||||
m_pSpline = nullptr;
|
||||
}
|
||||
m_pTypeInfo->ToValue(m_pData, m_pSpline);
|
||||
flags &= ~UI_CREATE_SPLINE;
|
||||
SetFlags(flags);
|
||||
}
|
||||
return m_pSpline;
|
||||
}
|
||||
|
||||
void CVariableTypeInfoSpline::OnSetValue(bool bRecursive)
|
||||
{
|
||||
m_pTypeInfo->ToValue(m_pData, m_pSpline);
|
||||
CVariableTypeInfo::OnSetValue(bRecursive);
|
||||
}
|
||||
|
||||
CVariableTypeInfoStruct::CVariableTypeInfoStruct(CTypeInfo::CVarInfo const& VarInfo,
|
||||
void* pAddress, const void* pAddressDefault)
|
||||
: CVariableTypeInfo(VarInfo, pAddress, pAddressDefault, ARRAY)
|
||||
{
|
||||
ProcessSubStruct(VarInfo, pAddress, pAddressDefault);
|
||||
}
|
||||
|
||||
void CVariableTypeInfoStruct::ProcessSubStruct(CTypeInfo::CVarInfo const& VarInfo, void* pAddress, const void* pAddressDefault)
|
||||
{
|
||||
for AllSubVars(pSubVar, VarInfo.Type)
|
||||
{
|
||||
if (!*pSubVar->GetName())
|
||||
{
|
||||
EType eType = GetType(pSubVar->Type);
|
||||
if (eType == ARRAY)
|
||||
{
|
||||
// Recursively process nameless or base struct.
|
||||
ProcessSubStruct(*pSubVar, pSubVar->GetAddress(pAddress), pSubVar->GetAddress(pAddressDefault));
|
||||
}
|
||||
else if (pSubVar == VarInfo.Type.NextSubVar(0))
|
||||
{
|
||||
// Inline edit first sub-var in main field.
|
||||
SetTypes(pSubVar->Type, eType);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IVariable* pVar = CVariableTypeInfo::Create(*pSubVar, pAddress, pAddressDefault);
|
||||
m_Vars.push_back(pVar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString CVariableTypeInfoStruct::GetDisplayValue() const
|
||||
{
|
||||
return (const char*)m_pTypeInfo->ToString(m_pData);
|
||||
}
|
||||
|
||||
void CVariableTypeInfoStruct::OnSetValue(bool bRecursive)
|
||||
{
|
||||
CVariableBase::OnSetValue(bRecursive);
|
||||
if (bRecursive)
|
||||
{
|
||||
for (Vars::iterator it = m_Vars.begin(); it != m_Vars.end(); ++it)
|
||||
{
|
||||
(*it)->OnSetValue(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CVariableTypeInfoStruct::SetFlagRecursive(EFlags flag)
|
||||
{
|
||||
CVariableBase::SetFlagRecursive(flag);
|
||||
for (Vars::iterator it = m_Vars.begin(); it != m_Vars.end(); ++it)
|
||||
{
|
||||
(*it)->SetFlagRecursive(flag);
|
||||
}
|
||||
}
|
||||
|
||||
void CVariableTypeInfoStruct::CopyValue(IVariable* fromVar)
|
||||
{
|
||||
assert(fromVar);
|
||||
if (fromVar->GetType() != IVariable::ARRAY)
|
||||
{
|
||||
CVariableTypeInfo::CopyValue(fromVar);
|
||||
}
|
||||
|
||||
int numSrc = fromVar->GetNumVariables();
|
||||
int numTrg = m_Vars.size();
|
||||
for (int i = 0; i < numSrc && i < numTrg; i++)
|
||||
{
|
||||
// Copy Every child variable.
|
||||
m_Vars[i]->CopyValue(fromVar->GetVariable(i));
|
||||
}
|
||||
}
|
||||
|
||||
int CVariableTypeInfoStruct::GetNumVariables() const
|
||||
{
|
||||
return m_Vars.size();
|
||||
}
|
||||
|
||||
IVariable* CVariableTypeInfoStruct::GetVariable(int index) const
|
||||
{
|
||||
return m_Vars[index];
|
||||
}
|
||||
|
||||
CUIEnumsDBList::CUIEnumsDBList(CUIEnumsDatabase_SEnum const* pEnumList)
|
||||
: m_pEnumList(pEnumList)
|
||||
{
|
||||
}
|
||||
|
||||
QString CUIEnumsDBList::GetItemName(uint index)
|
||||
{
|
||||
if (index >= m_pEnumList->strings.size())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return m_pEnumList->strings[index];
|
||||
}
|
||||
@@ -1,221 +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_UTIL_VARIABLETYPEINFO_H
|
||||
#define CRYINCLUDE_EDITOR_UTIL_VARIABLETYPEINFO_H
|
||||
#pragma once
|
||||
|
||||
#include "Variable.h"
|
||||
#include "UIEnumsDatabase.h"
|
||||
#include "VariableTypeInfo.h"
|
||||
|
||||
#include <CryTypeInfo.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Adaptors for TypeInfo-defined variables to IVariable
|
||||
|
||||
inline QString SpacedName(const char* sName)
|
||||
{
|
||||
// Split name with spaces.
|
||||
QString sSpacedName = sName;
|
||||
for (int i = 1; i < sSpacedName.length(); i++)
|
||||
{
|
||||
if (sSpacedName[i].isUpper() && sSpacedName[i - 1].isLower())
|
||||
{
|
||||
sSpacedName.insert(i, ' ');
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return sSpacedName;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Scalar variable
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class EDITOR_CORE_API CVariableTypeInfo
|
||||
: public CVariableBase
|
||||
{
|
||||
public:
|
||||
// Dynamic constructor function
|
||||
static IVariable* Create(CTypeInfo::CVarInfo const& VarInfo, void* pBaseAddress, const void* pBaseAddressDefault);
|
||||
|
||||
static EType GetType(CTypeInfo const& TypeInfo);
|
||||
|
||||
CVariableTypeInfo(CTypeInfo::CVarInfo const& VarInfo, void* pAddress, const void* pAddressDefault, EType eType);
|
||||
|
||||
void SetTypes(CTypeInfo const& TypeInfo, EType eType);
|
||||
|
||||
// IVariable implementation.
|
||||
virtual EType GetType() const;
|
||||
virtual int GetSize() const;
|
||||
|
||||
virtual void GetLimits(float& fMin, float& fMax, float& fStep, bool& bHardMin, bool& bHardMax);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Access operators.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual void Set(const char* value);
|
||||
|
||||
virtual void Set(const QString& value);
|
||||
|
||||
virtual void Set(float value);
|
||||
|
||||
virtual void Set(int value);
|
||||
|
||||
virtual void Set(bool value);
|
||||
|
||||
virtual void Set(const Vec2& value);
|
||||
|
||||
virtual void Set(const Vec3& value);
|
||||
|
||||
virtual void Get(QString& value) const;
|
||||
|
||||
virtual void Get(float& value) const;
|
||||
|
||||
virtual void Get(int& value) const;
|
||||
|
||||
virtual void Get(bool& value) const;
|
||||
|
||||
virtual void Get(Vec2& value) const;
|
||||
|
||||
virtual void Get(Vec3& value) const;
|
||||
|
||||
virtual bool HasDefaultValue() const;
|
||||
|
||||
virtual void ResetToDefault();
|
||||
|
||||
virtual IVariable* Clone(bool bRecursive) const;
|
||||
|
||||
// To do: This could be more efficient ?
|
||||
virtual void CopyValue(IVariable* fromVar);
|
||||
|
||||
protected:
|
||||
CTypeInfo::CVarInfo const* m_pVarInfo;
|
||||
CTypeInfo const* m_pTypeInfo; // TypeInfo system structure for this var.
|
||||
void* m_pData; // Existing address in memory. Directly modified.
|
||||
const void* m_pDefaultData; // Address of default data for this var.
|
||||
EType m_eType; // Type info for editor.
|
||||
IEditor* m_pEditor;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Enum variable
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class EDITOR_CORE_API CVariableTypeInfoEnum
|
||||
: public CVariableTypeInfo
|
||||
{
|
||||
struct CTypeInfoEnumList
|
||||
: IVarEnumList
|
||||
{
|
||||
CTypeInfo const& TypeInfo;
|
||||
|
||||
CTypeInfoEnumList(CTypeInfo const& info);
|
||||
|
||||
virtual QString GetItemName(uint index);
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
// Constructor.
|
||||
CVariableTypeInfoEnum(CTypeInfo::CVarInfo const& VarInfo, void* pAddress, const void* pAddressDefault, IVarEnumList* pEnumList = 0);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Additional IVariable implementation.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
IVarEnumList* GetEnumList() const;
|
||||
|
||||
protected:
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
TSmartPtr<IVarEnumList> m_enumList;
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Spline variable
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class EDITOR_CORE_API CVariableTypeInfoSpline
|
||||
: public CVariableTypeInfo
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructor.
|
||||
CVariableTypeInfoSpline(CTypeInfo::CVarInfo const& VarInfo, void* pAddress, const void* pAddressDefault, ISplineInterpolator* pSpline);
|
||||
|
||||
~CVariableTypeInfoSpline();
|
||||
|
||||
virtual ISplineInterpolator* GetSpline();
|
||||
|
||||
//! Overrides CVariableTypeInfo to keep m_pSpline in sync with CVariableTypeInfo::m_pData
|
||||
//! when Set(value) functions are called
|
||||
void OnSetValue(bool bRecursive) override;
|
||||
|
||||
private:
|
||||
ISplineInterpolator* m_pSpline;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Struct variable
|
||||
// Inherits implementation from CVariableArray
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class EDITOR_CORE_API CVariableTypeInfoStruct
|
||||
: public CVariableTypeInfo
|
||||
{
|
||||
public:
|
||||
// Constructor.
|
||||
CVariableTypeInfoStruct(CTypeInfo::CVarInfo const& VarInfo, void* pAddress, const void* pAddressDefault);
|
||||
|
||||
void ProcessSubStruct(CTypeInfo::CVarInfo const& VarInfo, void* pAddress, const void* pAddressDefault);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// IVariable implementation.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual QString GetDisplayValue() const;
|
||||
|
||||
virtual void OnSetValue(bool bRecursive);
|
||||
|
||||
void SetFlagRecursive(EFlags flag) override;
|
||||
|
||||
void CopyValue(IVariable* fromVar);
|
||||
|
||||
int GetNumVariables() const;
|
||||
|
||||
IVariable* GetVariable(int index) const;
|
||||
|
||||
protected:
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
typedef std::vector<IVariablePtr> Vars;
|
||||
Vars m_Vars;
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
};
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
struct EDITOR_CORE_API CUIEnumsDBList
|
||||
: IVarEnumList
|
||||
{
|
||||
AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
CUIEnumsDatabase_SEnum const* m_pEnumList;
|
||||
|
||||
CUIEnumsDBList(CUIEnumsDatabase_SEnum const* pEnumList);
|
||||
|
||||
virtual QString GetItemName(uint index);
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_UTIL_VARIABLETYPEINFO_H
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "EditorViewportWidget.h"
|
||||
#include "CryEditDoc.h"
|
||||
|
||||
#include <AzFramework/API/AtomActiveInterface.h>
|
||||
#include <AzCore/Console/IConsole.h>
|
||||
|
||||
AZ_CVAR(bool, ed_useAtomNativeViewport, true, nullptr, AZ::ConsoleFunctorFlags::Null, "Use the new Atom-native Editor viewport (experimental, not yet stable");
|
||||
@@ -42,7 +41,7 @@ AZ_CVAR(bool, ed_useAtomNativeViewport, true, nullptr, AZ::ConsoleFunctorFlags::
|
||||
bool CViewManager::IsMultiViewportEnabled()
|
||||
{
|
||||
// Enable multi-viewport for legacy renderer, or if we're using the new fully Atom-native viewport
|
||||
return !AZ::Interface<AzFramework::AtomActiveInterface>::Get() || ed_useAtomNativeViewport;
|
||||
return ed_useAtomNativeViewport;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
@@ -81,7 +80,7 @@ CViewManager::CViewManager()
|
||||
RegisterQtViewPane<C2DViewport_YZ>(GetIEditor(), "Left", LyViewPane::CategoryViewport, viewportOptions);
|
||||
|
||||
viewportOptions.viewportType = ET_ViewportCamera;
|
||||
if (ed_useAtomNativeViewport && AZ::Interface<AzFramework::AtomActiveInterface>::Get())
|
||||
if (ed_useAtomNativeViewport)
|
||||
{
|
||||
RegisterQtViewPaneWithName<EditorViewportWidget>(GetIEditor(), "Perspective", LyViewPane::CategoryViewport, viewportOptions);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
|
||||
// AzFramework
|
||||
#include <AzFramework/StringFunc/StringFunc.h>
|
||||
#include <AzFramework/API/AtomActiveInterface.h>
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
|
||||
// Editor
|
||||
|
||||
@@ -27,8 +27,8 @@ static const auto InteractionPriority = AzFramework::ViewportControllerPriority:
|
||||
namespace SandboxEditor
|
||||
{
|
||||
|
||||
ViewportManipulatorControllerInstance::ViewportManipulatorControllerInstance(AzFramework::ViewportId viewport)
|
||||
: AzFramework::MultiViewportControllerInstanceInterface(viewport)
|
||||
ViewportManipulatorControllerInstance::ViewportManipulatorControllerInstance(AzFramework::ViewportId viewport, ViewportManipulatorController* controller)
|
||||
: AzFramework::MultiViewportControllerInstanceInterface<ViewportManipulatorController>(viewport, controller)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -112,8 +112,7 @@ bool ViewportManipulatorControllerInstance::HandleInputChannelEvent(const AzFram
|
||||
m_state.m_mousePick.m_screenCoordinates = screenPosition;
|
||||
AZStd::optional<ProjectedViewportRay> ray;
|
||||
ViewportInteractionRequestBus::EventResult(
|
||||
ray, GetViewportId(), &ViewportInteractionRequestBus::Events::ViewportScreenToWorldRay,
|
||||
QPoint(screenPosition.m_x, screenPosition.m_y));
|
||||
ray, GetViewportId(), &ViewportInteractionRequestBus::Events::ViewportScreenToWorldRay, screenPosition);
|
||||
|
||||
if (ray.has_value())
|
||||
{
|
||||
|
||||
@@ -19,11 +19,14 @@
|
||||
|
||||
namespace SandboxEditor
|
||||
{
|
||||
class ViewportManipulatorControllerInstance;
|
||||
using ViewportManipulatorController = AzFramework::MultiViewportController<ViewportManipulatorControllerInstance, AzFramework::ViewportControllerPriority::DispatchToAllPriorities>;
|
||||
|
||||
class ViewportManipulatorControllerInstance final
|
||||
: public AzFramework::MultiViewportControllerInstanceInterface
|
||||
: public AzFramework::MultiViewportControllerInstanceInterface<ViewportManipulatorController>
|
||||
{
|
||||
public:
|
||||
explicit ViewportManipulatorControllerInstance(AzFramework::ViewportId viewport);
|
||||
explicit ViewportManipulatorControllerInstance(AzFramework::ViewportId viewport, ViewportManipulatorController* controller);
|
||||
|
||||
bool HandleInputChannelEvent(const AzFramework::ViewportControllerInputEvent& event) override;
|
||||
void ResetInputChannels() override;
|
||||
@@ -40,6 +43,4 @@ namespace SandboxEditor
|
||||
AZStd::unordered_map<AzToolsFramework::ViewportInteraction::MouseButton, AZ::ScriptTimePoint> m_pendingDoubleClicks;
|
||||
AZ::ScriptTimePoint m_curTime;
|
||||
};
|
||||
|
||||
using ViewportManipulatorController = AzFramework::MultiViewportController<ViewportManipulatorControllerInstance, AzFramework::ViewportControllerPriority::DispatchToAllPriorities>;
|
||||
} //namespace SandboxEditor
|
||||
|
||||
@@ -54,13 +54,11 @@ set(FILES
|
||||
Util/MemoryBlock.cpp
|
||||
Util/Variable.cpp
|
||||
Util/UndoUtil.cpp
|
||||
Util/VariableTypeInfo.cpp
|
||||
Util/VariablePropertyType.cpp
|
||||
Clipboard.h
|
||||
Util/MemoryBlock.h
|
||||
Util/Variable.h
|
||||
Util/UndoUtil.h
|
||||
Util/VariableTypeInfo.h
|
||||
Util/VariablePropertyType.h
|
||||
Util/RefCountBase.h
|
||||
Util/PathUtil.h
|
||||
|
||||
@@ -323,11 +323,6 @@ set(FILES
|
||||
AzAssetBrowser/AzAssetBrowserWindow.cpp
|
||||
AzAssetBrowser/AzAssetBrowserWindow.h
|
||||
AzAssetBrowser/AzAssetBrowserWindow.ui
|
||||
AzAssetBrowser/Preview/LegacyPreviewer.cpp
|
||||
AzAssetBrowser/Preview/LegacyPreviewer.h
|
||||
AzAssetBrowser/Preview/LegacyPreviewer.ui
|
||||
AzAssetBrowser/Preview/LegacyPreviewerFactory.cpp
|
||||
AzAssetBrowser/Preview/LegacyPreviewerFactory.h
|
||||
AssetDatabase/AssetDatabaseLocationListener.h
|
||||
AssetDatabase/AssetDatabaseLocationListener.cpp
|
||||
AssetImporter/AssetImporterManager/AssetImporterDragAndDropHandler.cpp
|
||||
@@ -376,8 +371,7 @@ set(FILES
|
||||
Controls/MultiMonHelper.h
|
||||
Controls/NumberCtrl.cpp
|
||||
Controls/NumberCtrl.h
|
||||
Controls/PreviewModelCtrl.cpp
|
||||
Controls/PreviewModelCtrl.h
|
||||
Controls/NumberCtrl.h
|
||||
Controls/SplineCtrl.cpp
|
||||
Controls/SplineCtrl.h
|
||||
Controls/SplineCtrlEx.cpp
|
||||
@@ -386,8 +380,6 @@ set(FILES
|
||||
Controls/TextEditorCtrl.h
|
||||
Controls/TimelineCtrl.cpp
|
||||
Controls/TimelineCtrl.h
|
||||
Controls/TimeOfDaySlider.cpp
|
||||
Controls/TimeOfDaySlider.h
|
||||
Controls/WndGridHelper.h
|
||||
Controls/ReflectedPropertyControl/PropertyAnimationCtrl.cpp
|
||||
Controls/ReflectedPropertyControl/PropertyAnimationCtrl.h
|
||||
@@ -460,8 +452,6 @@ set(FILES
|
||||
LevelFileDialog.qrc
|
||||
LevelFileDialog.h
|
||||
LevelFileDialog.ui
|
||||
PanelPreview.cpp
|
||||
PanelPreview.h
|
||||
QuickAccessBar.cpp
|
||||
QuickAccessBar.h
|
||||
QuickAccessBar.ui
|
||||
@@ -495,10 +485,6 @@ set(FILES
|
||||
IconListDialog.ui
|
||||
UndoDropDown.cpp
|
||||
UndoDropDown.h
|
||||
TimeOfDayDialog.cpp
|
||||
TimeOfDayDialog.h
|
||||
TimeOfDayDialog.ui
|
||||
TimeOfDay.qrc
|
||||
DimensionsDialog.cpp
|
||||
DimensionsDialog.h
|
||||
DimensionsDialog.ui
|
||||
@@ -528,11 +514,7 @@ set(FILES
|
||||
GameResourcesExporter.cpp
|
||||
GameExporter.h
|
||||
GameResourcesExporter.h
|
||||
Geometry/EdGeometry.cpp
|
||||
Geometry/EdMesh.cpp
|
||||
Geometry/TriMesh.cpp
|
||||
Geometry/EdGeometry.h
|
||||
Geometry/EdMesh.h
|
||||
Geometry/TriMesh.h
|
||||
AboutDialog.h
|
||||
AboutDialog.ui
|
||||
@@ -560,8 +542,6 @@ set(FILES
|
||||
LevelIndependentFileMan.h
|
||||
LogFileImpl.cpp
|
||||
LogFileImpl.h
|
||||
Mission.cpp
|
||||
Mission.h
|
||||
Objects/ClassDesc.cpp
|
||||
Objects/ClassDesc.h
|
||||
Objects/IEntityObjectListener.h
|
||||
@@ -654,8 +634,6 @@ set(FILES
|
||||
LightmapCompiler/SimpleTriangleRasterizer.cpp
|
||||
ResourceSelectorHost.cpp
|
||||
ResourceSelectorHost.h
|
||||
ThumbnailGenerator.cpp
|
||||
ThumbnailGenerator.h
|
||||
ToolBox.cpp
|
||||
TrackViewNewSequenceDialog.cpp
|
||||
TrackViewNewSequenceDialog.ui
|
||||
@@ -687,9 +665,6 @@ set(FILES
|
||||
ShaderEnum.h
|
||||
SurfaceTypeValidator.cpp
|
||||
SurfaceTypeValidator.h
|
||||
EnvironmentPanel.cpp
|
||||
EnvironmentPanel.h
|
||||
EnvironmentPanel.ui
|
||||
TrackView/AtomOutputFrameCapture.cpp
|
||||
TrackView/AtomOutputFrameCapture.h
|
||||
TrackView/TrackViewDialog.qrc
|
||||
@@ -881,9 +856,6 @@ set(FILES
|
||||
Grid.h
|
||||
LayoutWnd.cpp
|
||||
LayoutWnd.h
|
||||
ModelViewport.cpp
|
||||
ModelViewport.h
|
||||
ModelViewportDC.cpp
|
||||
EditorViewportWidget.cpp
|
||||
EditorViewportWidget.h
|
||||
ViewportManipulatorController.cpp
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
add_subdirectory(EditorCommon)
|
||||
add_subdirectory(ComponentEntityEditorPlugin)
|
||||
add_subdirectory(FBXPlugin)
|
||||
add_subdirectory(FFMPEGPlugin)
|
||||
add_subdirectory(ProjectSettingsTool)
|
||||
add_subdirectory(PerforcePlugin)
|
||||
|
||||
@@ -905,7 +905,7 @@ void CComponentEntityObject::Display(DisplayContext& dc)
|
||||
|
||||
AzFramework::DebugDisplayRequestBus::BusPtr debugDisplayBus;
|
||||
AzFramework::DebugDisplayRequestBus::Bind(
|
||||
debugDisplayBus, AzToolsFramework::ViewportInteraction::g_mainViewportEntityDebugDisplayId);
|
||||
debugDisplayBus, AzFramework::g_defaultSceneEntityDebugDisplayId);
|
||||
AZ_Assert(debugDisplayBus, "Invalid DebugDisplayRequestBus.");
|
||||
|
||||
AzFramework::DebugDisplayRequests* debugDisplay =
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <AzFramework/Entity/EntityContextBus.h>
|
||||
#include <AzFramework/Physics/Material.h>
|
||||
#include <AzFramework/StringFunc/StringFunc.h>
|
||||
#include <AzFramework/API/AtomActiveInterface.h>
|
||||
#include <AzToolsFramework/API/EditorAssetSystemAPI.h>
|
||||
#include <AzToolsFramework/API/EntityCompositionRequestBus.h>
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
@@ -162,13 +161,6 @@ void SandboxIntegrationManager::Setup()
|
||||
AzToolsFramework::EditorEvents::Bus::Handler::BusConnect();
|
||||
AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusConnect();
|
||||
AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler::BusConnect();
|
||||
// turn on the this debug display request bus implementation if no other implementation is active
|
||||
if( !(AZ::Interface<AzFramework::AtomActiveInterface>::Get() && AzFramework::DebugDisplayRequestBus::HasHandlers()))
|
||||
{
|
||||
m_debugDisplayBusImplementationActive = true;
|
||||
AzFramework::DebugDisplayRequestBus::Handler::BusConnect(
|
||||
AzToolsFramework::ViewportInteraction::g_mainViewportEntityDebugDisplayId);
|
||||
}
|
||||
|
||||
AzFramework::DisplayContextRequestBus::Handler::BusConnect();
|
||||
SetupFileExtensionMap();
|
||||
@@ -302,12 +294,15 @@ void SandboxIntegrationManager::OnCatalogAssetAdded(const AZ::Data::AssetId& ass
|
||||
// operation writing to shared resource is queued on main thread.
|
||||
void SandboxIntegrationManager::OnCatalogAssetRemoved(const AZ::Data::AssetId& assetId, const AZ::Data::AssetInfo& assetInfo)
|
||||
{
|
||||
bool isPrefabSystemEnabled = false;
|
||||
AzFramework::ApplicationRequests::Bus::BroadcastResult(isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
|
||||
|
||||
// Check to see if the removed slice asset has any instance in the level, then check if
|
||||
// those dangling instances are directly under the root slice (not sub-slices). If yes,
|
||||
// detach them and save necessary information so they can be restored when their slice asset
|
||||
// comes back.
|
||||
|
||||
if (assetInfo.m_assetType == AZ::AzTypeInfo<AZ::SliceAsset>::Uuid())
|
||||
if (!isPrefabSystemEnabled && assetInfo.m_assetType == AZ::AzTypeInfo<AZ::SliceAsset>::Uuid())
|
||||
{
|
||||
AZ::SliceComponent* rootSlice = nullptr;
|
||||
AzToolsFramework::SliceEditorEntityOwnershipServiceRequestBus::BroadcastResult(rootSlice,
|
||||
|
||||
@@ -1473,14 +1473,15 @@ void OutlinerListModel::OnEntityInfoUpdatedRemoveChildBegin(AZ::EntityId parentI
|
||||
emit EnableSelectionUpdates(false);
|
||||
auto parentIndex = GetIndexFromEntity(parentId);
|
||||
auto childIndex = GetIndexFromEntity(childId);
|
||||
beginRemoveRows(parentIndex, childIndex.row(), childIndex.row());
|
||||
beginResetModel();
|
||||
}
|
||||
|
||||
void OutlinerListModel::OnEntityInfoUpdatedRemoveChildEnd(AZ::EntityId parentId, AZ::EntityId childId)
|
||||
{
|
||||
(void)childId;
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
endRemoveRows();
|
||||
|
||||
endResetModel();
|
||||
|
||||
//must refresh partial lock/visibility of parents
|
||||
m_isFilterDirty = true;
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <IPhysics.h>
|
||||
#include <IPhysicsDebugRenderer.h>
|
||||
#include <IStatObj.h>
|
||||
#include <I3DEngine.h>
|
||||
|
||||
#include "../EditorCommon/QViewport.h"
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <IRenderer.h>
|
||||
#include <IRenderAuxGeom.h>
|
||||
#include <ITimer.h>
|
||||
#include <I3DEngine.h>
|
||||
#include <IPhysicsDebugRenderer.h>
|
||||
#include <IEditor.h>
|
||||
#include <Util/Image.h>
|
||||
@@ -37,8 +36,6 @@
|
||||
#include <AzCore/Jobs/JobManager.h>
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
|
||||
#include <AzFramework/API/AtomActiveInterface.h>
|
||||
|
||||
#include <AzQtComponents/Utilities/QtWindowUtilities.h>
|
||||
|
||||
// Class to implement the WindowRequestBus::Handler instead of the QViewport class.
|
||||
@@ -110,114 +107,6 @@ struct QViewport::SPreviousContext
|
||||
bool isMainViewport;
|
||||
};
|
||||
|
||||
static void DrawGridLine(IRenderAuxGeom& aux, ColorB col, const float alpha, const float alphaFalloff, const float slide, const float halfSlide, [[maybe_unused]] const float maxSlide, const Vec3& stepDir, const Vec3& orthoDir, const SViewportState& state, const SViewportGridSettings& gridSettings)
|
||||
{
|
||||
ColorB colEnd = col;
|
||||
|
||||
float weight = 1.0f - (slide / halfSlide);
|
||||
if (slide > halfSlide)
|
||||
{
|
||||
weight = (slide - halfSlide) / halfSlide;
|
||||
}
|
||||
|
||||
float orthoWeight = 1.0f;
|
||||
|
||||
if (gridSettings.circular)
|
||||
{
|
||||
float invWeight = 1.0f - weight;
|
||||
orthoWeight = sqrtf((invWeight * 2) - (invWeight * invWeight));
|
||||
}
|
||||
else
|
||||
{
|
||||
orthoWeight = 1.0f;
|
||||
}
|
||||
|
||||
col.a = aznumeric_cast<uint8_t>((1.0f - (weight * (1.0f - alphaFalloff))) * alpha);
|
||||
colEnd.a = aznumeric_cast<uint8_t>(alphaFalloff * alpha);
|
||||
|
||||
Vec3 orthoStep = state.gridOrigin.q * (orthoDir * halfSlide * orthoWeight);
|
||||
|
||||
Vec3 point = state.gridOrigin * (-(stepDir * halfSlide) + (stepDir * slide));
|
||||
Vec3 points[3] = {
|
||||
point,
|
||||
point - orthoStep,
|
||||
point + orthoStep
|
||||
};
|
||||
|
||||
aux.DrawLine(points[0], col, points[1], colEnd);
|
||||
aux.DrawLine(points[0], col, points[2], colEnd);
|
||||
}
|
||||
|
||||
static void DrawGridLines(IRenderAuxGeom& aux, const uint count, const uint interStepCount, const Vec3& stepDir, const float stepSize, const Vec3& orthoDir, const float offset, const SViewportState& state, const SViewportGridSettings& gridSettings)
|
||||
{
|
||||
const uint countHalf = count / 2;
|
||||
Vec3 step = stepDir * stepSize;
|
||||
Vec3 orthoStep = orthoDir * aznumeric_cast<float>(countHalf);
|
||||
Vec3 maxStep = step * aznumeric_cast<float>(countHalf);// + stepDir*fabs(offset);
|
||||
const float maxStepLen = count * stepSize;
|
||||
const float halfStepLen = countHalf * stepSize;
|
||||
|
||||
float interStepSize = interStepCount > 0 ? (stepSize / interStepCount) : stepSize;
|
||||
const float alphaMulMain = (float)gridSettings.mainColor.a;
|
||||
const float alphaMulInter = (float)gridSettings.middleColor.a;
|
||||
const float alphaFalloff = 1.0f - (gridSettings.alphaFalloff / 100.0f);
|
||||
|
||||
for (int i = 0; i < count + 2; i++)
|
||||
{
|
||||
float pointSlide = i * stepSize + offset;
|
||||
if (pointSlide > 0.0f && pointSlide < maxStepLen)
|
||||
{
|
||||
DrawGridLine(aux, gridSettings.mainColor, alphaMulMain, alphaFalloff, pointSlide, halfStepLen, maxStepLen, stepDir, orthoDir, state, gridSettings);
|
||||
}
|
||||
|
||||
for (int d = 1; d < interStepCount; d++)
|
||||
{
|
||||
float interSlide = ((i - 1) * stepSize) + offset + (d * interStepSize);
|
||||
if (interSlide > 0.0f && interSlide < maxStepLen)
|
||||
{
|
||||
DrawGridLine(aux, gridSettings.middleColor, alphaMulInter, alphaFalloff, interSlide, halfStepLen, maxStepLen, stepDir, orthoDir, state, gridSettings);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void DrawGrid(IRenderAuxGeom& aux, const SViewportState& state, const SViewportGridSettings& gridSettings)
|
||||
{
|
||||
const uint count = gridSettings.count * 2;
|
||||
const float gridSize = gridSettings.spacing * gridSettings.count * 2.0f;
|
||||
const float halfGridSize = gridSettings.spacing * gridSettings.count;
|
||||
|
||||
const float stepSize = gridSize / count;
|
||||
DrawGridLines(aux, count, gridSettings.interCount, Vec3(1.0f, 0.0f, 0.0f), stepSize, Vec3(0.0f, 1.0f, 0.0f), state.gridCellOffset.x, state, gridSettings);
|
||||
DrawGridLines(aux, count, gridSettings.interCount, Vec3(0.0f, 1.0f, 0.0f), stepSize, Vec3(1.0f, 0.0f, 0.0f), state.gridCellOffset.y, state, gridSettings);
|
||||
}
|
||||
|
||||
static void DrawOrigin(IRenderAuxGeom& aux, const ColorB& col)
|
||||
{
|
||||
const float scale = 0.3f;
|
||||
const float lineWidth = 4.0f;
|
||||
aux.DrawLine(Vec3(-scale, 0, 0), col, Vec3(scale, 0, 0), col, lineWidth);
|
||||
aux.DrawLine(Vec3(0, -scale, 0), col, Vec3(0, scale, 0), col, lineWidth);
|
||||
aux.DrawLine(Vec3(0, 0, -scale), col, Vec3(0, 0, scale), col, lineWidth);
|
||||
}
|
||||
|
||||
static void DrawOrigin(IRenderAuxGeom& aux, const int left, const int top, const float scale, const Matrix34 cameraTM)
|
||||
{
|
||||
Vec3 originPos = Vec3(aznumeric_cast<float>(left), aznumeric_cast<float>(top), 0);
|
||||
Quat originRot = Quat(0.707107f, 0.707107f, 0, 0) * Quat(cameraTM).GetInverted();
|
||||
Vec3 x = originPos + originRot * Vec3(1, 0, 0) * scale;
|
||||
Vec3 y = originPos + originRot * Vec3(0, 1, 0) * scale;
|
||||
Vec3 z = originPos + originRot * Vec3(0, 0, 1) * scale;
|
||||
ColorF xCol(1, 0, 0);
|
||||
ColorF yCol(0, 1, 0);
|
||||
ColorF zCol(0, 0, 1);
|
||||
const float lineWidth = 2.0f;
|
||||
|
||||
aux.DrawLine(originPos, xCol, x, xCol, lineWidth);
|
||||
aux.DrawLine(originPos, yCol, y, yCol, lineWidth);
|
||||
aux.DrawLine(originPos, zCol, z, zCol, lineWidth);
|
||||
}
|
||||
|
||||
struct QViewport::SPrivate
|
||||
{
|
||||
CDLight m_VPLight0;
|
||||
@@ -365,7 +254,7 @@ bool QViewport::CreateRenderContext()
|
||||
|
||||
HWND windowHandle = reinterpret_cast<HWND>(QWidget::winId());
|
||||
|
||||
if( AZ::Interface<AzFramework::AtomActiveInterface>::Get() && m_renderContextCreated && windowHandle == m_lastHwnd)
|
||||
if( m_renderContextCreated && windowHandle == m_lastHwnd)
|
||||
{
|
||||
// the hwnd has not changed, no need to destroy and recreate context (and swap chain etc)
|
||||
return false;
|
||||
@@ -377,13 +266,10 @@ bool QViewport::CreateRenderContext()
|
||||
{
|
||||
m_renderContextCreated = true;
|
||||
|
||||
if (AZ::Interface<AzFramework::AtomActiveInterface>::Get())
|
||||
{
|
||||
m_viewportRequests.get()->BusConnect(windowHandle);
|
||||
AzFramework::WindowSystemNotificationBus::Broadcast(&AzFramework::WindowSystemNotificationBus::Handler::OnWindowCreated, windowHandle);
|
||||
m_viewportRequests.get()->BusConnect(windowHandle);
|
||||
AzFramework::WindowSystemNotificationBus::Broadcast(&AzFramework::WindowSystemNotificationBus::Handler::OnWindowCreated, windowHandle);
|
||||
|
||||
m_lastHwnd = windowHandle;
|
||||
}
|
||||
m_lastHwnd = windowHandle;
|
||||
|
||||
StorePreviousContext();
|
||||
GetIEditor()->GetEnv()->pRenderer->CreateContext(windowHandle);
|
||||
@@ -499,49 +385,6 @@ void QViewport::Update()
|
||||
{
|
||||
m_averageFrameTime = 0.01f * m_lastFrameTime + 0.99f * m_averageFrameTime;
|
||||
}
|
||||
|
||||
if (GetIEditor()->GetEnv()->pRenderer == 0 ||
|
||||
GetIEditor()->GetEnv()->p3DEngine == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isVisible())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_renderContextCreated)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_updating)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AutoBool updating(&m_updating);
|
||||
|
||||
if (m_resizeWindowEvent)
|
||||
{
|
||||
HWND windowHandle = reinterpret_cast<HWND>(QWidget::winId());
|
||||
AzFramework::WindowNotificationBus::Event(windowHandle, &AzFramework::WindowNotificationBus::Handler::OnWindowResized, m_width, m_height);
|
||||
m_resizeWindowEvent = false;
|
||||
}
|
||||
|
||||
if (hasFocus())
|
||||
{
|
||||
ProcessMouse();
|
||||
ProcessKeys();
|
||||
}
|
||||
|
||||
if ((m_width <= 0) || (m_height <= 0))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RenderInternal();
|
||||
}
|
||||
|
||||
void QViewport::CaptureMouse()
|
||||
@@ -865,210 +708,16 @@ void QViewport::PreRender()
|
||||
m_state->lastCameraParentFrame = m_state->cameraParentFrame;
|
||||
m_state->lastCameraTarget = currentTM;
|
||||
|
||||
m_camera->SetFrustum(m_width, m_height, fov, m_settings->camera.nearClip, GetIEditor()->GetEnv()->p3DEngine->GetMaxViewDistance());
|
||||
m_camera->SetFrustum(m_width, m_height, fov, m_settings->camera.nearClip);
|
||||
m_camera->SetMatrix(Matrix34(m_state->cameraParentFrame * currentTM));
|
||||
}
|
||||
|
||||
void QViewport::Render()
|
||||
{
|
||||
IRenderAuxGeom* aux = GetIEditor()->GetEnv()->pRenderer->GetIRenderAuxGeom();
|
||||
SAuxGeomRenderFlags oldFlags = aux->GetRenderFlags();
|
||||
|
||||
if (m_settings->grid.showGrid)
|
||||
{
|
||||
aux->SetRenderFlags(e_Mode3D | e_AlphaBlended | e_FillModeSolid | e_CullModeNone | e_DepthWriteOff | e_DepthTestOn);
|
||||
DrawGrid(*aux, *m_state, m_settings->grid);
|
||||
}
|
||||
|
||||
if (m_settings->grid.origin)
|
||||
{
|
||||
aux->SetRenderFlags(e_Mode3D | e_AlphaBlended | e_FillModeSolid | e_CullModeNone | e_DepthWriteOff | e_DepthTestOn);
|
||||
DrawOrigin(*aux, m_settings->grid.originColor);
|
||||
}
|
||||
|
||||
if (m_settings->camera.showViewportOrientation)
|
||||
{
|
||||
aux->SetRenderFlags(e_Mode3D | e_AlphaBlended | e_FillModeSolid | e_CullModeNone | e_DepthWriteOn | e_DepthTestOn);
|
||||
TransformationMatrices backupSceneMatrices;
|
||||
GetIEditor()->GetEnv()->pRenderer->Set2DMode(m_width, m_height, backupSceneMatrices);
|
||||
DrawOrigin(*aux, 50, m_height - 50, 20.0f, m_camera->GetMatrix());
|
||||
GetIEditor()->GetEnv()->pRenderer->Unset2DMode(backupSceneMatrices);
|
||||
}
|
||||
|
||||
// Force grid, origin and viewport orientation to render by calling Flush(). This ensures that they are always drawn behind other geometry
|
||||
aux->Flush();
|
||||
aux->SetRenderFlags(oldFlags);
|
||||
|
||||
// wireframe mode
|
||||
CScopedWireFrameMode scopedWireFrame(GetIEditor()->GetEnv()->pRenderer, m_settings->rendering.wireframe ? R_WIREFRAME_MODE : R_SOLID_MODE);
|
||||
|
||||
SRenderingPassInfo passInfo = SRenderingPassInfo::CreateGeneralPassRenderingInfo(*m_camera, SRenderingPassInfo::DEFAULT_FLAGS, true);
|
||||
GetIEditor()->GetEnv()->pRenderer->BeginSpawningGeneratingRendItemJobs(passInfo.ThreadID());
|
||||
GetIEditor()->GetEnv()->pRenderer->BeginSpawningShadowGeneratingRendItemJobs(passInfo.ThreadID());
|
||||
GetIEditor()->GetEnv()->pRenderer->EF_ClearSkinningDataPool();
|
||||
GetIEditor()->GetEnv()->pRenderer->EF_StartEf(passInfo);
|
||||
|
||||
SRendParams rp;
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
//---- add light -------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------------------
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
// Confetti Start
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
// If time of day enabled, add sun light to preview - Confetti Vera.
|
||||
if (m_settings->rendering.sunlight)
|
||||
{
|
||||
rp.AmbientColor.r = GetIEditor()->Get3DEngine()->GetSunColor().x / 255.0f * m_settings->lighting.m_brightness;
|
||||
rp.AmbientColor.g = GetIEditor()->Get3DEngine()->GetSunColor().y / 255.0f * m_settings->lighting.m_brightness;
|
||||
rp.AmbientColor.b = GetIEditor()->Get3DEngine()->GetSunColor().z / 255.0f * m_settings->lighting.m_brightness;
|
||||
|
||||
m_private->m_sun.SetPosition(passInfo.GetCamera().GetPosition() + GetIEditor()->Get3DEngine()->GetSunDir());
|
||||
// The radius value respect the sun radius settings in Engine.
|
||||
// Please refer to the function C3DEngine::UpdateSun(const SRenderingPassInfo &passInfo). -- Vera, Confetti
|
||||
m_private->m_sun.m_fRadius = 100000000; //Radius of the sun from Engine.
|
||||
m_private->m_sun.SetLightColor(GetIEditor()->Get3DEngine()->GetSunColor());
|
||||
m_private->m_sun.SetSpecularMult(GetIEditor()->Get3DEngine()->GetGlobalParameter(E3DPARAM_SUN_SPECULAR_MULTIPLIER));
|
||||
m_private->m_sun.m_Flags |= DLF_DIRECTIONAL | DLF_SUN | DLF_THIS_AREA_ONLY | DLF_LM | DLF_SPECULAROCCLUSION |
|
||||
((GetIEditor()->Get3DEngine()->IsSunShadows() && passInfo.RenderShadows()) ? DLF_CASTSHADOW_MAPS : 0);
|
||||
m_private->m_sun.m_sName = "Sun";
|
||||
|
||||
GetIEditor()->GetEnv()->pRenderer->EF_ADDDlight(&m_private->m_sun, passInfo);
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
// Confetti End
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
else // Add directional light
|
||||
{
|
||||
rp.AmbientColor.r = m_settings->lighting.m_ambientColor.r / 255.0f * m_settings->lighting.m_brightness;
|
||||
rp.AmbientColor.g = m_settings->lighting.m_ambientColor.g / 255.0f * m_settings->lighting.m_brightness;
|
||||
rp.AmbientColor.b = m_settings->lighting.m_ambientColor.b / 255.0f * m_settings->lighting.m_brightness;
|
||||
|
||||
// Directional light
|
||||
if (m_settings->lighting.m_useLightRotation)
|
||||
{
|
||||
m_LightRotationRadian += m_averageFrameTime;
|
||||
}
|
||||
if (m_LightRotationRadian > gf_PI)
|
||||
{
|
||||
m_LightRotationRadian = -gf_PI;
|
||||
}
|
||||
|
||||
Matrix33 LightRot33 = Matrix33::CreateRotationZ(m_LightRotationRadian);
|
||||
|
||||
f32 lightMultiplier = m_settings->lighting.m_lightMultiplier;
|
||||
f32 lightSpecMultiplier = m_settings->lighting.m_lightSpecMultiplier;
|
||||
|
||||
f32 lightOrbit = 15.0f;
|
||||
Vec3 LPos0 = Vec3(-lightOrbit, lightOrbit, lightOrbit / 2);
|
||||
m_private->m_VPLight0.SetPosition(LightRot33 * LPos0);
|
||||
|
||||
Vec3 d0;
|
||||
d0.x = f32(m_settings->lighting.m_directionalLightColor.r) / 255.0f;
|
||||
d0.y = f32(m_settings->lighting.m_directionalLightColor.g) / 255.0f;
|
||||
d0.z = f32(m_settings->lighting.m_directionalLightColor.b) / 255.0f;
|
||||
m_private->m_VPLight0.SetLightColor(ColorF(d0.x * lightMultiplier, d0.y * lightMultiplier, d0.z * lightMultiplier, 0));
|
||||
m_private->m_VPLight0.SetSpecularMult(lightSpecMultiplier);
|
||||
|
||||
m_private->m_VPLight0.m_Flags = DLF_SUN | DLF_DIRECTIONAL;
|
||||
GetIEditor()->GetEnv()->pRenderer->EF_ADDDlight(&m_private->m_VPLight0, passInfo);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
Matrix34 tm(IDENTITY);
|
||||
rp.pMatrix = &tm;
|
||||
rp.pPrevMatrix = &tm;
|
||||
|
||||
rp.dwFObjFlags = 0;
|
||||
|
||||
SRenderContext rc;
|
||||
rc.camera = m_camera.get();
|
||||
rc.viewport = this;
|
||||
rc.passInfo = &passInfo;
|
||||
rc.renderParams = &rp;
|
||||
|
||||
|
||||
for (size_t i = 0; i < m_consumers.size(); ++i)
|
||||
{
|
||||
m_consumers[i]->OnViewportRender(rc);
|
||||
}
|
||||
SignalRender(rc);
|
||||
|
||||
if ((m_settings->rendering.fps == true) && (m_averageFrameTime != 0.0f))
|
||||
{
|
||||
GetIEditor()->GetEnv()->pRenderer->Draw2dLabel(12.0f, 12.0f, 1.25f, ColorF(1, 1, 1, 1), false, "FPS: %.2f", 1.0f / m_averageFrameTime);
|
||||
}
|
||||
|
||||
GetIEditor()->GetEnv()->pRenderer->EF_EndEf3D(SHDF_STREAM_SYNC, -1, -1, passInfo);
|
||||
|
||||
if (m_mouseMovementsSinceLastFrame > 0)
|
||||
{
|
||||
m_mouseMovementsSinceLastFrame = 0;
|
||||
|
||||
// Make sure we deliver at least last mouse movement event
|
||||
OnMouseEvent(m_pendingMouseMoveEvent);
|
||||
}
|
||||
}
|
||||
|
||||
void QViewport::RenderInternal()
|
||||
{
|
||||
{
|
||||
threadID mainThread = 0;
|
||||
threadID renderThread = 0;
|
||||
GetIEditor()->GetEnv()->pRenderer->GetThreadIDs(mainThread, renderThread);
|
||||
const threadID currentThreadId = CryGetCurrentThreadId();
|
||||
|
||||
// I'm not sure if this criteria is right. It might not be restrictive enough, but it's at least strict enough to prevent
|
||||
// the crash we encountered.
|
||||
const uint32 workerThreadId = AZ::JobContext::GetGlobalContext()->GetJobManager().GetWorkerThreadId();
|
||||
const bool isValidThread = (workerThreadId != AZ::JobManager::InvalidWorkerThreadId) || mainThread == currentThreadId || renderThread == currentThreadId;
|
||||
|
||||
if (!isValidThread)
|
||||
{
|
||||
AZ_Assert(false, "Attempting to render QViewport on unsupported thread %" PRI_THREADID, currentThreadId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SetCurrentContext();
|
||||
GetIEditor()->GetEnv()->pSystem->RenderBegin();
|
||||
|
||||
ColorF viewportBackgroundColor(m_settings->background.topColor.r / 255.0f, m_settings->background.topColor.g / 255.0f, m_settings->background.topColor.b / 255.0f);
|
||||
GetIEditor()->GetEnv()->pRenderer->ClearTargetsImmediately(FRT_CLEAR, viewportBackgroundColor);
|
||||
GetIEditor()->GetEnv()->pRenderer->ResetToDefault();
|
||||
|
||||
// Call PreRender to interpolate the new camera position
|
||||
PreRender();
|
||||
GetIEditor()->GetEnv()->pRenderer->SetCamera(*m_camera);
|
||||
|
||||
IRenderAuxGeom* aux = GetIEditor()->GetEnv()->pRenderer->GetIRenderAuxGeom();
|
||||
SAuxGeomRenderFlags oldFlags = aux->GetRenderFlags();
|
||||
|
||||
if (m_settings->background.useGradient)
|
||||
{
|
||||
Vec3 frustumVertices[8];
|
||||
m_camera->GetFrustumVertices(frustumVertices);
|
||||
Vec3 lt = Vec3::CreateLerp(frustumVertices[0], frustumVertices[4], 0.10f);
|
||||
Vec3 lb = Vec3::CreateLerp(frustumVertices[1], frustumVertices[5], 0.10f);
|
||||
Vec3 rb = Vec3::CreateLerp(frustumVertices[2], frustumVertices[6], 0.10f);
|
||||
Vec3 rt = Vec3::CreateLerp(frustumVertices[3], frustumVertices[7], 0.10f);
|
||||
aux->SetRenderFlags(e_Mode3D | e_AlphaNone | e_FillModeSolid | e_CullModeNone | e_DepthWriteOff | e_DepthTestOn);
|
||||
ColorB topColor = m_settings->background.topColor;
|
||||
ColorB bottomColor = m_settings->background.bottomColor;
|
||||
aux->DrawTriangle(lt, topColor, rt, topColor, rb, bottomColor);
|
||||
aux->DrawTriangle(lb, bottomColor, rb, bottomColor, lt, topColor);
|
||||
aux->Flush();
|
||||
}
|
||||
aux->SetRenderFlags(oldFlags);
|
||||
|
||||
Render();
|
||||
|
||||
bool renderStats = false;
|
||||
GetIEditor()->GetEnv()->pSystem->RenderEnd(renderStats, false);
|
||||
RestorePreviousContext();
|
||||
}
|
||||
|
||||
void QViewport::GetImageOffscreen(CImageEx& image, const QSize& customSize)
|
||||
|
||||
@@ -28,7 +28,6 @@ struct SRenderingPassInfo;
|
||||
struct SRendParams;
|
||||
struct Ray;
|
||||
struct IRenderer;
|
||||
struct I3DEngine;
|
||||
struct SSystemGlobalEnvironment;
|
||||
namespace Serialization {
|
||||
class IArchive;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user