Merge branch 'main' into LYN-1767-AB

This commit is contained in:
igarri
2021-05-21 14:54:42 +01:00
1764 changed files with 38196 additions and 86877 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;
};
+1
View File
@@ -123,6 +123,7 @@ ly_add_target(
Gem::Atom_RPI.Public
Gem::Atom_Feature_Common.Static
Gem::AtomToolsFramework.Static
Gem::AtomViewportDisplayInfo
${additional_dependencies}
PUBLIC
3rdParty::AWSNativeSDK::Core
@@ -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
+31 -12
View File
@@ -49,6 +49,7 @@
#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>
@@ -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
{
@@ -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>
-1
View File
@@ -424,7 +424,6 @@ AZ::Outcome<void, AZStd::string> CGameEngine::Init(
sip.pLogCallback = &m_logFile;
sip.sLogFileName = "@log@/Editor.log";
sip.pUserCallback = m_pSystemUserCallback;
sip.pValidator = GetIEditor()->GetErrorReport(); // Assign validator from Editor.
if (sInCmdLine)
{
+1 -2
View File
@@ -106,8 +106,7 @@ void CGotoPositionDlg::OnChangeEdit()
{
const int lengthInSw = 8;
const int strNum = 6;
TArray< float > pos(strNum);
pos.Set(0);
AZStd::vector<float> pos(strNum);
m_sPos = m_ui->m_posEdit->text();
const QStringList parts = m_sPos.split(QRegularExpression("[\\s,;\\t]"), Qt::SkipEmptyParts);
@@ -779,36 +779,6 @@ bool GraphicsSettingsDialog::CVarChanged(AZStd::any val, const char* cvarName, i
m_cVarTracker[cvarName].fileVals[specLevel].editedValue = val;
}
// If changing cvar from the platform cfg file currently running, set cvar
if (GetISystem()->GetConfigPlatform() == m_currentPlatform && GetISystem()->GetConfigSpec() == specLevel + 1)
{
if (ICVar* cvar = gEnv->pConsole->GetCVar(cvarName))
{
int type = cvar->GetType();
if (type == CVAR_INT)
{
int newValue;
if (AZStd::any_numeric_cast<int>(&val, newValue))
{
cvar->Set(newValue);
}
}
else if (type == CVAR_FLOAT)
{
float newValue;
if (AZStd::any_numeric_cast<float>(&val, newValue))
{
cvar->Set(newValue);
}
}
else
{
AZStd::string* currValue = AZStd::any_cast<AZStd::string>(&val);
cvar->Set(currValue->c_str());
}
}
}
// Checking if the newly edited value is equal to the overwritten value
cvarInfo = AZStd::make_pair(azcvarName, m_cVarTracker[cvarName]);
if (CheckCVarStatesForDiff(&cvarInfo, specLevel, EDITED_OVERWRITTEN_COMPARE))
+1 -12
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"
@@ -92,7 +91,6 @@ AZ_POP_DISABLE_WARNING
#ifdef _RELEASE
#undef _RELEASE
#endif
#include <CrtDebugStats.h>
#include "Core/QtEditorApplication.h" // for Editor::EditorQtApplication
@@ -186,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;
@@ -304,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
@@ -1585,16 +1581,9 @@ void CEditorImpl::AddUIEnums()
m_pUIEnumsDatabase->SetEnumStrings("ShadowMinResPercent", types);
}
void CEditorImpl::SetEditorConfigSpec(ESystemConfigSpec spec, ESystemConfigPlatform platform)
void CEditorImpl::SetEditorConfigSpec(ESystemConfigSpec spec, [[maybe_unused]]ESystemConfigPlatform platform)
{
gSettings.editorConfigSpec = spec;
if (m_pSystem->GetConfigSpec(true) != spec || m_pSystem->GetConfigPlatform() != platform)
{
m_pSystem->SetConfigSpec(spec, platform, true);
gSettings.editorConfigSpec = m_pSystem->GetConfigSpec(true);
GetObjectManager()->SendEvent(EVENT_CONFIG_SPEC_CHANGE);
AzToolsFramework::EditorEvents::Bus::Broadcast(&AzToolsFramework::EditorEvents::OnEditorSpecChange);
}
}
ESystemConfigSpec CEditorImpl::GetEditorConfigSpec() const
-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);
@@ -25,7 +25,8 @@
namespace SandboxEditor
{
static void DrawPreviewAxis(AzFramework::DebugDisplayRequests& display, const AZ::Transform& transform, const float axisLength)
// debug
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);
@@ -87,45 +88,43 @@ namespace SandboxEditor
}
AzFramework::ViewportDebugDisplayEventBus::Handler::BusConnect(AzToolsFramework::GetEntityContextId());
ModernViewportCameraControllerRequestBus::Handler::BusConnect(viewportId);
}
ModernViewportCameraControllerInstance::~ModernViewportCameraControllerInstance()
{
ModernViewportCameraControllerRequestBus::Handler::BusDisconnect();
AzFramework::ViewportDebugDisplayEventBus::Handler::BusDisconnect();
}
// should the camera system respond to this particular event
static bool ShouldHandle(const AzFramework::ViewportControllerPriority priority, const bool exclusive)
{
// ModernViewportCameraControllerInstance receives events at all priorities, it should only respond
// to normal priority events if it is not in 'exclusive' mode and when in 'exclusive' mode it should
// only respond to the highest priority events
return !exclusive && priority == AzFramework::ViewportControllerPriority::Normal ||
exclusive && priority == AzFramework::ViewportControllerPriority::Highest;
}
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 (ShouldHandle(event.m_priority, m_cameraSystem.m_cameras.Exclusive()))
{
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));
}
return m_cameraSystem.HandleEvents(AzFramework::BuildInputEvent(event.m_inputChannel, windowSize));
return false;
}
void ModernViewportCameraControllerInstance::UpdateViewport(const AzFramework::ViewportControllerUpdateEvent& event)
{
// only update for a single priority (normal is the default)
if (event.m_priority != AzFramework::ViewportControllerPriority::Normal)
{
return;
}
if (auto viewportContext = RetrieveViewportContext(GetViewportId()))
{
m_updatingTransform = true;
@@ -174,7 +173,13 @@ namespace SandboxEditor
debugDisplay.SetColor(1.0f, 1.0f, 1.0f, alpha);
debugDisplay.DrawWireSphere(m_camera.m_lookAt, 0.5f);
}
}
DrawPreviewAxis(debugDisplay, m_transformEnd, 2.0f);
void ModernViewportCameraControllerInstance::InterpolateToTransform(const AZ::Transform& worldFromLocal)
{
m_animationT = 0.0f;
m_cameraMode = CameraMode::Animation;
m_transformStart = m_camera.Transform();
m_transformEnd = worldFromLocal;
}
} // namespace SandboxEditor
@@ -12,6 +12,8 @@
#pragma once
#include <ModernViewportCameraControllerRequestBus.h>
#include <Atom/RPI.Public/ViewportContext.h>
#include <AzFramework/Entity/EntityDebugDisplayBus.h>
#include <AzFramework/Viewport/CameraInput.h>
@@ -20,7 +22,9 @@
namespace SandboxEditor
{
class ModernViewportCameraControllerInstance;
class ModernViewportCameraController : public AzFramework::MultiViewportController<ModernViewportCameraControllerInstance>
class ModernViewportCameraController
: public AzFramework::MultiViewportController<
ModernViewportCameraControllerInstance, AzFramework::ViewportControllerPriority::DispatchToAllPriorities>
{
public:
using CameraListBuilder = AZStd::function<void(AzFramework::Cameras&)>;
@@ -36,6 +40,7 @@ namespace SandboxEditor
class ModernViewportCameraControllerInstance final
: public AzFramework::MultiViewportControllerInstanceInterface<ModernViewportCameraController>,
public ModernViewportCameraControllerRequestBus::Handler,
private AzFramework::ViewportDebugDisplayEventBus::Handler
{
public:
@@ -46,10 +51,13 @@ namespace SandboxEditor
bool HandleInputChannelEvent(const AzFramework::ViewportControllerInputEvent& event) override;
void UpdateViewport(const AzFramework::ViewportControllerUpdateEvent& event) override;
// ModernViewportCameraControllerRequestBus overrides ...
void InterpolateToTransform(const AZ::Transform& worldFromLocal) override;
private:
// AzFramework::ViewportDebugDisplayEventBus overrides ...
void DisplayViewport(const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay) override;
private:
enum class CameraMode
{
Control,
@@ -0,0 +1,42 @@
/*
* 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/EBus/EBus.h>
#include <AzFramework/Viewport/ViewportId.h>
namespace AZ
{
class Transform;
}
namespace SandboxEditor
{
//! Provides an interface to control the modern viewport camera controller from the Editor.
//! @note The bus is addressed by viewport id.
class ModernViewportCameraControllerRequests : public AZ::EBusTraits
{
public:
using BusIdType = AzFramework::ViewportId;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
//! Begin a smooth transition of the camera to the requested transform.
virtual void InterpolateToTransform(const AZ::Transform& worldFromLocal) = 0;
protected:
~ModernViewportCameraControllerRequests() = default;
};
using ModernViewportCameraControllerRequestBus = AZ::EBus<ModernViewportCameraControllerRequests>;
} // namespace SandboxEditor
+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"]
@@ -2734,9 +2734,6 @@ void CTrackViewDopeSheetBase::DrawKeys(CTrackViewTrack* pTrack, QPainter* painte
const int kDefaultWidthForDescription = 200;
const int kSmallMargin = 10;
FixedDynArray<float> drawnKeyTimes;
drawnKeyTimes.set(ArrayT((float*)alloca(numKeys * sizeof(float)), numKeys));
AZStd::vector<CTrackViewKeyHandle> sortedKeys;
sortedKeys.reserve(numKeys);
for (int i = 0; i < numKeys; ++i)
@@ -2751,11 +2748,6 @@ void CTrackViewDopeSheetBase::DrawKeys(CTrackViewTrack* pTrack, QPainter* painte
CTrackViewKeyHandle keyHandle = sortedKeys[i];
const float time = keyHandle.GetTime();
if (!stl::push_back_unique(drawnKeyTimes, time))
{
continue;
}
int x = TimeToClient(time);
if (x - kSmallMargin > rect.right())
{
@@ -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);
}
-1
View File
@@ -440,7 +440,6 @@ bool CImageTIF::SaveRAW(const QString& fileName, const void* pData, int width, i
{
size_t offset = h * pitch;
int err = TIFFWriteScanline(tif, raster + offset, h, 0);
assert(CryMemory::IsHeapValid());
if (err < 0)
{
bRet = false;
-8
View File
@@ -22,7 +22,6 @@
#include "FileUtil.h"
#include "STLPoolAllocator.h"
#include <functional>
class CIndexedFiles
@@ -117,15 +116,8 @@ private:
std::vector <std::function<void()> > m_updateCallbacks;
IFileUtil::FileArray m_files;
std::map<QString, int> m_pathToIndex;
#if defined(_DEBUG) || defined(AZ_COMPILER_CLANG)
// In debug, the validation phase of the pool allocator when destructed takes so much time,
// and using the STLPoolAllocator causes a strange issue when compiling with clang
typedef std::set<int, std::less<int> > int_set;
typedef std::map<QString, int_set, std::less<QString> > TagTable;
#else
typedef std::set<int, std::less<int>, stl::STLPoolAllocator<int> > int_set;
typedef std::map<QString, int_set, std::less<QString>, stl::STLPoolAllocator<std::pair<const QString, int_set> > > TagTable;
#endif
TagTable m_tags;
QString m_rootPath;
-15
View File
@@ -272,21 +272,6 @@ namespace Path
return str;
}
//! Set the current mod NAME for editing purposes. After doing this the above functions will take this into account
//! name only, please!
void SetModName(const char* input)
{
if (
(!input) ||
((gEnv) && (gEnv->pSystem) && (!gEnv->pSystem->IsMODValid(input))) // we can only validate
)
{
AZ_Warning("PathUtil", false, "Invalid mod name supplied to SetModName: %s - ignored.", input ? input : "(NULL)");
return;
}
g_currentModName = input;
}
//! Get the root folder (in source control or other writable assets) where you should save root data.
AZStd::string GetEditingRootFolder()
{
+59 -13
View File
@@ -13,7 +13,7 @@
// Description : CViewportTitleDlg implementation file
#if !defined(Q_MOC_RUN)
#include "EditorDefs.h"
#include "ViewportTitleDlg.h"
@@ -36,10 +36,13 @@
#include "UsedResources.h"
#include "Include/IObjectManager.h"
#include <AtomLyIntegration/AtomViewportDisplayInfo/AtomViewportInfoDisplayBus.h>
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
#include "ui_ViewportTitleDlg.h"
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
#endif //!defined(Q_MOC_RUN)
// CViewportTitleDlg dialog
@@ -63,6 +66,32 @@ inline namespace Helpers
}
}
namespace
{
class CViewportTitleDlgDisplayInfoHelper
: public QObject
, public AZ::AtomBridge::AtomViewportInfoDisplayNotificationBus::Handler
{
Q_OBJECT
public:
CViewportTitleDlgDisplayInfoHelper(CViewportTitleDlg* parent)
: QObject(parent)
{
AZ::AtomBridge::AtomViewportInfoDisplayNotificationBus::Handler::BusConnect();
}
signals:
void ViewportInfoStatusUpdated(int newIndex);
private:
void OnViewportInfoDisplayStateChanged(AZ::AtomBridge::ViewportInfoDisplayState state)
{
emit ViewportInfoStatusUpdated(static_cast<int>(state));
}
};
} //end anonymous namespace
CViewportTitleDlg::CViewportTitleDlg(QWidget* pParent)
: QWidget(pParent)
, m_ui(new Ui::ViewportTitleDlg)
@@ -115,14 +144,11 @@ void CViewportTitleDlg::OnInitDialog()
m_ui->m_toggleHelpersBtn->setChecked(GetIEditor()->GetDisplaySettings()->IsDisplayHelpers());
ICVar* pDisplayInfo(gEnv->pConsole->GetCVar("r_displayInfo"));
if (pDisplayInfo)
{
SFunctor oFunctor;
oFunctor.Set(OnChangedDisplayInfo, pDisplayInfo, m_ui->m_toggleDisplayInfoBtn);
m_displayInfoCallbackIndex = pDisplayInfo->AddOnChangeFunctor(oFunctor);
OnChangedDisplayInfo(pDisplayInfo, m_ui->m_toggleDisplayInfoBtn);
}
// Add a child parented to us that listens for r_displayInfo changes.
auto displayInfoHelper = new CViewportTitleDlgDisplayInfoHelper(this);
connect(displayInfoHelper, &CViewportTitleDlgDisplayInfoHelper::ViewportInfoStatusUpdated, this, &CViewportTitleDlg::UpdateDisplayInfo);
UpdateDisplayInfo();
connect(m_ui->m_toggleHelpersBtn, &QToolButton::clicked, this, &CViewportTitleDlg::OnToggleHelpers);
connect(m_ui->m_toggleDisplayInfoBtn, &QToolButton::clicked, this, &CViewportTitleDlg::OnToggleDisplayInfo);
@@ -156,6 +182,29 @@ void CViewportTitleDlg::OnToggleHelpers()
//////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::OnToggleDisplayInfo()
{
AZ::AtomBridge::ViewportInfoDisplayState state = AZ::AtomBridge::ViewportInfoDisplayState::NoInfo;
AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::BroadcastResult(
state,
&AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::Events::GetDisplayState
);
state = aznumeric_cast<AZ::AtomBridge::ViewportInfoDisplayState>(
(aznumeric_cast<int>(state)+1) % aznumeric_cast<int>(AZ::AtomBridge::ViewportInfoDisplayState::Invalid));
// SetDisplayState will fire OnViewportInfoDisplayStateChanged and notify us, no need to call UpdateDisplayInfo.
AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::Broadcast(
&AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::Events::SetDisplayState,
state
);
}
//////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::UpdateDisplayInfo()
{
AZ::AtomBridge::ViewportInfoDisplayState state = AZ::AtomBridge::ViewportInfoDisplayState::NoInfo;
AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::BroadcastResult(
state,
&AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::Events::GetDisplayState
);
m_ui->m_toggleDisplayInfoBtn->setChecked(state != AZ::AtomBridge::ViewportInfoDisplayState::NoInfo);
}
//////////////////////////////////////////////////////////////////////////
@@ -544,10 +593,6 @@ void CViewportTitleDlg::UpdateCustomPresets(const QString& text, QStringList& cu
}
}
void CViewportTitleDlg::OnChangedDisplayInfo([[maybe_unused]] ICVar* pDisplayInfo, [[maybe_unused]] QAbstractButton* pDisplayInfoButton)
{
}
bool CViewportTitleDlg::eventFilter(QObject* object, QEvent* event)
{
bool consumeEvent = false;
@@ -609,4 +654,5 @@ namespace AzToolsFramework
}
}
#include "ViewportTitleDlg.moc"
#include <moc_ViewportTitleDlg.cpp>
+1 -3
View File
@@ -60,7 +60,6 @@ public:
static void LoadCustomPresets(const QString& section, const QString& keyName, QStringList& outCustompresets);
static void SaveCustomPresets(const QString& section, const QString& keyName, const QStringList& custompresets);
static void UpdateCustomPresets(const QString& text, QStringList& custompresets);
static void OnChangedDisplayInfo(ICVar* pDisplayInfo, QAbstractButton* pDisplayInfoButton);
bool eventFilter(QObject* object, QEvent* event) override;
@@ -77,6 +76,7 @@ protected:
void OnMaximize();
void OnToggleHelpers();
void OnToggleDisplayInfo();
void UpdateDisplayInfo();
QString m_title;
@@ -87,8 +87,6 @@ protected:
QStringList m_customFOVPresets;
QStringList m_customAspectRatioPresets;
uint64 m_displayInfoCallbackIndex;
void OnMenuFOVCustom();
void CreateFOVMenu();
@@ -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
+3 -7
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,15 @@ set(FILES
LayoutWnd.h
EditorViewportWidget.cpp
EditorViewportWidget.h
EditorViewportSettings.cpp
EditorViewportSettings.h
ViewportManipulatorController.cpp
ViewportManipulatorController.h
LegacyViewportCameraController.cpp
LegacyViewportCameraController.h
ModernViewportCameraController.cpp
ModernViewportCameraController.h
ModernViewportCameraControllerRequestBus.h
RenderViewport.cpp
RenderViewport.h
TopRendererWnd.cpp
@@ -36,6 +36,8 @@ ly_add_target(
Legacy::CryCommon
Legacy::EditorLib
Gem::LmbrCentral
AZ::AtomCore
Gem::Atom_RPI.Public
)
ly_add_dependencies(Editor ComponentEntityEditorPlugin)
@@ -609,14 +609,6 @@ void CComponentEntityObject::InvalidateTM(int nWhyFlags)
{
Matrix34 worldTransform = GetWorldTM();
EBUS_EVENT_ID(m_entityId, AZ::TransformBus, SetWorldTM, LYTransformToAZTransform(worldTransform));
// When transformed via the editor, make sure the entity is marked dirty for undo capture.
EBUS_EVENT(AzToolsFramework::ToolsApplicationRequests::Bus, AddDirtyEntity, m_entityId);
if (CheckFlags(OBJFLAG_SELECTED))
{
EBUS_EVENT(AzToolsFramework::ToolsApplicationEvents::Bus, InvalidatePropertyDisplay, AzToolsFramework::Refresh_Values);
}
}
}
}
@@ -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,6 +33,7 @@
#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/EntityCompositionRequestBus.h>
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
@@ -56,8 +60,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 <ModernViewportCameraControllerRequestBus.h>
#include "Objects/ComponentEntityObject.h"
#include "ISourceControl.h"
#include "UI/QComponentEntityEditorMainWindow.h"
@@ -75,6 +85,7 @@
#include <Editor/Settings.h>
#include <Editor/StringDlg.h>
#include <Editor/QtViewPaneManager.h>
#include <Editor/EditorViewportSettings.h>
#include <IResourceSelectorHost.h>
#include "CryEdit.h"
@@ -1674,32 +1685,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());
SandboxEditor::ModernViewportCameraControllerRequestBus::Event(
viewportContext->GetId(), &SandboxEditor::ModernViewportCameraControllerRequestBus::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);
}
}
}
}