Merge branch 'main' of https://github.com/aws-lumberyard/o3de into ly-as-sdk/LYN-2948-phistere

This commit is contained in:
lumberyard-employee-dm
2021-05-25 23:48:55 -05:00
1623 changed files with 54998 additions and 47910 deletions
@@ -1,290 +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 "AlembicCompileDialog.h"
// Qt
#include <QPushButton>
// AzCore
#include <AzCore/Utils/Utils.h>
#include <Pak/CryPakUtils.h>
// Editor
#include "Util/PathUtil.h"
#include "Util/EditorUtils.h"
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
#include <Alembic/ui_AlembicCompileDialog.h>
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
CAlembicCompileDialog::CAlembicCompileDialog(const XmlNodeRef config)
: m_ui(new Ui::AlembicCompileDialog)
{
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
m_ui->setupUi(this);
m_config = LoadConfig("", config);
OnInitDialog();
connect(m_ui->m_yUpRadio, &QRadioButton::clicked, this, &CAlembicCompileDialog::OnRadioYUp);
connect(m_ui->m_zUpRadio, &QRadioButton::clicked, this, &CAlembicCompileDialog::OnRadioZUp);
connect(m_ui->m_playbackFromMemoryCheckBox, &QCheckBox::clicked, this, &CAlembicCompileDialog::OnPlaybackFromMemory);
connect(m_ui->m_blockCompressionFormatCombo, &QComboBox::currentTextChanged, this, &CAlembicCompileDialog::OnBlockCompressionSelected);
connect(m_ui->m_meshPredictionCheckBox, &QCheckBox::clicked, this, &CAlembicCompileDialog::OnMeshPredictionCheckBox);
connect(m_ui->m_useBFramesCheckBox, &QCheckBox::clicked, this, &CAlembicCompileDialog::OnUseBFramesCheckBox);
connect(m_ui->m_indexFrameDistanceEdit, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &CAlembicCompileDialog::OnIndexFrameDistanceChanged);
connect(m_ui->m_positionPrecisionEdit, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &CAlembicCompileDialog::OnPositionPrecisionChanged);
connect(m_ui->m_uvMaxEdit, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), this, &CAlembicCompileDialog::OnUVmaxChanged);
connect(m_ui->m_presetComboBox, &QComboBox::currentTextChanged, this, &CAlembicCompileDialog::OnPresetSelected);
}
CAlembicCompileDialog::~CAlembicCompileDialog()
{
}
void CAlembicCompileDialog::OnInitDialog()
{
// custom 'Ok' and 'Cancel' text for this dialog
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setText("Recompile .cax File");
m_ui->buttonBox->button(QDialogButtonBox::Cancel)->setText("Use Existing .cax File");
m_ui->m_blockCompressionFormatCombo->addItem(QStringLiteral("store"));
m_ui->m_blockCompressionFormatCombo->addItem(QStringLiteral("deflate"));
m_ui->m_blockCompressionFormatCombo->addItem(QStringLiteral("lz4hc"));
m_ui->m_blockCompressionFormatCombo->addItem(QStringLiteral("zstd"));
AZStd::vector<AZStd::string> presetFiles;
const char* const filePattern = "*.cbc";
SDirectoryEnumeratorHelper dirHelper;
auto engineAssetSourceRoot = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / "Assets";
dirHelper.ScanDirectoryRecursive(gEnv->pCryPak, engineAssetSourceRoot.c_str(), "Editor/Presets/GeomCache", filePattern, presetFiles);
for (auto iter = presetFiles.begin(); iter != presetFiles.end(); ++iter)
{
const auto& file = *iter;
const AZ::IO::FixedMaxPath filePath = engineAssetSourceRoot / file;
m_presets.push_back(LoadConfig(Path::GetFileName(file.c_str()), XmlHelpers::LoadXmlFromFile(filePath.c_str())));
m_ui->m_presetComboBox->addItem(m_presets.back().m_name);
}
m_ui->m_presetComboBox->addItem(tr("(Custom)"));
SetFromConfig(m_config);
UpdatePresetSelection();
UpdateEnabledStates();
}
void CAlembicCompileDialog::SetFromConfig(const SConfig& config)
{
if (QString::compare(config.m_blockCompressionFormat, QLatin1String("deflate"), Qt::CaseInsensitive) == 0)
{
m_ui->m_blockCompressionFormatCombo->setCurrentIndex(1);
}
else if (QString::compare(config.m_blockCompressionFormat, QLatin1String("lz4hc"), Qt::CaseInsensitive) == 0)
{
m_ui->m_blockCompressionFormatCombo->setCurrentIndex(2);
}
else if (QString::compare(config.m_blockCompressionFormat, QLatin1String("zstd"), Qt::CaseInsensitive) == 0)
{
m_ui->m_blockCompressionFormatCombo->setCurrentIndex(3);
}
else
{
m_ui->m_blockCompressionFormatCombo->setCurrentIndex(0);
}
if (QString::compare(config.m_upAxis, QLatin1String("Y"), Qt::CaseInsensitive) == 0)
{
m_ui->m_yUpRadio->setChecked(true);
}
else
{
m_ui->m_zUpRadio->setChecked(true);
}
m_ui->m_playbackFromMemoryCheckBox->setChecked(config.m_playbackFromMemory == QStringLiteral("1"));
m_ui->m_meshPredictionCheckBox->setChecked(config.m_meshPrediction == QStringLiteral("1"));
m_ui->m_useBFramesCheckBox->setChecked(config.m_useBFrames == QStringLiteral("1"));
m_ui->m_indexFrameDistanceEdit->setValue(config.m_indexFrameDistance);
m_ui->m_positionPrecisionEdit->setValue(aznumeric_cast<int>(config.m_positionPrecision));
m_ui->m_uvMaxEdit->setValue(config.m_uvMax);
}
void CAlembicCompileDialog::UpdateEnabledStates()
{
m_ui->m_meshPredictionCheckBox->setEnabled(false);
m_ui->m_useBFramesCheckBox->setEnabled(false);
m_ui->m_indexFrameDistanceEdit->setEnabled(false);
if (QString::compare(m_config.m_blockCompressionFormat, QLatin1String("store"), Qt::CaseInsensitive) != 0)
{
m_ui->m_meshPredictionCheckBox->setEnabled(true);
m_ui->m_useBFramesCheckBox->setEnabled(true);
m_ui->m_indexFrameDistanceEdit->setEnabled(m_config.m_useBFrames == QStringLiteral("1"));
}
}
void CAlembicCompileDialog::UpdatePresetSelection()
{
for (uint i = 0; i < m_presets.size(); ++i)
{
if (m_presets[i] == m_config)
{
m_ui->m_presetComboBox->setCurrentIndex(i);
return;
}
}
m_ui->m_presetComboBox->setCurrentIndex(m_presets.size());
}
QString CAlembicCompileDialog::GetUpAxis() const
{
return m_config.m_upAxis;
}
QString CAlembicCompileDialog::GetPlaybackFromMemory() const
{
return m_config.m_playbackFromMemory;
}
QString CAlembicCompileDialog::GetBlockCompressionFormat() const
{
return m_config.m_blockCompressionFormat;
}
QString CAlembicCompileDialog::GetMeshPrediction() const
{
return m_config.m_meshPrediction;
}
QString CAlembicCompileDialog::GetUseBFrames() const
{
return m_config.m_useBFrames;
}
uint CAlembicCompileDialog::GetIndexFrameDistance() const
{
return m_config.m_indexFrameDistance;
}
double CAlembicCompileDialog::GetPositionPrecision() const
{
return m_config.m_positionPrecision;
}
float CAlembicCompileDialog::GetUVmax() const
{
return m_config.m_uvMax;
}
void CAlembicCompileDialog::OnRadioYUp()
{
m_config.m_upAxis = "Y";
UpdatePresetSelection();
}
void CAlembicCompileDialog::OnRadioZUp()
{
m_config.m_upAxis = "Z";
UpdatePresetSelection();
}
void CAlembicCompileDialog::OnPlaybackFromMemory()
{
m_config.m_playbackFromMemory = m_ui->m_playbackFromMemoryCheckBox->isChecked() ? QStringLiteral("1") : QStringLiteral("0");
UpdatePresetSelection();
}
void CAlembicCompileDialog::OnBlockCompressionSelected()
{
m_config.m_blockCompressionFormat = m_ui->m_blockCompressionFormatCombo->currentText();
UpdatePresetSelection();
UpdateEnabledStates();
}
void CAlembicCompileDialog::OnMeshPredictionCheckBox()
{
m_config.m_meshPrediction = m_ui->m_meshPredictionCheckBox->isChecked() ? QStringLiteral("1") : QStringLiteral("0");
UpdatePresetSelection();
}
void CAlembicCompileDialog::OnUseBFramesCheckBox()
{
m_config.m_useBFrames = m_ui->m_useBFramesCheckBox->isChecked() ? QStringLiteral("1") : QStringLiteral("0");
UpdatePresetSelection();
UpdateEnabledStates();
}
void CAlembicCompileDialog::OnIndexFrameDistanceChanged()
{
m_config.m_indexFrameDistance = m_ui->m_indexFrameDistanceEdit->value();
UpdatePresetSelection();
}
void CAlembicCompileDialog::OnPositionPrecisionChanged()
{
m_config.m_positionPrecision = m_ui->m_positionPrecisionEdit->value();
UpdatePresetSelection();
}
void CAlembicCompileDialog::OnUVmaxChanged()
{
m_config.m_uvMax = aznumeric_cast<float>(m_ui->m_uvMaxEdit->value());
UpdatePresetSelection();
}
void CAlembicCompileDialog::OnPresetSelected()
{
uint presetIndex = m_ui->m_presetComboBox->currentIndex();
if (presetIndex < m_presets.size())
{
m_config = m_presets[presetIndex];
SetFromConfig(m_config);
}
m_ui->m_presetComboBox->setCurrentIndex(presetIndex);
UpdateEnabledStates();
}
CAlembicCompileDialog::SConfig CAlembicCompileDialog::LoadConfig(const QString& fileName, XmlNodeRef xml) const
{
SConfig config;
config.m_name = fileName;
if (xml)
{
config.m_name = xml->getAttr("Name");
config.m_blockCompressionFormat = xml->getAttr("BlockCompressionFormat");
config.m_upAxis = xml->getAttr("UpAxis");
config.m_playbackFromMemory = xml->getAttr("PlaybackFromMemory");
config.m_meshPrediction = xml->getAttr("MeshPrediction");
config.m_useBFrames = xml->getAttr("UseBFrames");
xml->getAttr("IndexFrameDistance", config.m_indexFrameDistance);
xml->getAttr("PositionPrecision", config.m_positionPrecision);
xml->getAttr("UVmax", config.m_uvMax);
}
return config;
}
#include <Alembic/moc_AlembicCompileDialog.cpp>
@@ -1,107 +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_ALEMBIC_ALEMBICCOMPILEDIALOG_H
#define CRYINCLUDE_EDITOR_ALEMBIC_ALEMBICCOMPILEDIALOG_H
#pragma once
#if !defined(Q_MOC_RUN)
#include <QDialog>
#include <IXml.h>
#endif
namespace Ui
{
class AlembicCompileDialog;
}
class CAlembicCompileDialog
: public QDialog
{
Q_OBJECT
public:
CAlembicCompileDialog(const XmlNodeRef config);
~CAlembicCompileDialog();
void OnInitDialog();
QString GetUpAxis() const;
QString GetPlaybackFromMemory() const;
QString GetBlockCompressionFormat() const;
QString GetMeshPrediction() const;
QString GetUseBFrames() const;
uint GetIndexFrameDistance() const;
double GetPositionPrecision() const;
float GetUVmax() const;
private:
struct SConfig
{
SConfig()
: m_upAxis("Y")
, m_playbackFromMemory("0")
, m_blockCompressionFormat("deflate")
, m_meshPrediction("1")
, m_useBFrames("1")
, m_indexFrameDistance(10)
, m_positionPrecision(1.0)
, m_uvMax(1.0f) {}
bool operator ==(const SConfig& other) const
{
return m_blockCompressionFormat == other.m_blockCompressionFormat
&& m_upAxis == other.m_upAxis
&& m_playbackFromMemory == other.m_playbackFromMemory
&& m_meshPrediction == other.m_meshPrediction
&& m_useBFrames == other.m_useBFrames
&& m_indexFrameDistance == other.m_indexFrameDistance
&& m_positionPrecision == other.m_positionPrecision
&& m_uvMax == other.m_uvMax;
}
QString m_name;
QString m_blockCompressionFormat;
QString m_upAxis;
QString m_playbackFromMemory;
QString m_meshPrediction;
QString m_useBFrames;
uint m_indexFrameDistance;
double m_positionPrecision;
float m_uvMax;
};
void SetFromConfig(const SConfig& config);
void UpdateEnabledStates();
void UpdatePresetSelection();
SConfig LoadConfig(const QString& fileName, XmlNodeRef xml) const;
void OnRadioYUp();
void OnRadioZUp();
void OnPlaybackFromMemory();
void OnBlockCompressionSelected();
void OnMeshPredictionCheckBox();
void OnUseBFramesCheckBox();
void OnIndexFrameDistanceChanged();
void OnPositionPrecisionChanged();
void OnUVmaxChanged();
void OnPresetSelected();
SConfig m_config;
std::vector<SConfig> m_presets;
QScopedPointer<Ui::AlembicCompileDialog> m_ui;
};
#endif // CRYINCLUDE_EDITOR_ALEMBIC_ALEMBICCOMPILEDIALOG_H
@@ -1,192 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AlembicCompileDialog</class>
<widget class="QDialog" name="AlembicCompileDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>252</height>
</rect>
</property>
<property name="windowTitle">
<string>Compile Alembic File</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Preset</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QComboBox" name="m_presetComboBox"/>
</item>
</layout>
</widget>
</item>
<item row="0" column="1" rowspan="3">
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Compression Settings</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Block Compression:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="m_blockCompressionFormatCombo"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Precision (mm):</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="m_positionPrecisionEdit">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>UV Max:</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="m_meshPredictionCheckBox">
<property name="text">
<string>Use Mesh Prediction</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="m_useBFramesCheckBox">
<property name="text">
<string>Use Bi-Directional Prediction</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Index Frame Distance:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="m_indexFrameDistanceEdit">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="m_uvMaxEdit">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Compilation Settings</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QRadioButton" name="m_yUpRadio">
<property name="text">
<string>Y-axis up</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="m_zUpRadio">
<property name="text">
<string>Z-axis up</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Runtime Settings</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="m_playbackFromMemoryCheckBox">
<property name="text">
<string>Playback from Memory</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>AlembicCompileDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>AlembicCompileDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
@@ -1,158 +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 "AlembicCompiler.h"
// Editor
#include "AlembicCompileDialog.h"
#include "Util/EditorUtils.h"
#include "Util/FileUtil.h"
#include "Util/PathUtil.h"
// AzCore
#include <AzCore/std/string/wildcard.h>
// AzToolsFramework
#include <AzToolsFramework/AssetBrowser/AssetBrowserEntry.h>
namespace Internal
{
// Attempt to add the file to source control if it is available
bool TryAddFileToSourceControl(const QString& filename)
{
if (!CFileUtil::CheckoutFile(filename.toUtf8().data(), nullptr))
{
CryWarning(VALIDATOR_MODULE_EDITOR, VALIDATOR_ERROR, "Failed to add file %s to the source control provider", filename.toUtf8().constData());
return false;
}
return true;
}
} // namespace Internal
CAlembicCompiler::CAlembicCompiler()
{
AzToolsFramework::AssetBrowser::AssetBrowserInteractionNotificationBus::Handler::BusConnect();
}
CAlembicCompiler::~CAlembicCompiler()
{
AzToolsFramework::AssetBrowser::AssetBrowserInteractionNotificationBus::Handler::BusDisconnect();
}
bool CAlembicCompiler::CompileAlembic(const QString& fullPath)
{
bool compileConfigFileSaved = false;
const QString configPath = Path::ReplaceExtension(fullPath, "cbc");
XmlNodeRef config = XmlHelpers::LoadXmlFromFile(configPath.toUtf8().data());
CAlembicCompileDialog dialog(config);
if (dialog.exec() == QDialog::Accepted)
{
bool configChanged = false;
const QString upAxis = dialog.GetUpAxis();
const QString playbackFromMemory = dialog.GetPlaybackFromMemory();
const QString blockCompressionFormat = dialog.GetBlockCompressionFormat();
const QString meshPrediction = dialog.GetMeshPrediction();
const QString useBFrames = dialog.GetUseBFrames();
const uint indexFrameDistance = dialog.GetIndexFrameDistance();
const double positionPrecision = dialog.GetPositionPrecision();
const float uvMax = dialog.GetUVmax();
if (!config)
{
CryLog("Build configuration file not found, writing new one");
config = XmlHelpers::CreateXmlNode("CacheBuildConfiguration");
configChanged = true;
}
if (strcmp(config->getAttr("UpAxis"), upAxis.toUtf8().data()) != 0)
{
config->setAttr("UpAxis", upAxis.toUtf8().data());
configChanged = true;
}
if (strcmp(config->getAttr("MeshPrediction"), meshPrediction.toUtf8().data()) != 0)
{
config->setAttr("MeshPrediction", meshPrediction.toUtf8().data());
configChanged = true;
}
if (strcmp(config->getAttr("UseBFrames"), useBFrames.toUtf8().data()) != 0)
{
config->setAttr("UseBFrames", useBFrames.toUtf8().data());
configChanged = true;
}
if (atoi(config->getAttr("IndexFrameDistance")) != indexFrameDistance)
{
config->setAttr("IndexFrameDistance", indexFrameDistance);
configChanged = true;
}
if (strcmp(config->getAttr("BlockCompressionFormat"), blockCompressionFormat.toUtf8().data()) != 0)
{
config->setAttr("BlockCompressionFormat", blockCompressionFormat.toUtf8().data());
configChanged = true;
}
if (strcmp(config->getAttr("PlaybackFromMemory"), playbackFromMemory.toUtf8().data()) != 0)
{
config->setAttr("PlaybackFromMemory", playbackFromMemory.toUtf8().data());
configChanged = true;
}
if (atof(config->getAttr("PositionPrecision")) != positionPrecision)
{
config->setAttr("PositionPrecision", positionPrecision);
configChanged = true;
}
if (atof(config->getAttr("UVmax")) != uvMax)
{
config->setAttr("UVmax", uvMax);
configChanged = true;
}
if (configChanged)
{
compileConfigFileSaved = XmlHelpers::SaveXmlNode(GetIEditor()->GetFileUtil(), config, configPath.toUtf8().data());
if (compileConfigFileSaved)
{
// If we just created the file above, or the cbc file was not previously managed, attempt to add it to perforce now.
// Note that XmlHelpers::SaveXmlNode will prompt the user to checkout or overwrite the file
Internal::TryAddFileToSourceControl(configPath);
}
}
}
return compileConfigFileSaved;
}
void CAlembicCompiler::AddSourceFileOpeners(const char* fullSourceFileName, [[maybe_unused]] const AZ::Uuid& sourceUUID, AzToolsFramework::AssetBrowser::SourceFileOpenerList& openers)
{
using namespace AzToolsFramework;
using namespace AzToolsFramework::AssetBrowser;
if (AZStd::wildcard_match("*.abc", fullSourceFileName))
{
auto alembicCallback = [this]([[maybe_unused]] const char* fullSourceFileNameInCall, const AZ::Uuid& sourceUUIDInCall)
{
const SourceAssetBrowserEntry* fullDetails = SourceAssetBrowserEntry::GetSourceByUuid(sourceUUIDInCall);
if (fullDetails)
{
CompileAlembic(fullDetails->GetRelativePath().c_str());
}
};
openers.push_back({ "O3DE_AlembicCompiler", "Open In Alembic Compiler...", QIcon(), alembicCallback });
}
}
@@ -1,31 +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
#include <AzToolsFramework/AssetBrowser/AssetBrowserBus.h>
class CAlembicCompiler
: public AzToolsFramework::AssetBrowser::AssetBrowserInteractionNotificationBus::Handler
{
public:
CAlembicCompiler();
~CAlembicCompiler();
bool CompileAlembic(const QString& fullPath);
protected:
////////////////////////////////////////////////////////////////////////////////////////////////
/// AzToolsFramework::AssetBrowser::AssetBrowserInteractionNotificationBus::Handler
void AddSourceFileOpeners(const char* fullSourceFileName, const AZ::Uuid& sourceUUID, AzToolsFramework::AssetBrowser::SourceFileOpenerList& openers) override;
};
+2 -4
View File
@@ -58,13 +58,11 @@
#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
// LmbrCentral
#include <LmbrCentral/Rendering/EditorLightComponentBus.h> // for LmbrCentral::EditorLightComponentRequestBus
//#define PROFILE_LOADING_WITH_VTUNE
@@ -16,7 +16,7 @@
#include <AzCore/Settings/SettingsRegistry.h>
#include <AzCore/std/string/string_view.h>
namespace Editor
namespace SandboxEditor
{
constexpr AZStd::string_view GridSnappingSetting = "/Amazon/Preferences/Editor/GridSnapping";
constexpr AZStd::string_view GridSizeSetting = "/Amazon/Preferences/Editor/GridSize";
@@ -113,4 +113,4 @@ namespace Editor
registry->Set(ShowGridSetting, showing);
}
}
} // namespace Editor
} // namespace SandboxEditor
+17 -13
View File
@@ -12,27 +12,31 @@
#pragma once
#include <EditorCoreAPI.h>
#include <SandboxAPI.h>
namespace Editor
namespace SandboxEditor
{
EDITOR_CORE_API bool GridSnappingEnabled();
SANDBOX_API bool GridSnappingEnabled();
EDITOR_CORE_API float GridSnappingSize();
SANDBOX_API float GridSnappingSize();
EDITOR_CORE_API bool AngleSnappingEnabled();
SANDBOX_API bool AngleSnappingEnabled();
EDITOR_CORE_API float AngleSnappingSize();
SANDBOX_API float AngleSnappingSize();
EDITOR_CORE_API bool ShowingGrid();
SANDBOX_API bool ShowingGrid();
EDITOR_CORE_API void SetGridSnapping(bool enabled);
SANDBOX_API void SetGridSnapping(bool enabled);
EDITOR_CORE_API void SetGridSnappingSize(float size);
SANDBOX_API void SetGridSnappingSize(float size);
EDITOR_CORE_API void SetAngleSnapping(bool enabled);
SANDBOX_API void SetAngleSnapping(bool enabled);
EDITOR_CORE_API void SetAngleSnappingSize(float size);
SANDBOX_API void SetAngleSnappingSize(float size);
EDITOR_CORE_API void SetShowingGrid(bool showing);
} // namespace Editor
SANDBOX_API void SetShowingGrid(bool showing);
//! Return if the new editor camera system is enabled or not.
//! @note This is implemented in EditorViewportWidget.cpp
SANDBOX_API bool UsingNewCameraSystem();
} // namespace SandboxEditor
+33 -14
View File
@@ -49,9 +49,11 @@
#include <AzToolsFramework/API/ComponentEntityObjectBus.h>
#include <AzToolsFramework/Manipulators/ManipulatorManager.h>
#include <AzToolsFramework/ViewportSelection/EditorInteractionSystemViewportSelectionRequestBus.h>
#include <AzToolsFramework/ViewportSelection/EditorTransformComponentSelectionRequestBus.h>
// AtomToolsFramework
#include <AtomToolsFramework/Viewport/RenderViewportWidget.h>
#include <AtomToolsFramework/Viewport/ModularViewportCameraController.h>
// CryCommon
#include <CryCommon/HMDBus.h>
@@ -74,7 +76,6 @@
#include "EditorPreferencesPageGeneral.h"
#include "ViewportManipulatorController.h"
#include "LegacyViewportCameraController.h"
#include "ModernViewportCameraController.h"
#include "EditorViewportSettings.h"
#include "ViewPane.h"
@@ -102,8 +103,16 @@
#include <IStatObj.h>
AZ_CVAR(
bool, ed_visibility_logTiming, false, nullptr, AZ::ConsoleFunctorFlags::Null,
"Output the timing of the new IVisibilitySystem query");
bool, ed_visibility_logTiming, false, nullptr, AZ::ConsoleFunctorFlags::Null, "Output the timing of the new IVisibilitySystem query");
AZ_CVAR(bool, ed_useNewCameraSystem, false, nullptr, AZ::ConsoleFunctorFlags::Null, "Use the new Editor camera system");
namespace SandboxEditor
{
bool UsingNewCameraSystem()
{
return ed_useNewCameraSystem;
}
} // namespace SandboxEditor
EditorViewportWidget* EditorViewportWidget::m_pPrimaryViewport = nullptr;
@@ -114,7 +123,7 @@ namespace AzFramework
extern InputChannelId CameraOrbitLookButton;
extern InputChannelId CameraOrbitDollyButton;
extern InputChannelId CameraOrbitPanButton;
}
} // namespace AzFramework
#if AZ_TRAIT_OS_PLATFORM_APPLE
void StopFixedCursorMode();
@@ -124,10 +133,6 @@ void StartFixedCursorMode(QObject *viewport);
#define RENDER_MESH_TEST_DISTANCE (0.2f)
#define CURSOR_FONT_HEIGHT 8.0f
AZ_CVAR(
bool, ed_useNewCameraSystem, false, nullptr, AZ::ConsoleFunctorFlags::Null,
"Use the new Editor camera system (the Atom-native Editor viewport (experimental) must also be enabled)");
//! Viewport settings for the EditorViewportWidget
struct EditorViewportSettings : public AzToolsFramework::ViewportInteraction::ViewportSettings
{
@@ -1215,7 +1220,7 @@ void EditorViewportWidget::SetViewportId(int id)
{
AzFramework::ReloadCameraKeyBindings();
auto controller = AZStd::make_shared<SandboxEditor::ModernViewportCameraController>();
auto controller = AZStd::make_shared<AtomToolsFramework::ModularViewportCameraController>();
controller->SetCameraListBuilderCallback([](AzFramework::Cameras& cameras)
{
auto firstPersonRotateCamera = AZStd::make_shared<AzFramework::RotateCameraInput>(AzFramework::CameraFreeLookButton);
@@ -1225,6 +1230,20 @@ void EditorViewportWidget::SetViewportId(int id)
auto firstPersonWheelCamera = AZStd::make_shared<AzFramework::ScrollTranslationCameraInput>();
auto orbitCamera = AZStd::make_shared<AzFramework::OrbitCameraInput>();
orbitCamera->SetLookAtFn([]() -> AZStd::optional<AZ::Vector3> {
AZStd::optional<AZ::Transform> manipulatorTransform;
AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
manipulatorTransform, AzToolsFramework::GetEntityContextId(),
&AzToolsFramework::EditorTransformComponentSelectionRequestBus::Events::GetManipulatorTransform);
if (manipulatorTransform)
{
return manipulatorTransform->GetTranslation();
}
return {};
});
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>();
@@ -2876,27 +2895,27 @@ void EditorViewportWidget::SetAsActiveViewport()
bool EditorViewportSettings::GridSnappingEnabled() const
{
return Editor::GridSnappingEnabled();
return SandboxEditor::GridSnappingEnabled();
}
float EditorViewportSettings::GridSize() const
{
return Editor::GridSnappingSize();
return SandboxEditor::GridSnappingSize();
}
bool EditorViewportSettings::ShowGrid() const
{
return Editor::ShowingGrid();
return SandboxEditor::ShowingGrid();
}
bool EditorViewportSettings::AngleSnappingEnabled() const
{
return Editor::AngleSnappingEnabled();
return SandboxEditor::AngleSnappingEnabled();
}
float EditorViewportSettings::AngleStep() const
{
return Editor::AngleSnappingSize();
return SandboxEditor::AngleSnappingSize();
}
#include <moc_EditorViewportWidget.cpp>
+4
View File
@@ -34,6 +34,7 @@ CGotoPositionDlg::CGotoPositionDlg(QWidget* pParent /*=NULL*/)
{
m_ui->setupUi(this);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setFixedSize(size());
OnInitDialog();
auto doubleValueChanged = static_cast<void(QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged);
@@ -98,6 +99,9 @@ void CGotoPositionDlg::OnInitDialog()
m_ui->m_dymSegX->setVisible(false);
m_ui->m_dymSegY->setVisible(false);
// Ensure the goto button is highlighted correctly.
m_ui->pushButton->setDefault(true);
OnUpdateNumbers();
}
+199 -178
View File
@@ -6,189 +6,210 @@
<rect>
<x>0</x>
<y>0</y>
<width>358</width>
<height>198</height>
<width>290</width>
<height>180</height>
</rect>
</property>
<property name="windowTitle">
<string>Go to Position</string>
</property>
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1,0,0,1,0,0,1">
<item row="6" column="0" colspan="2">
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Go To</string>
</property>
</widget>
</item>
<item row="6" column="3" colspan="2">
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item row="5" column="6" colspan="2">
<spacer name="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 row="3" column="2">
<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>22</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="1">
<widget class="QDoubleSpinBox" name="m_dymZ"/>
</item>
<item row="4" column="1">
<widget class="QDoubleSpinBox" name="m_dymY"/>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="m_dymX"/>
</item>
<item row="4" column="4">
<widget class="QDoubleSpinBox" name="m_dymAngleY"/>
</item>
<item row="3" column="4">
<widget class="QDoubleSpinBox" name="m_dymAngleX"/>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Z:</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Y:</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="8">
<widget class="QLabel" name="label">
<property name="text">
<string>Enter position here:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>X:</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="8">
<widget class="QLineEdit" name="m_posEdit">
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Position:</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QLabel" name="label_5">
<property name="text">
<string>X:</string>
</property>
</widget>
</item>
<item row="3" column="6">
<widget class="QLabel" name="m_labelSegX">
<property name="text">
<string>X:</string>
</property>
</widget>
</item>
<item row="5" column="4">
<widget class="QDoubleSpinBox" name="m_dymAngleZ"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Y:</string>
</property>
</widget>
</item>
<item row="4" column="6">
<widget class="QLabel" name="m_labelSegY">
<property name="text">
<string>Y:</string>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Z:</string>
</property>
</widget>
</item>
<item row="3" column="5">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>22</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="3" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Angles:</string>
</property>
</widget>
</item>
<item row="2" column="6" colspan="2">
<widget class="QLabel" name="m_labelSeg">
<property name="text">
<string>Segments:</string>
</property>
</widget>
</item>
<item row="3" column="7">
<widget class="QSpinBox" name="m_dymSegX"/>
</item>
<item row="4" column="7">
<widget class="QSpinBox" name="m_dymSegY"/>
</item>
</layout>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1,0,0,1,0,0,1">
<item row="5" column="6" colspan="2">
<spacer name="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 row="3" column="2">
<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>22</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="1">
<widget class="QDoubleSpinBox" name="m_dymZ"/>
</item>
<item row="4" column="1">
<widget class="QDoubleSpinBox" name="m_dymY"/>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="m_dymX"/>
</item>
<item row="4" column="4">
<widget class="QDoubleSpinBox" name="m_dymAngleY"/>
</item>
<item row="3" column="4">
<widget class="QDoubleSpinBox" name="m_dymAngleX"/>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Z:</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Y:</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="8">
<widget class="QLabel" name="label">
<property name="text">
<string>Enter position here:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>X:</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="8">
<widget class="QLineEdit" name="m_posEdit">
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Position:</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QLabel" name="label_5">
<property name="text">
<string>X:</string>
</property>
</widget>
</item>
<item row="3" column="6">
<widget class="QLabel" name="m_labelSegX">
<property name="text">
<string>X:</string>
</property>
</widget>
</item>
<item row="5" column="4">
<widget class="QDoubleSpinBox" name="m_dymAngleZ"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Y:</string>
</property>
</widget>
</item>
<item row="4" column="6">
<widget class="QLabel" name="m_labelSegY">
<property name="text">
<string>Y:</string>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Z:</string>
</property>
</widget>
</item>
<item row="3" column="5">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>22</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="3" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Angles:</string>
</property>
</widget>
</item>
<item row="2" column="6" colspan="2">
<widget class="QLabel" name="m_labelSeg">
<property name="text">
<string>Segments:</string>
</property>
</widget>
</item>
<item row="3" column="7">
<widget class="QSpinBox" name="m_dymSegX"/>
</item>
<item row="4" column="7">
<widget class="QSpinBox" name="m_dymSegY"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="buttonLayout">
<item>
<spacer name="horizontalSpacer_1">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Go To</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<tabstops>
<tabstop>m_posEdit</tabstop>
-3
View File
@@ -57,7 +57,6 @@ AZ_POP_DISABLE_WARNING
#include "GameEngine.h"
#include "ToolBox.h"
#include "MainWindow.h"
#include "Alembic/AlembicCompiler.h"
#include "UIEnumsDatabase.h"
#include "RenderHelpers/AxisHelper.h"
#include "Settings.h"
@@ -185,7 +184,6 @@ CEditorImpl::CEditorImpl()
m_pIconManager = new CIconManager;
m_pUndoManager = new CUndoManager;
m_pToolBoxManager = new CToolBoxManager;
m_pAlembicCompiler = new CAlembicCompiler();
m_pSequenceManager = new CTrackViewSequenceManager;
m_pAnimationContext = new CAnimationContext;
@@ -303,7 +301,6 @@ CEditorImpl::~CEditorImpl()
m_bExiting = true; // Can't save level after this point (while Crash)
SAFE_RELEASE(m_pSourceControl);
SAFE_DELETE(m_pAlembicCompiler)
SAFE_DELETE(m_pIconManager)
SAFE_DELETE(m_pViewManager)
SAFE_DELETE(m_pObjectManager) // relies on prefab manager
-2
View File
@@ -48,7 +48,6 @@ class CEditorFileMonitor;
class AzAssetWindow;
class AzAssetBrowserRequestHandler;
class AssetEditorRequestsHandler;
class CAlembicCompiler;
struct IEditorFileMonitor;
class CVegetationMap;
@@ -356,7 +355,6 @@ protected:
CAnimationContext* m_pAnimationContext;
CTrackViewSequenceManager* m_pSequenceManager;
CToolBoxManager* m_pToolBoxManager;
CAlembicCompiler* m_pAlembicCompiler;
CMusicManager* m_pMusicManager;
CErrorReport* m_pErrorReport;
//! Contains the error reports for the last loaded level.
-3
View File
@@ -33,8 +33,6 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
#include <AzQtComponents/Components/Style.h>
#include "CryPhysicsDeprecation.h"
void BeautifyEulerAngles(Vec3& v)
{
if (v.x + v.y + v.z >= 360.0f)
@@ -334,7 +332,6 @@ void CInfoBar::OnBnClickedPhysics()
void CInfoBar::OnBnClickedSingleStepPhys()
{
CRY_PHYSICS_REPLACEMENT_ASSERT();
}
void CInfoBar::OnBnClickedDoStepPhys()
+8 -8
View File
@@ -874,9 +874,9 @@ void MainWindow::InitActions()
.SetCheckable(true)
.RegisterUpdateCallback([](QAction* action) {
Q_ASSERT(action->isCheckable());
action->setChecked(Editor::GridSnappingEnabled());
action->setChecked(SandboxEditor::GridSnappingEnabled());
})
.Connect(&QAction::triggered, []() { Editor::SetGridSnapping(!Editor::GridSnappingEnabled()); });
.Connect(&QAction::triggered, []() { SandboxEditor::SetGridSnapping(!SandboxEditor::GridSnappingEnabled()); });
am->AddAction(ID_SNAPANGLE, tr("Snap angle"))
.SetIcon(Style::icon("Angle"))
@@ -885,9 +885,9 @@ void MainWindow::InitActions()
.SetCheckable(true)
.RegisterUpdateCallback([](QAction* action) {
Q_ASSERT(action->isCheckable());
action->setChecked(Editor::AngleSnappingEnabled());
action->setChecked(SandboxEditor::AngleSnappingEnabled());
})
.Connect(&QAction::triggered, []() { Editor::SetAngleSnapping(!Editor::AngleSnappingEnabled()); });
.Connect(&QAction::triggered, []() { SandboxEditor::SetAngleSnapping(!SandboxEditor::AngleSnappingEnabled()); });
// Display actions
am->AddAction(ID_WIREFRAME, tr("&Wireframe"))
@@ -1275,12 +1275,12 @@ QWidget* MainWindow::CreateSnapToGridWidget()
{
SnapToWidget::SetValueCallback setCallback = [](double snapStep)
{
Editor::SetGridSnappingSize(snapStep);
SandboxEditor::SetGridSnappingSize(snapStep);
};
SnapToWidget::GetValueCallback getCallback = []()
{
return Editor::GridSnappingSize();
return SandboxEditor::GridSnappingSize();
};
return new SnapToWidget(m_actionManager->GetAction(ID_SNAP_TO_GRID), setCallback, getCallback);
@@ -1290,12 +1290,12 @@ QWidget* MainWindow::CreateSnapToAngleWidget()
{
SnapToWidget::SetValueCallback setCallback = [](double snapAngle)
{
Editor::SetAngleSnappingSize(snapAngle);
SandboxEditor::SetAngleSnappingSize(snapAngle);
};
SnapToWidget::GetValueCallback getCallback = []()
{
return Editor::AngleSnappingSize();
return SandboxEditor::AngleSnappingSize();
};
return new SnapToWidget(m_actionManager->GetAction(ID_SNAPANGLE), setCallback, getCallback);
@@ -1,180 +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 "ModernViewportCameraController.h"
#include <Atom/RPI.Public/ViewportContext.h>
#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/Viewport/ViewportScreen.h>
#include <AzFramework/Windowing/WindowBus.h>
#include <AzToolsFramework/Viewport/ViewportMessages.h>
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();
if (!viewportContextManager)
{
return nullptr;
}
auto viewportContext = viewportContextManager->GetViewportContextById(viewportId);
if (!viewportContext)
{
return nullptr;
}
return viewportContext;
}
void ModernViewportCameraController::SetCameraListBuilderCallback(const CameraListBuilder& builder)
{
m_cameraListBuilder = builder;
}
void ModernViewportCameraController::SetupCameras(AzFramework::Cameras& cameras)
{
if (m_cameraListBuilder)
{
m_cameraListBuilder(cameras);
}
}
ModernViewportCameraControllerInstance::ModernViewportCameraControllerInstance(
const AzFramework::ViewportId viewportId, ModernViewportCameraController* controller)
: MultiViewportControllerInstanceInterface<ModernViewportCameraController>(viewportId, controller)
{
controller->SetupCameras(m_cameraSystem.m_cameras);
if (auto viewportContext = RetrieveViewportContext(GetViewportId()))
{
auto handleCameraChange = [this, viewportContext](const AZ::Matrix4x4&) {
if (!m_updatingTransform)
{
UpdateCameraFromTransform(m_targetCamera, viewportContext->GetCameraTransform());
m_camera = m_targetCamera;
}
};
m_cameraViewMatrixChangeHandler = AZ::RPI::ViewportContext::MatrixChangedEvent::Handler(handleCameraChange);
viewportContext->ConnectViewMatrixChangedHandler(m_cameraViewMatrixChangeHandler);
}
AzFramework::ViewportDebugDisplayEventBus::Handler::BusConnect(AzToolsFramework::GetEntityContextId());
}
ModernViewportCameraControllerInstance::~ModernViewportCameraControllerInstance()
{
AzFramework::ViewportDebugDisplayEventBus::Handler::BusDisconnect();
}
bool ModernViewportCameraControllerInstance::HandleInputChannelEvent(const AzFramework::ViewportControllerInputEvent& event)
{
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));
}
void ModernViewportCameraControllerInstance::UpdateViewport(const AzFramework::ViewportControllerUpdateEvent& event)
{
if (auto viewportContext = RetrieveViewportContext(GetViewportId()))
{
m_updatingTransform = true;
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());
}
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);
}
m_updatingTransform = false;
}
}
void ModernViewportCameraControllerInstance::DisplayViewport(
[[maybe_unused]] const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay)
{
if (const float alpha = AZStd::min(-m_camera.m_lookDist / 5.0f, 1.0f); alpha > AZ::Constants::FloatEpsilon)
{
debugDisplay.SetColor(1.0f, 1.0f, 1.0f, alpha);
debugDisplay.DrawWireSphere(m_camera.m_lookAt, 0.5f);
}
DrawPreviewAxis(debugDisplay, m_transformEnd, 2.0f);
}
} // namespace SandboxEditor
@@ -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.
*
*/
#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;
class ModernViewportCameraController : public AzFramework::MultiViewportController<ModernViewportCameraControllerInstance>
{
public:
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;
void UpdateViewport(const AzFramework::ViewportControllerUpdateEvent& event) override;
// AzFramework::ViewportDebugDisplayEventBus overrides ...
void DisplayViewport(const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay) override;
private:
enum class CameraMode
{
Control,
Animation
};
AzFramework::Camera m_camera;
AzFramework::Camera m_targetCamera;
AzFramework::CameraSystem m_cameraSystem;
AZ::Transform m_transformStart = AZ::Transform::CreateIdentity();
AZ::Transform m_transformEnd = AZ::Transform::CreateIdentity();
float m_animationT = 0.0f;
CameraMode m_cameraMode = CameraMode::Control;
bool m_updatingTransform = false;
AZ::RPI::ViewportContext::MatrixChangedEvent::Handler m_cameraViewMatrixChangeHandler;
};
} // namespace SandboxEditor
@@ -482,28 +482,6 @@ void CSelectionGroup::StartScaling()
}
void CSelectionGroup::FinishScaling(const Vec3& scale, [[maybe_unused]] int referenceCoordSys)
{
if (fabs(scale.x - scale.y) < 0.001f &&
fabs(scale.y - scale.z) < 0.001f &&
fabs(scale.z - scale.x) < 0.001f)
{
return;
}
for (int i = 0; i < GetFilteredCount(); ++i)
{
CBaseObject* obj = GetFilteredObject(i);
Vec3 OriginalScale;
if (obj->GetUntransformedScale(OriginalScale))
{
obj->TransformScale(scale);
obj->SetScale(OriginalScale);
}
}
}
//////////////////////////////////////////////////////////////////////////
void CSelectionGroup::Align()
{
@@ -103,7 +103,6 @@ public:
void StartScaling();
void Scale(const Vec3& scale, int referenceCoordSys);
void SetScale(const Vec3& scale, int referenceCoordSys);
void FinishScaling(const Vec3& scale, int referenceCoordSys);
//! Align objects in selection to surface normal
void Align();
//! Very special method to move contents of a voxel.
+5
View File
@@ -38,6 +38,11 @@ AzToolsFramework--ComponentPaletteWidget > QTreeView
background-color: #222222;
}
AzToolsFramework--PropertyRowWidget[canBeReordered="true"] QLabel#Name
{
font-weight: bold;
}
/* Style for visualizing property values overridden from their prefab values */
AzToolsFramework--PropertyRowWidget[IsOverridden=true] #Name QLabel,
AzToolsFramework--ComponentEditorHeader #Title[IsOverridden="true"]
@@ -1,23 +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"
#if defined(USE_GEOM_CACHES)
#include "TrackViewGeomCacheAnimationTrack.h"
CTrackViewKeyHandle CTrackViewGeomCacheAnimationTrack::CreateKey(const float time)
{
return CTrackViewTrack::CreateKey(time);
}
#endif
@@ -1,37 +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_TRACKVIEW_TRACKVIEWGEOMCACHEANIMATIONTRACK_H
#define CRYINCLUDE_EDITOR_TRACKVIEW_TRACKVIEWGEOMCACHEANIMATIONTRACK_H
#pragma once
#if defined(USE_GEOM_CACHES)
#include "IMovieSystem.h"
#include "TrackViewTrack.h"
////////////////////////////////////////////////////////////////////////////
// This class represents a time range track of a geom cache node in TrackView
////////////////////////////////////////////////////////////////////////////
class CTrackViewGeomCacheAnimationTrack
: public CTrackViewTrack
{
public:
CTrackViewGeomCacheAnimationTrack(IAnimTrack* pTrack, CTrackViewAnimNode* pTrackAnimNode,
CTrackViewNode* pParentNode, bool bIsSubTrack = false, unsigned int subTrackIndex = 0)
: CTrackViewTrack(pTrack, pTrackAnimNode, pParentNode, bIsSubTrack, subTrackIndex) {}
virtual CTrackViewKeyHandle CreateKey(const float time);
};
#endif
#endif // CRYINCLUDE_EDITOR_TRACKVIEW_TRACKVIEWGEOMCACHEANIMATIONTRACK_H
@@ -21,7 +21,6 @@
// Editor
#include "TrackViewEventNode.h"
#include "TrackViewGeomCacheAnimationTrack.h"
CTrackViewAnimNode* CTrackViewAnimNodeFactory::BuildAnimNode(IAnimSequence* pSequence, IAnimNode* pAnimNode, CTrackViewNode* pParentNode)
@@ -43,12 +42,5 @@ CTrackViewAnimNode* CTrackViewAnimNodeFactory::BuildAnimNode(IAnimSequence* pSeq
CTrackViewTrack* CTrackViewTrackFactory::BuildTrack(IAnimTrack* pTrack, CTrackViewAnimNode* pTrackAnimNode,
CTrackViewNode* pParentNode, bool bIsSubTrack, unsigned int subTrackIndex)
{
#if defined(USE_GEOM_CACHES)
if (pTrack->GetParameterType() == AnimParamType::TimeRanges && pTrackAnimNode->GetType() == AnimNodeType::GeomCache)
{
return new CTrackViewGeomCacheAnimationTrack(pTrack, pTrackAnimNode, pParentNode, bIsSubTrack, subTrackIndex);
}
#endif
return new CTrackViewTrack(pTrack, pTrackAnimNode, pParentNode, bIsSubTrack, subTrackIndex);
}
@@ -22,8 +22,6 @@ set(FILES
Include/IEditorMaterial.h
Include/IEditorMaterialManager.h
Include/IImageUtil.h
EditorViewportSettings.cpp
EditorViewportSettings.h
Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.qrc
Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp
Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.h
+2 -9
View File
@@ -307,11 +307,6 @@ set(FILES
Util/AffineParts.cpp
Objects/BaseObject.cpp
Objects/BaseObject.h
Alembic/AlembicCompileDialog.cpp
Alembic/AlembicCompileDialog.h
Alembic/AlembicCompileDialog.ui
Alembic/AlembicCompiler.h
Alembic/AlembicCompiler.cpp
Animation/AnimationBipedBoneNames.cpp
Animation/AnimationBipedBoneNames.h
AnimationContext.cpp
@@ -714,14 +709,12 @@ set(FILES
TrackView/TrackViewNode.cpp
TrackView/TrackViewSequence.cpp
TrackView/TrackViewNodeFactories.cpp
TrackView/TrackViewGeomCacheAnimationTrack.cpp
TrackView/TrackViewEventNode.cpp
TrackView/TrackViewAnimNode.h
TrackView/TrackViewTrack.h
TrackView/TrackViewNode.h
TrackView/TrackViewSequence.h
TrackView/TrackViewNodeFactories.h
TrackView/TrackViewGeomCacheAnimationTrack.h
TrackView/TrackViewEventNode.h
ConfigGroup.cpp
ConfigGroup.h
@@ -824,12 +817,12 @@ set(FILES
LayoutWnd.h
EditorViewportWidget.cpp
EditorViewportWidget.h
EditorViewportSettings.cpp
EditorViewportSettings.h
ViewportManipulatorController.cpp
ViewportManipulatorController.h
LegacyViewportCameraController.cpp
LegacyViewportCameraController.h
ModernViewportCameraController.cpp
ModernViewportCameraController.h
RenderViewport.cpp
RenderViewport.h
TopRendererWnd.cpp
@@ -35,6 +35,9 @@ ly_add_target(
AZ::AzToolsFramework
Legacy::CryCommon
Legacy::EditorLib
AZ::AtomCore
Gem::Atom_RPI.Public
Gem::AtomToolsFramework.Static
Gem::LmbrCentral.Editor
RUNTIME_DEPENDENCIES
Gem::LmbrCentral.Editor
@@ -16,12 +16,15 @@
#include <AzCore/Component/ComponentApplicationBus.h>
#include <AzCore/Component/Entity.h>
#include <AzCore/Component/TransformBus.h>
#include <AzCore/Console/IConsole.h>
#include <AzCore/Debug/Profiler.h>
#include <AzCore/Math/Transform.h>
#include <AzCore/RTTI/AttributeReader.h>
#include <AzCore/Slice/SliceComponent.h>
#include <AzCore/std/functional.h>
#include <AzCore/std/string/string.h>
#include <AzCore/std/algorithm.h>
#include <AzCore/std/numeric.h>
#include <AzCore/Asset/AssetManager.h>
#include <AzCore/Outcome/Outcome.h>
#include <AzCore/Interface/Interface.h>
@@ -30,7 +33,9 @@
#include <AzFramework/Entity/EntityContextBus.h>
#include <AzFramework/Physics/Material.h>
#include <AzFramework/StringFunc/StringFunc.h>
#include <AzFramework/Visibility/BoundsBus.h>
#include <AzToolsFramework/API/EditorAssetSystemAPI.h>
#include <AzToolsFramework/API/EditorEntityAPI.h>
#include <AzToolsFramework/API/EntityCompositionRequestBus.h>
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
#include <AzToolsFramework/AssetBrowser/AssetBrowserBus.h>
@@ -56,8 +61,14 @@
#include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
#include <AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.hxx>
#include <AzToolsFramework/UI/Layer/NameConflictWarning.hxx>
#include <AzToolsFramework/ViewportSelection/EditorHelpers.h>
#include <MathConversion.h>
#include <Atom/RPI.Public/ViewportContext.h>
#include <Atom/RPI.Public/ViewportContextBus.h>
#include <AtomToolsFramework/Viewport/ModularViewportCameraControllerRequestBus.h>
#include "Objects/ComponentEntityObject.h"
#include "ISourceControl.h"
#include "UI/QComponentEntityEditorMainWindow.h"
@@ -75,6 +86,7 @@
#include <Editor/Settings.h>
#include <Editor/StringDlg.h>
#include <Editor/QtViewPaneManager.h>
#include <Editor/EditorViewportSettings.h>
#include <IResourceSelectorHost.h>
#include "CryEdit.h"
@@ -181,6 +193,9 @@ void SandboxIntegrationManager::Setup()
(m_prefabIntegrationInterface != nullptr),
"SandboxIntegrationManager requires a PrefabIntegrationInterface instance to be present on Setup().");
m_editorEntityAPI = AZ::Interface<AzToolsFramework::EditorEntityAPI>::Get();
AZ_Assert(m_editorEntityAPI, "SandboxIntegrationManager requires an EditorEntityAPI instance to be present on Setup().");
AzToolsFramework::Layers::EditorLayerComponentNotificationBus::Handler::BusConnect();
}
@@ -367,11 +382,6 @@ void SandboxIntegrationManager::Teardown()
{
AzToolsFramework::Layers::EditorLayerComponentNotificationBus::Handler::BusDisconnect();
AzFramework::DisplayContextRequestBus::Handler::BusDisconnect();
if( m_debugDisplayBusImplementationActive)
{
AzFramework::DebugDisplayRequestBus::Handler::BusDisconnect();
m_debugDisplayBusImplementationActive = false;
}
AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler::BusDisconnect();
AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusDisconnect();
AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect();
@@ -1204,9 +1214,20 @@ void SandboxIntegrationManager::CloneSelection(bool& handled)
if (!duplicationSet.empty())
{
AZStd::unordered_set<AZ::EntityId> clonedEntities;
handled = AzToolsFramework::CloneInstantiatedEntities(duplicationSet, clonedEntities);
m_unsavedEntities.insert(clonedEntities.begin(), clonedEntities.end());
bool prefabSystemEnabled = false;
AzFramework::ApplicationRequests::Bus::BroadcastResult(prefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
if (prefabSystemEnabled)
{
m_editorEntityAPI->DuplicateSelected();
handled = true;
}
else
{
AZStd::unordered_set<AZ::EntityId> clonedEntities;
handled = AzToolsFramework::CloneInstantiatedEntities(duplicationSet, clonedEntities);
m_unsavedEntities.insert(clonedEntities.begin(), clonedEntities.end());
}
}
else
{
@@ -1674,32 +1695,77 @@ bool CollectEntityBoundingBoxesForZoom(const AZ::EntityId& entityId, AABB& selec
//////////////////////////////////////////////////////////////////////////
void SandboxIntegrationManager::GoToEntitiesInViewports(const AzToolsFramework::EntityIdList& entityIds)
{
if (entityIds.size() == 0)
if (entityIds.empty())
{
return;
}
AABB selectionBounds;
selectionBounds.Reset();
bool entitiesAvailableForGoTo = false;
for (const AZ::EntityId& entityId : entityIds)
if (SandboxEditor::UsingNewCameraSystem())
{
if(CollectEntityBoundingBoxesForZoom(entityId, selectionBounds))
const AZ::Aabb aabb = AZStd::accumulate(
AZStd::begin(entityIds), AZStd::end(entityIds), AZ::Aabb::CreateNull(), [](AZ::Aabb acc, const AZ::EntityId entityId) {
const AZ::Aabb aabb = AzFramework::CalculateEntityWorldBoundsUnion(AzToolsFramework::GetEntityById(entityId));
acc.AddAabb(aabb);
return acc;
});
float radius;
AZ::Vector3 center;
aabb.GetAsSphere(center, radius);
// minimum center size is 40cm
const float minSelectionRadius = 0.4f;
const float selectionSize = AZ::GetMax(minSelectionRadius, radius);
auto viewportContextManager = AZ::Interface<AZ::RPI::ViewportContextRequestsInterface>::Get();
const int viewCount = GetIEditor()->GetViewManager()->GetViewCount(); // legacy call
for (int viewIndex = 0; viewIndex < viewCount; ++viewIndex)
{
entitiesAvailableForGoTo = true;
if (auto viewportContext = viewportContextManager->GetViewportContextById(viewIndex))
{
const AZ::Transform cameraTransform = viewportContext->GetCameraTransform();
const AZ::Vector3 forward = (center - cameraTransform.GetTranslation()).GetNormalized();
// move camera 25% further back than required
const float centerScale = 1.25f;
// compute new camera transform
const float fov = AzFramework::RetrieveFov(viewportContext->GetCameraProjectionMatrix());
const float fovScale = (1.0f / AZStd::tan(fov * 0.5f));
const float distanceToTarget = selectionSize * fovScale * centerScale;
const AZ::Transform nextCameraTransform =
AZ::Transform::CreateLookAt(aabb.GetCenter() - (forward * distanceToTarget), aabb.GetCenter());
AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event(
viewportContext->GetId(),
&AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::InterpolateToTransform, nextCameraTransform);
}
}
}
if (entitiesAvailableForGoTo)
else
{
int numViews = GetIEditor()->GetViewManager()->GetViewCount();
for (int viewIndex = 0; viewIndex < numViews; ++viewIndex)
AABB selectionBounds;
selectionBounds.Reset();
bool entitiesAvailableForGoTo = false;
for (const AZ::EntityId& entityId : entityIds)
{
CViewport* viewport = GetIEditor()->GetViewManager()->GetView(viewIndex);
if (viewport)
if (CollectEntityBoundingBoxesForZoom(entityId, selectionBounds))
{
viewport->CenterOnAABB(selectionBounds);
entitiesAvailableForGoTo = true;
}
}
if (entitiesAvailableForGoTo)
{
int numViews = GetIEditor()->GetViewManager()->GetViewCount();
for (int viewIndex = 0; viewIndex < numViews; ++viewIndex)
{
CViewport* viewport = GetIEditor()->GetViewManager()->GetView(viewIndex);
if (viewport)
{
viewport->CenterOnAABB(selectionBounds);
}
}
}
}
@@ -1970,678 +2036,6 @@ void SandboxIntegrationManager::BrowseForAssets(AssetSelectionModel& selection)
AssetBrowserComponentRequestBus::Broadcast(&AssetBrowserComponentRequests::PickAssets, selection, GetMainWindow());
}
void SandboxIntegrationManager::SetColor(float r, float g, float b, float a)
{
if (m_dc)
{
m_dc->SetColor(Vec3(r, g, b), a);
}
}
void SandboxIntegrationManager::SetColor(const AZ::Color& color)
{
if (m_dc)
{
m_dc->SetColor(AZColorToLYColorF(color));
}
}
void SandboxIntegrationManager::SetColor(const AZ::Vector4& color)
{
if (m_dc)
{
m_dc->SetColor(AZVec3ToLYVec3(color.GetAsVector3()), color.GetW());
}
}
void SandboxIntegrationManager::SetAlpha(float a)
{
if (m_dc)
{
m_dc->SetAlpha(a);
}
}
void SandboxIntegrationManager::DrawQuad(const AZ::Vector3& p1, const AZ::Vector3& p2, const AZ::Vector3& p3, const AZ::Vector3& p4)
{
if (m_dc)
{
m_dc->DrawQuad(
AZVec3ToLYVec3(p1),
AZVec3ToLYVec3(p2),
AZVec3ToLYVec3(p3),
AZVec3ToLYVec3(p4));
}
}
void SandboxIntegrationManager::DrawQuad(float width, float height)
{
if (m_dc)
{
m_dc->DrawQuad(width, height);
}
}
void SandboxIntegrationManager::DrawWireQuad(const AZ::Vector3& p1, const AZ::Vector3& p2, const AZ::Vector3& p3, const AZ::Vector3& p4)
{
if (m_dc)
{
m_dc->DrawWireQuad(
AZVec3ToLYVec3(p1),
AZVec3ToLYVec3(p2),
AZVec3ToLYVec3(p3),
AZVec3ToLYVec3(p4));
}
}
void SandboxIntegrationManager::DrawWireQuad(float width, float height)
{
if (m_dc)
{
m_dc->DrawWireQuad(width, height);
}
}
void SandboxIntegrationManager::DrawQuadGradient(const AZ::Vector3& p1, const AZ::Vector3& p2, const AZ::Vector3& p3, const AZ::Vector3& p4, const AZ::Vector4& firstColor, const AZ::Vector4& secondColor)
{
if (m_dc)
{
m_dc->DrawQuadGradient(
AZVec3ToLYVec3(p1),
AZVec3ToLYVec3(p2),
AZVec3ToLYVec3(p3),
AZVec3ToLYVec3(p4),
ColorF(AZVec3ToLYVec3(firstColor.GetAsVector3()), firstColor.GetW()),
ColorF(AZVec3ToLYVec3(secondColor.GetAsVector3()), secondColor.GetW()));
}
}
void SandboxIntegrationManager::DrawTri(const AZ::Vector3& p1, const AZ::Vector3& p2, const AZ::Vector3& p3)
{
if (m_dc)
{
m_dc->DrawTri(
AZVec3ToLYVec3(p1),
AZVec3ToLYVec3(p2),
AZVec3ToLYVec3(p3));
}
}
void SandboxIntegrationManager::DrawTriangles(const AZStd::vector<AZ::Vector3>& vertices, const AZ::Color& color)
{
if (m_dc)
{
// transform to world space
const auto vecTransform = [this](const AZ::Vector3& vec)
{
return m_dc->GetMatrix() * AZVec3ToLYVec3(vec);
};
AZStd::vector<Vec3> cryVertices;
cryVertices.reserve(vertices.size());
AZStd::transform(vertices.begin(), vertices.end(), AZStd::back_inserter(cryVertices), vecTransform);
m_dc->DrawTriangles(
cryVertices,
AZColorToLYColorF(color));
}
}
void SandboxIntegrationManager::DrawTrianglesIndexed(const AZStd::vector<AZ::Vector3>& vertices, const AZStd::vector<AZ::u32>& indices, const AZ::Color& color)
{
if (m_dc)
{
// transform to world space
const auto vecTransform = [this](const AZ::Vector3& vec)
{
return m_dc->GetMatrix() * AZVec3ToLYVec3(vec);
};
AZStd::vector<Vec3> cryVertices;
cryVertices.reserve(vertices.size());
AZStd::transform(vertices.begin(), vertices.end(), AZStd::back_inserter(cryVertices), vecTransform);
m_dc->DrawTrianglesIndexed(
cryVertices,
indices,
AZColorToLYColorF(color));
}
}
void SandboxIntegrationManager::DrawWireBox(const AZ::Vector3& min, const AZ::Vector3& max)
{
if (m_dc)
{
m_dc->DrawWireBox(
AZVec3ToLYVec3(min),
AZVec3ToLYVec3(max));
}
}
void SandboxIntegrationManager::DrawSolidBox(const AZ::Vector3& min, const AZ::Vector3& max)
{
if (m_dc)
{
m_dc->DrawSolidBox(
AZVec3ToLYVec3(min),
AZVec3ToLYVec3(max));
}
}
void SandboxIntegrationManager::DrawSolidOBB(const AZ::Vector3& center, const AZ::Vector3& axisX, const AZ::Vector3& axisY, const AZ::Vector3& axisZ, const AZ::Vector3& halfExtents)
{
if (m_dc)
{
m_dc->DrawSolidOBB(AZVec3ToLYVec3(center), AZVec3ToLYVec3(axisX), AZVec3ToLYVec3(axisY), AZVec3ToLYVec3(axisZ), AZVec3ToLYVec3(halfExtents));
}
}
void SandboxIntegrationManager::DrawPoint(const AZ::Vector3& p, int nSize)
{
if (m_dc)
{
m_dc->DrawPoint(AZVec3ToLYVec3(p), nSize);
}
}
void SandboxIntegrationManager::DrawLine(const AZ::Vector3& p1, const AZ::Vector3& p2)
{
if (m_dc)
{
m_dc->DrawLine(
AZVec3ToLYVec3(p1),
AZVec3ToLYVec3(p2));
}
}
void SandboxIntegrationManager::DrawLine(const AZ::Vector3& p1, const AZ::Vector3& p2, const AZ::Vector4& col1, const AZ::Vector4& col2)
{
if (m_dc)
{
m_dc->DrawLine(
AZVec3ToLYVec3(p1),
AZVec3ToLYVec3(p2),
ColorF(AZVec3ToLYVec3(col1.GetAsVector3()), col1.GetW()),
ColorF(AZVec3ToLYVec3(col2.GetAsVector3()), col2.GetW()));
}
}
void SandboxIntegrationManager::DrawLines(const AZStd::vector<AZ::Vector3>& lines, const AZ::Color& color)
{
if (m_dc)
{
// transform to world space
const auto vecTransform = [this](const AZ::Vector3& vec)
{
return m_dc->GetMatrix() * AZVec3ToLYVec3(vec);
};
AZStd::vector<Vec3> cryLines;
cryLines.reserve(cryLines.size());
AZStd::transform(lines.begin(), lines.end(), AZStd::back_inserter(cryLines), vecTransform);
m_dc->DrawLines(cryLines, AZColorToLYColorF(color));
}
}
void SandboxIntegrationManager::DrawPolyLine(const AZ::Vector3* pnts, int numPoints, bool cycled)
{
if (m_dc)
{
Vec3* points = new Vec3[numPoints];
for (int i = 0; i < numPoints; ++i)
{
points[i] = AZVec3ToLYVec3(pnts[i]);
}
m_dc->DrawPolyLine(points, numPoints, cycled);
delete[] points;
}
}
void SandboxIntegrationManager::DrawWireQuad2d(const AZ::Vector2& p1, const AZ::Vector2& p2, float z)
{
if (m_dc)
{
m_dc->DrawWireQuad2d(
QPoint(static_cast<int>(p1.GetX()), static_cast<int>(p1.GetY())),
QPoint(static_cast<int>(p2.GetX()), static_cast<int>(p2.GetY())),
z);
}
}
void SandboxIntegrationManager::DrawLine2d(const AZ::Vector2& p1, const AZ::Vector2& p2, float z)
{
if (m_dc)
{
m_dc->DrawLine2d(
QPoint(static_cast<int>(p1.GetX()), static_cast<int>(p1.GetY())),
QPoint(static_cast<int>(p2.GetX()), static_cast<int>(p2.GetY())),
z);
}
}
void SandboxIntegrationManager::DrawLine2dGradient(const AZ::Vector2& p1, const AZ::Vector2& p2, float z, const AZ::Vector4& firstColor, const AZ::Vector4& secondColor)
{
if (m_dc)
{
m_dc->DrawLine2dGradient(
QPoint(static_cast<int>(p1.GetX()), static_cast<int>(p1.GetY())),
QPoint(static_cast<int>(p2.GetX()), static_cast<int>(p2.GetY())),
z,
ColorF(AZVec3ToLYVec3(firstColor.GetAsVector3()), firstColor.GetW()),
ColorF(AZVec3ToLYVec3(secondColor.GetAsVector3()), secondColor.GetW()));
}
}
void SandboxIntegrationManager::DrawWireCircle2d(const AZ::Vector2& center, float radius, float z)
{
if (m_dc)
{
m_dc->DrawWireCircle2d(
QPoint(static_cast<int>(center.GetX()), static_cast<int>(center.GetY())),
radius, z);
}
}
void SandboxIntegrationManager::DrawTerrainCircle(const AZ::Vector3& worldPos, float radius, float height)
{
if (m_dc)
{
m_dc->DrawTerrainCircle(
AZVec3ToLYVec3(worldPos), radius, height);
}
}
void SandboxIntegrationManager::DrawTerrainCircle(const AZ::Vector3& center, float radius, float angle1, float angle2, float height)
{
if (m_dc)
{
m_dc->DrawTerrainCircle(
AZVec3ToLYVec3(center), radius, angle1, angle2, height);
}
}
void SandboxIntegrationManager::DrawArc(const AZ::Vector3& pos, float radius, float startAngleDegrees, float sweepAngleDegrees, float angularStepDegrees, int referenceAxis)
{
if (m_dc)
{
m_dc->DrawArc(
AZVec3ToLYVec3(pos),
radius,
startAngleDegrees,
sweepAngleDegrees,
angularStepDegrees,
referenceAxis);
}
}
void SandboxIntegrationManager::DrawArc(const AZ::Vector3& pos, float radius, float startAngleDegrees, float sweepAngleDegrees, float angularStepDegrees, const AZ::Vector3& fixedAxis)
{
if (m_dc)
{
m_dc->DrawArc(
AZVec3ToLYVec3(pos),
radius,
startAngleDegrees,
sweepAngleDegrees,
angularStepDegrees,
AZVec3ToLYVec3(fixedAxis));
}
}
void SandboxIntegrationManager::DrawCircle(const AZ::Vector3& pos, float radius, int nUnchangedAxis)
{
if (m_dc)
{
m_dc->DrawCircle(
AZVec3ToLYVec3(pos),
radius,
nUnchangedAxis);
}
}
void SandboxIntegrationManager::DrawHalfDottedCircle(const AZ::Vector3& pos, float radius, const AZ::Vector3& viewPos, int nUnchangedAxis)
{
if (m_dc)
{
m_dc->DrawHalfDottedCircle(
AZVec3ToLYVec3(pos),
radius,
AZVec3ToLYVec3(viewPos),
nUnchangedAxis);
}
}
void SandboxIntegrationManager::DrawCone(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius, float height, bool drawShaded)
{
if (m_dc)
{
m_dc->DrawCone(
AZVec3ToLYVec3(pos),
AZVec3ToLYVec3(dir),
radius,
height,
drawShaded);
}
}
void SandboxIntegrationManager::DrawWireCylinder(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height)
{
if (m_dc)
{
m_dc->DrawWireCylinder(
AZVec3ToLYVec3(center),
AZVec3ToLYVec3(axis),
radius,
height);
}
}
void SandboxIntegrationManager::DrawSolidCylinder(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height, bool drawShaded)
{
if (m_dc)
{
m_dc->DrawSolidCylinder(
AZVec3ToLYVec3(center),
AZVec3ToLYVec3(axis),
radius,
height,
drawShaded);
}
}
void SandboxIntegrationManager::DrawWireCapsule(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height)
{
if (m_dc)
{
m_dc->DrawWireCapsule(
AZVec3ToLYVec3(center),
AZVec3ToLYVec3(axis),
radius,
height);
}
}
void SandboxIntegrationManager::DrawTerrainRect(float x1, float y1, float x2, float y2, float height)
{
if (m_dc)
{
m_dc->DrawTerrainRect(x1, y1, x2, y2, height);
}
}
void SandboxIntegrationManager::DrawTerrainLine(AZ::Vector3 worldPos1, AZ::Vector3 worldPos2)
{
if (m_dc)
{
m_dc->DrawTerrainLine(
AZVec3ToLYVec3(worldPos1),
AZVec3ToLYVec3(worldPos2));
}
}
void SandboxIntegrationManager::DrawWireSphere(const AZ::Vector3& pos, float radius)
{
if (m_dc)
{
m_dc->DrawWireSphere(AZVec3ToLYVec3(pos), radius);
}
}
void SandboxIntegrationManager::DrawWireSphere(const AZ::Vector3& pos, const AZ::Vector3 radius)
{
if (m_dc)
{
m_dc->DrawWireSphere(
AZVec3ToLYVec3(pos),
AZVec3ToLYVec3(radius));
}
}
void SandboxIntegrationManager::DrawWireDisk(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius)
{
if (m_dc)
{
m_dc->DrawWireDisk(
AZVec3ToLYVec3(pos),
AZVec3ToLYVec3(dir),
radius);
}
}
void SandboxIntegrationManager::DrawBall(const AZ::Vector3& pos, float radius, bool drawShaded)
{
if (m_dc)
{
m_dc->DrawBall(AZVec3ToLYVec3(pos), radius, drawShaded);
}
}
void SandboxIntegrationManager::DrawDisk(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius)
{
if (m_dc)
{
m_dc->DrawDisk(
AZVec3ToLYVec3(pos),
AZVec3ToLYVec3(dir),
radius);
}
}
void SandboxIntegrationManager::DrawArrow(const AZ::Vector3& src, const AZ::Vector3& trg, float fHeadScale, bool b2SidedArrow)
{
if (m_dc)
{
m_dc->DrawArrow(
AZVec3ToLYVec3(src),
AZVec3ToLYVec3(trg),
fHeadScale,
b2SidedArrow);
}
}
void SandboxIntegrationManager::DrawTextLabel(const AZ::Vector3& pos, float size, const char* text, const bool bCenter, int srcOffsetX, int srcOffsetY)
{
if (m_dc)
{
m_dc->DrawTextLabel(
AZVec3ToLYVec3(pos),
size,
text,
bCenter,
srcOffsetX,
srcOffsetY);
}
}
void SandboxIntegrationManager::Draw2dTextLabel(float x, float y, float size, const char* text, bool bCenter)
{
if (m_dc)
{
m_dc->Draw2dTextLabel(x, y, size, text, bCenter);
}
}
void SandboxIntegrationManager::DrawTextureLabel(ITexture* texture, const AZ::Vector3& pos, float sizeX, float sizeY, int texIconFlags)
{
if (m_dc)
{
if (texture)
{
float textureWidth = aznumeric_caster(texture->GetWidth());
float textureHeight = aznumeric_caster(texture->GetHeight());
// resize the label in proportion to the actual texture size
if (textureWidth > textureHeight)
{
sizeY = sizeX * (textureHeight / textureWidth);
}
else
{
sizeX = sizeY * (textureWidth / textureHeight);
}
m_dc->DrawTextureLabel(AZVec3ToLYVec3(pos), sizeX, sizeY, texture->GetTextureID(), texIconFlags);
}
}
}
void SandboxIntegrationManager::DrawTextureLabel(int textureId, const AZ::Vector3& pos, float sizeX, float sizeY, int texIconFlags)
{
// ToDo: With Atom?
AZ_UNUSED(textureId);
AZ_UNUSED(pos);
AZ_UNUSED(sizeX);
AZ_UNUSED(sizeY);
AZ_UNUSED(texIconFlags);
}
void SandboxIntegrationManager::SetLineWidth(float width)
{
if (m_dc)
{
m_dc->SetLineWidth(width);
}
}
bool SandboxIntegrationManager::IsVisible(const AZ::Aabb& bounds)
{
if (m_dc)
{
const AABB aabb(
AZVec3ToLYVec3(bounds.GetMin()),
AZVec3ToLYVec3(bounds.GetMax()));
return m_dc->IsVisible(aabb);
}
return 0;
}
int SandboxIntegrationManager::SetFillMode(int nFillMode)
{
if (m_dc)
{
return m_dc->SetFillMode(nFillMode);
}
return 0;
}
float SandboxIntegrationManager::GetLineWidth()
{
if (m_dc)
{
return m_dc->GetLineWidth();
}
return 0.f;
}
float SandboxIntegrationManager::GetAspectRatio()
{
if (m_dc && m_dc->GetView())
{
return m_dc->GetView()->GetAspectRatio();
}
return 0.f;
}
void SandboxIntegrationManager::DepthTestOff()
{
if (m_dc)
{
m_dc->DepthTestOff();
}
}
void SandboxIntegrationManager::DepthTestOn()
{
if (m_dc)
{
m_dc->DepthTestOn();
}
}
void SandboxIntegrationManager::DepthWriteOff()
{
if (m_dc)
{
m_dc->DepthWriteOff();
}
}
void SandboxIntegrationManager::DepthWriteOn()
{
if (m_dc)
{
m_dc->DepthWriteOn();
}
}
void SandboxIntegrationManager::CullOff()
{
if (m_dc)
{
m_dc->CullOff();
}
}
void SandboxIntegrationManager::CullOn()
{
if (m_dc)
{
m_dc->CullOn();
}
}
bool SandboxIntegrationManager::SetDrawInFrontMode(bool bOn)
{
if (m_dc)
{
return m_dc->SetDrawInFrontMode(bOn);
}
return 0.f;
}
AZ::u32 SandboxIntegrationManager::GetState()
{
if (m_dc)
{
return m_dc->GetState();
}
return 0;
}
AZ::u32 SandboxIntegrationManager::SetState(AZ::u32 state)
{
if (m_dc)
{
return m_dc->SetState(state);
}
return 0;
}
void SandboxIntegrationManager::PushMatrix(const AZ::Transform& tm)
{
if (m_dc)
{
const Matrix34 m = AZTransformToLYTransform(tm);
m_dc->PushMatrix(m);
}
}
void SandboxIntegrationManager::PopMatrix()
{
if (m_dc)
{
m_dc->PopMatrix();
}
}
bool SandboxIntegrationManager::DisplayHelpersVisible()
{
return GetIEditor()->GetDisplaySettings()->IsDisplayHelpers();
@@ -77,6 +77,7 @@ class CHyperGraph;
namespace AzToolsFramework
{
class EditorEntityAPI;
class EditorEntityUiInterface;
namespace AssetBrowser
@@ -99,7 +100,6 @@ class SandboxIntegrationManager
, private AzToolsFramework::EditorEvents::Bus::Handler
, private AzToolsFramework::EditorWindowRequests::Bus::Handler
, private AzFramework::AssetCatalogEventBus::Handler
, private AzFramework::DebugDisplayRequestBus::Handler
, private AzFramework::DisplayContextRequestBus::Handler
, private AzToolsFramework::EditorEntityContextNotificationBus::Handler
, private AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler
@@ -201,70 +201,6 @@ private:
const AzFramework::SliceInstantiationTicket& ticket) override;
//////////////////////////////////////////////////////////////////////////
// AzToolsFramework::DebugDisplayRequestBus
void SetColor(float r, float g, float b, float a) override;
void SetColor(const AZ::Color& color) override;
void SetColor(const AZ::Vector4& color) override;
void SetAlpha(float a) override;
void DrawQuad(const AZ::Vector3& p1, const AZ::Vector3& p2, const AZ::Vector3& p3, const AZ::Vector3& p4) override;
void DrawQuad(float width, float height) override;
void DrawWireQuad(const AZ::Vector3& p1, const AZ::Vector3& p2, const AZ::Vector3& p3, const AZ::Vector3& p4) override;
void DrawWireQuad(float width, float height) override;
void DrawQuadGradient(const AZ::Vector3& p1, const AZ::Vector3& p2, const AZ::Vector3& p3, const AZ::Vector3& p4, const AZ::Vector4& firstColor, const AZ::Vector4& secondColor) override;
void DrawTri(const AZ::Vector3& p1, const AZ::Vector3& p2, const AZ::Vector3& p3) override;
void DrawTriangles(const AZStd::vector<AZ::Vector3>& vertices, const AZ::Color& color) override;
void DrawTrianglesIndexed(const AZStd::vector<AZ::Vector3>& vertices, const AZStd::vector<AZ::u32>& indices, const AZ::Color& color) override;
void DrawWireBox(const AZ::Vector3& min, const AZ::Vector3& max) override;
void DrawSolidBox(const AZ::Vector3& min, const AZ::Vector3& max) override;
void DrawSolidOBB(const AZ::Vector3& center, const AZ::Vector3& axisX, const AZ::Vector3& axisY, const AZ::Vector3& axisZ, const AZ::Vector3& halfExtents) override;
void DrawPoint(const AZ::Vector3& p, int nSize) override;
void DrawLine(const AZ::Vector3& p1, const AZ::Vector3& p2) override;
void DrawLine(const AZ::Vector3& p1, const AZ::Vector3& p2, const AZ::Vector4& col1, const AZ::Vector4& col2) override;
void DrawLines(const AZStd::vector<AZ::Vector3>& lines, const AZ::Color& color) override;
void DrawPolyLine(const AZ::Vector3* pnts, int numPoints, bool cycled) override;
void DrawWireQuad2d(const AZ::Vector2& p1, const AZ::Vector2& p2, float z) override;
void DrawLine2d(const AZ::Vector2& p1, const AZ::Vector2& p2, float z) override;
void DrawLine2dGradient(const AZ::Vector2& p1, const AZ::Vector2& p2, float z, const AZ::Vector4& firstColor, const AZ::Vector4& secondColor) override;
void DrawWireCircle2d(const AZ::Vector2& center, float radius, float z) override;
void DrawTerrainCircle(const AZ::Vector3& worldPos, float radius, float height) override;
void DrawTerrainCircle(const AZ::Vector3& center, float radius, float angle1, float angle2, float height) override;
void DrawArc(const AZ::Vector3& pos, float radius, float startAngleDegrees, float sweepAngleDegrees, float angularStepDegrees, int referenceAxis) override;
void DrawArc(const AZ::Vector3& pos, float radius, float startAngleDegrees, float sweepAngleDegrees, float angularStepDegrees, const AZ::Vector3& fixedAxis) override;
void DrawCone(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius, float height, bool drawShaded = true) override;
void DrawCircle(const AZ::Vector3& pos, float radius, int nUnchangedAxis) override;
void DrawHalfDottedCircle(const AZ::Vector3& pos, float radius, const AZ::Vector3& viewPos, int nUnchangedAxis) override;
void DrawWireCylinder(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height) override;
void DrawSolidCylinder(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height, bool drawShaded = true) override;
void DrawWireCapsule(const AZ::Vector3& center, const AZ::Vector3& axis, float radius, float height) override;
void DrawTerrainRect(float x1, float y1, float x2, float y2, float height) override;
void DrawTerrainLine(AZ::Vector3 worldPos1, AZ::Vector3 worldPos2) override;
void DrawWireSphere(const AZ::Vector3& pos, float radius) override;
void DrawWireSphere(const AZ::Vector3& pos, const AZ::Vector3 radius) override;
void DrawWireDisk(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius) override;
void DrawBall(const AZ::Vector3& pos, float radius, bool drawShaded = true) override;
void DrawDisk(const AZ::Vector3& pos, const AZ::Vector3& dir, float radius) override;
void DrawArrow(const AZ::Vector3& src, const AZ::Vector3& trg, float fHeadScale, bool b2SidedArrow) override;
void DrawTextLabel(const AZ::Vector3& pos, float size, const char* text, const bool bCenter, int srcOffsetX, int scrOffsetY) override;
void Draw2dTextLabel(float x, float y, float size, const char* text, bool bCenter) override;
void DrawTextureLabel(ITexture* texture, const AZ::Vector3& pos, float sizeX, float sizeY, int texIconFlags) override;
void DrawTextureLabel(int textureId, const AZ::Vector3& pos, float sizeX, float sizeY, int texIconFlags) override;
void SetLineWidth(float width) override;
bool IsVisible(const AZ::Aabb& bounds) override;
int SetFillMode(int nFillMode) override;
float GetLineWidth() override;
float GetAspectRatio() override;
void DepthTestOff() override;
void DepthTestOn() override;
void DepthWriteOff() override;
void DepthWriteOn() override;
void CullOff() override;
void CullOn() override;
bool SetDrawInFrontMode(bool bOn) override;
AZ::u32 GetState() override;
AZ::u32 SetState(AZ::u32 state) override;
void PushMatrix(const AZ::Transform& tm) override;
void PopMatrix() override;
// AzFramework::DisplayContextRequestBus (and @deprecated EntityDebugDisplayRequestBus)
// AzFramework::DisplayContextRequestBus
void SetDC(DisplayContext* dc) override;
@@ -371,6 +307,7 @@ private:
AzToolsFramework::EditorEntityUiInterface* m_editorEntityUiInterface = nullptr;
AzToolsFramework::Prefab::PrefabIntegrationInterface* m_prefabIntegrationInterface = nullptr;
AzToolsFramework::EditorEntityAPI* m_editorEntityAPI = nullptr;
// Overrides UI styling and behavior for Layer Entities
AzToolsFramework::LayerUiHandler m_layerUiOverrideHandler;
@@ -65,6 +65,7 @@
#include "OutlinerTreeView.hxx"
#include "Include/ICommandManager.h"
#include "Include/IObjectManager.h"
#include "OutlinerCacheBus.h"
#include <Editor/CryEditDoc.h>
#include <AzCore/Outcome/Outcome.h>
@@ -1538,6 +1539,16 @@ void OutlinerListModel::OnEntityInfoUpdatedName(AZ::EntityId entityId, const AZS
{
(void)name;
QueueEntityUpdate(entityId);
bool isSelected = false;
AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(
isSelected, &AzToolsFramework::ToolsApplicationRequests::IsSelected, entityId);
if (isSelected)
{
// Ask the system to scroll to the entity in case it is off screen after the rename
OutlinerModelNotificationBus::Broadcast(&OutlinerModelNotifications::QueueScrollToNewContent, entityId);
}
}
void OutlinerListModel::OnEntityInfoUpdatedUnsavedChanges(AZ::EntityId entityId)